New version of Kosmos is here. Since I’ve neglected the rendering engine during the implementation of 2.0 release, I decided to do most of the work for this release on improving the rendering.
You can download the 2.1 version from the standard place: http://downloads.igorbrejc.net/osm/kosmos/
UPDATE (July 19th): I discovered a small bug in the new release – generated contours were not shown on the map. This has been fixed now, please download a new package.
So what has been improved?
Relations
Kosmos can now render relations. I’ve added a sample rule in general purpose rules Wiki page for rendering cycle routes:
| Rule Name |
Targets |
Selector |
Template |
Options |
Comment |
| RouteCycle |
 |
type=route route=bicycle |
Polyline (MinZoom=7, Color=#50FF0718, Width=7:1;17:18, Curved=true) |
will produce a pinkish half-transparent cycle route:

Note that rules ignore roles of members in a relation – currently I don’t see how the roles could be incorporated into the rendering rules.
Text Rendering
There is a new TextMode called WayCenter which draws the text (roughly) in the center of a way:

There are also two new parameters which enable rendering of outlined text: OutlineColor and OutlineWidth, example (sorry for the odd formatting):
PlaceTown
place=town Text (MinZoom=10, MaxZoom=15, Color=black, TagToUse=name, FontName=Trebuchet MS, FontStyle=bold, FontSize=10:10;17:25, OutlineColor=white, OutlineWidth=20%)
will produce something like this:

Kosmos now knows how to wrap labels:

The wrapping is done using the “Text label wrap factor” preferences setting. It is a ratio of (roughly) maximum line length compared to the line height. Normal values are somewhere from 4 to 10, I guess.
Map Scale Indicator
… is now shown on the map:

You can turn it off. You can also switch from metric to U.S. Customary units in Preferences dialog (“Use metric units“).
Rendering Engine Speed-Up
I’ve refactored quite a large piece of rendering engine code to increase the rendering speed and lower the memory consumption. Basically, in previous versions each rendered map element had all its settings (color name, width, …) stored by itself. Now the settings shared by multiple elements are stored in one place (a “style”). This also allows caching of GDI+ objects for each style without the need to recreate them for each map element.
There are also a number of bugfixes in this release (basically every bug that was reported has been fixed).
Source Code
I’ve also published the sources here: http://downloads.igorbrejc.net/osm/kosmos/source/ . I’ll prepare a special Wiki page with some information about the source code and what one can and what one cannot expect from it. So please be patient before starting to send me hate notes about not being able to compile the source code