From OpenStreetMap Wiki
Jump to: navigation, search

This page contains some code I find useful when working with OSM-data.

GPS devices I use

During a GPS-related project I had to evaluate several data-loggers:

  • i-BT747
  • i-BT821
  • Columbus V900 (good for paperless logging due to the built-in voice-recorder)
  • Canmore GT-730FL-S (my favorite at the moment)
  • Canmore GT-730FL

When I find some time I will write a more detailled comparison and the pros/cons of each device.


Based on planet-090909 I generated my own tagstats: A simple text-file with 19.865 different tag-keys found. The keys were logged "as is" - no case converting or anything else was done.

I modified (rewrote) so it is callable from the commandline (or a cron-job or another script) with getopt-options (and not "hard-coded" coordinates). To prevent conflicts I renamed the script to

$ ./ -h
Usage: [options]
 -h, --help            show this help message and exit
 -m Z0, --minzoom=Z0   MinZoom at which the renderer should start (default:
 -n Zn, --maxzoom=Zn   MaxZoom at which the renderer should stop (default: 8)
 -t, --tile            If set, startx is the Dir of Tile and starty the name
                       of the tilefile
 -a X0, --startx=X0    Where to start rendering: X (depends on tile-option!)
 -b Y0, --starty=Y0    Where to start rendering: Y (depends on tile-option!)
 -x Xn, --endx=Xn      Where to end rendering: X (depends on tile-option!)
 -y Yn, --endy=Yn      Where to end rendering: Y (depends on tile-option!)
 -o, --overwrite       When set existing tiles will be overwritten, otherwise
                       the renderer will continue without re-rendering
 -f FILE, --file=FILE  Read list of Tiles to [re-] render from file. This
                       implies option --tile.

Most options are clear, perhaps -t / --tile should be explained: You may define what to render with coordinates (like in the bbox in __main__ in, startx, starty, endx and endy are the four parts which define the bbox) or as a starting-tile with X and Y. The latter was needed to re-render tiles which were expired by osm2pgsql.

An example shows how to use this new option: --tile --startx=81 --starty==77 --minzoom=8 --maxzoom=13 --overwrite

will render tiles/8/81/77.png and all sub-tiles of this tile up to maxzoom (so tiles/9/162/154.png up to tiles/13/2613/2463.png will be created). --tile --startx=0 --starty=0 --minzoom=0 --maxzoom=15 --overwrite

would re-render the whole world up to zoomlevel 15 (probably you won't use this example in reality.).

Another change (not sure whether it's really an improvement, a 302-redirect would be better) is that blank water or land-tiles are created as symlink (only POSIX-systems). You need some images for this to work (compressed and uncompressed version of water- and land-tile (The tiles WATER.png and LAND.png are the tiles to which empty tiles are symlinked, the tiles WATER0.png and LAND0.png are needed to check the rendering result of mapnik):

WATER.png WATER0.png LAND.png LAND0.png

The code of is on a separate page

If you find a bug, have questions and so on - please let me know. (ml-osm AT bettercom DOT de)

Memory issues

The first release could cause memory leakage. Also is affected by this bug. I've written a separate page about this bug. The current version (0.1.0) is not longer affected.

A little shell script for updating the Mapnik-DB daily within a cron-job. At the moment I'm not satisfied with it due to the poor performance. Separate page

More info at wikipedia

I also have an userpage at German wikipedia where you may find more informations (only in German).