Smrender News

Road map with preliminary ruleset.

Now more than five months passed since my latest posting about Smrender  and a lot of improvements and new features are implemented since then.

The current revision is r1293. So what’s new in a nutshell:1

  • Action syntax and internal processing totally restructured in such a way that every action now is a function (r1240).
  • Mercator projection now implemented correctly (r1253).
  • Preliminary ruleset for rendering of road maps added (r1261).
  • OSM relations are now supported (r1276).
  • Coordinate parser for command line improved (r1285).
  • Oversampling (anti-aliasing) implemented (r1286).
  • New function shape() to generate standard shapes (triangle,…) implemented (r1288).
  • A lot of various fixes.

Flexible Action Syntax

The original action syntax was less intuitive also it had some limitations. I completely reimplemented this in a very modular way and the syntax is now (hopefully) intuitive.

   <action> := <ref> [ ':' <param> [ ';' <param> [ ... ] ] ]
   <ref>    := <func> [ '@' <library> ]
   <param>  := <name> '=' <value>

If ‘library’ is omitted, Smrender calls a built-in function. Rendering functions, for example drawing lines or placing captions are now implemented as functions and are not treated in any special way (as it was the case in early versions). The following example places a caption at nodes tagged with place=hamlet.

<node>
   <tag k='_action_' v='cap:font=serif;size=1.5;key=name'/>
   <tag k='place' v='hamlet'/>
</node>

Smrender Supports Relations

It now reads relations from the input file as well as from the rule set (of course ;). Currently the action cat_poly() and draw() support relations. The latter will draw all ways which are members of the relation acording to the drawing parameters. cat_poly() will concatenate all ways of the relation to one new way. This way will inherit all tags of the relation.

Better Command Line Parser

The last argument to Smrender is the “window”.2 The window specifies the center point and the scale of the area to be rendered. The center point is defined in latitude and longitude, for example 43N52.8:15E12.8:100000. The order of the latitude and longitude is irrelevant in this case because Smrender will automatically detect it.

Generating Shapes

Smrender comes with the new built-in action shape() which is able to generate various shapes, such as triangles, squares, and circles. Actually, it does not render the shape directly but it generates a new temporary way to which a subsequent draw() action may be applied.

—-

Several additional improvements were made. The Mercator projection was incorrect because the vertical stretching was missing. This is corrected. Another improvement is “oversampling” which is a technique of anti-aliasing. Smrender does not render directly to the final image. Foreach (rendering) rule it creates a temporary layer on which the features are drawn. After the rule is completed, the layer is copied to the final image. With this technique, anti-aliasing works correct.

The Smrender package also includes a preliminary ruleset to render land maps. The file is found in /usr/local/share/smrender/rules_land.osm and will be extended to reflect a hiking and horse riding map. The title picture above shows an example. A PDF version is available here.

Please feel free to contact me if you have some troubles or questions regarding Smrender!

 

  1. A full documentation of Smrender can be found at its project page www.abenteuerland.at/smrender.
  2. See Chapter 4 of Documentation for details.