From OpenStreetMap Wiki
< Kosmos(Redirected from Kosmos FAQ)
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 (you have to be logged in otherwise click View Source).
  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)

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.

Compare also Kosmos Rendering Help for syntax of new rules.

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)

Transparent Tiles

Q: I want to generate tiles with transparency. Is this possible?

A: Of course, just set the alpha-value of the LandBackgroundColor option in rendering rules. Example: instead of LandBackgroundColor=#F8F8F8, set it to #80f8f8f8, this should make the map background color half-transparent. The same can be done for any of the colors in Kosmos rules.

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: (UPDATED) From Kosmos v2.2 you now specify the map bounds in the command line. See Kosmos Tile Map Server for more info.

Beginners FAQ

How to start a new Project (Windows GUI)

Q: I am a total newbie. How to start from scratch

A: Well, there may be more than one way to start. But the way described below is reliable.

1. Choose “Open a browser” link from the intro-screen.
2. Now on the tab "Web-map"a OSM map is shown. The tab "Map" is empty.
Standard map is Mapnik. You may choose other maps like osmarender from the menu in tab "Web-Map". Move/zoom the map to the area you would like to download (the download area will approximately be what you see on the Web map, so be careful not to use a too large area). You see the map-window of openstreetmap.org including the tabs for e.g. editing the map. If you must edit the map, do this outside Kosmos. Breki, the author of Kosmos disencourages such actions, stating that some browsers have features "beyond my control". Better use some offline tool like josm. Load an offline osm-file into Kosmos by right-clicking the directory "OSM Files" in the Project directory and choose "Add File(s).
3. Click on the “Permalink” link on the bottom right corner of the map.
4. The map will be reloaded. If this is done, click on the “To Main Map” button above the map.
5. Now select the “OSM | Download OSM Data” menu item.
6. The download progress window should be shown. After downloading, you should have the OSM map you wanted.
If you now want now to save your project, you must separately save the open files shown in the Project explorer on the left side of your screen. Right-click them and save.
7 Render now the map by pressing the reload-button.
8 If you want to use other than the general purpose rules see above in the prededing FAQ's