OpenStreetMap

Nik4 gets smarter every day

Posted by Zverik on 4 June 2014 in English.

Since the release of Nik4 some bugs were fixed: namely, scale (-s 10000 = 1:10000) is applied correctly, georeferencing parameters were corrected, and very large tiled maps (bigger than 16k×16k, mapnik’s limit on images) are created without errors and are properly georeferenced (you can load them in QGIS without any extra work).

Now the version is 1.4, and there are features to make producing maps more fun. For example, you don’t need to extract latitude and longitude to get an image of an area you see at osm.org: just run

nik4.py --url http://www.openstreetmap.org/#map=16/55.9865/37.2160 osm.xml screenshot.png

and you’ll get 1280×1024 map near that point. Like a screenshot, but more flexible. Users from USA can now specify US Letter paper format (--paper letter, or shorter -a l). Style XML can be streamed from stdin, and the resulting image can be streamed to stdout.

Dimensions are not bound to width and height now: they are swapped automatically to better fit given bounding box. And you can set one of dimensions to 0 to calculate it from bbox. See this chapter of documentation for examples.

Finally, styles can now have variable parameters. If there is ${name:default} sequence anywhere in style XML, with --vars name=value argument you can replace it with any value, or with the default value, if name is omitted. This allows for printing different routes with the same style, or exporting a map in many languages.

To update Nik4 with pip, run pip uninstall nik4; pip install nik4. For calculating bbox for a given route, you can use this page.

Discussion

Log in to leave a comment