Kosmos/FAQ

From OpenStreetMap Wiki
< Kosmos
Revision as of 12:18, 31 August 2008 by Krza (talk | contribs) (→‎Using rules from the OSM wiki: added comment on local rules)
Jump to navigation Jump to search

Rendering Rules

How to use rules

Q: I started playing with Kosmos. I want to change/add some rendering rules. How do I do this?

A: The default rules that the Kosmos uses is Kosmos General Purpose Rules. If you want to make your own rules, this is the recommended procedure:

  1. Go to Kosmos General Purpose Rules and click Edit.
  2. Copy the raw contents of the page to the clipboard and paste it to some text editor.
  3. Save the file in the text editor somewhere on your disk.
  4. Open the Kosmos GUI with the project you want to set the new rules with.
  5. Click on the root (project) node in the Project Explorer.
  6. You will see Rendering Rules Source in the properties window. Edit it to point to your saved rules file.
  7. Save the Kosmos project.
  8. Now you can edit your local rules file in a text editor and the changes will apply after you select Reload Rendering Rules menu item from the Project Explorer context menu (right-click on the root (project) node.

You can also create your own user page on the OSM Wiki and put the rules there. The advantage of this is that you'll have the rules stored in a single place. The disadvantage is that you'll need an internet connection do access them when rendering maps (well only for the first time, since Kosmos caches the rules downloaded from the internet on a local disk. So if the internet connection is down or the rules page is not accessible, the Kosmos will use the cached ones).

If you think your rules could be useful to other people, then create a new Wiki page for them. You can see the current "repository" of Kosmos rules by visiting the. I recommend adding this category to your own rules page(s).

If you feel that a particular rule is missing from Kosmos General Purpose Rules, feel free to add it. But keep these rules in a general spirit of "general purpose" rules. --Breki 07:27, 27 July 2008 (UTC)

Using rules from the OSM wiki

Q: I set the rendering rules source to an OSM Wiki page (example: http://wiki.openstreetmap.org/index.php/Kosmos_General_Purpose_Rules) but Kosmos returns an error. What is the problem?

A: Kosmos reads Wiki pages in the raw form (raw form is what you see if you start to edit a Wiki page). In order to get the raw form, Kosmos adds "action=raw" to the URL. Unfortunately this doesn't work with URLs in the http://wiki.openstreetmap.org/index.php/Kosmos_General_Purpose_Rules format. Instead, you have to specify the URL in the following format: http://wiki.openstreetmap.org/index.php?title=Kosmos_General_Purpose_Rules (notice the ?title=).

Yes, I know this could be done automatically - maybe it will be done in future. --Breki 16:07, 1 August 2008 (UTC)

So why don´t you add the action tag to the link above, Breki, or even better to the link in the example *.kpr file? This would make it very clear. But the automatic adding of "action=raw" is not transparent to the user at all. By the way: You even don´t need to change the code because it does not matter if the action tag is stated twice in the address.
Okay, once again in one word: Every one who wants to draw a local rules file from a Wiki rules page needs to use the above "title" format plus the "action" tag as follows (example for Kosmos General Purpose Rules):
http://wiki.openstreetmap.org/index.php?title=Kosmos_General_Purpose_Rules&action=raw  
The result needs to be saved as text file (e.g. MyRules.txt) and referenced in the *.kpr file according to the local operating system path rules or in the file:/// syntax.
--Krza 12:18, 31 August 2008 (UTC)

Showing stuff not covered by rules

Q: Is it possible to create a rendering rule which would show all ways/nodes which were not covered by other rules?

A: I had this question come up several times, so let me explain.

Short answer: Kosmos GUI has a feature called "unused ways and nodes" which (when turned on) allows you to display (in a visually irritant way) nodes/ways which were not covered by the rules (see http://igorbrejc.net/openstreetmap/kosmos/spotting-unused-ways-in-kosmos for more info).

Long answer: Rules in Kosmos are implemented in such a way as to not exclude each other. The excluding is only available for child rules. That's why you cannot set a "default" rule at the end of the ruleset to cover anything else that wasn't covered by the rules above.

The problem in general is how do you define what's covered and what's not? Example: you have a node that is a part of the highway. You have the way covered with a rule, but the node also contains a bus stop tag, for which you did not set a rendering rule. Is the node covered by rules or not?

Relations make things even more complicated.

Icons for areas

Q: I want to show an icon at the center of an area (car parking, for example). Is this possible?

A: No, currently the Icon template is supported for nodes only, but I will add support for areas (=ways) in the next release of Kosmos. --Breki 07:03, 27 July 2008 (UTC)

Local icons

Q: Can i use local path for icons in IconUrl? For example: IconUrl=C:/Program Files/Kosmos 2.1/Maps/icon.png or IconUrl=../icons/icon.png (for use in intranet or without access to internet)

A: Currently the icons are downloaded using the HTTP protocol, so the direct answer would be "no" (for icons on the local disk - intranet icons are not a problem). But there is a hack that you could use: images, after being downloaded for the first time, are stored in the cache directory (Cache\ImageCache) using the name of the image as the file name. Once in this cache, they are no longer retrieved from the internet, so you could copy them manually there if you want to work offline. --Breki 19:25, 8 August 2008 (UTC)

Tile Server

Limiting bounds

Q: Is it possible to put a "bounds" on the tiles generated, if for instance I have an OSM file which covers a large area, but I only want to generate tiles for a small part of this? A: Yes, this is one of the (currently undocumented and not very tested) features of the Kosmos project file. Here's a sample extract of the Kosmos project file (in regards to tile serving):

  ...
  <TileMapService>
    <TileServerUrl>http://localhost/Kosmos</TileServerUrl>
    <TileStorageRootDir>Tiles</TileStorageRootDir>
    <MaxTilesZoomLevel>17</MaxTilesZoomLevel>
    <MinTilesZoomLevel>0</MinTilesZoomLevel>
    <TiledMapBounds>14.45375,37.5370833333333,15.5920833333333,37.9795833333333</TiledMapBounds>
  </TileMapService>
  ...

TiledMapBounds setting optionally specifies the area (min. longitude, min. latitude, max. longiture, max. latitude) of the map that you want to cover with tiles. So you'll have to edit the .kpr file in a text editor and add this setting.