From OpenStreetMap Wiki
Jump to navigation Jump to search

To display maps on Rana, you will need to copy a set of binary map files onto the device, and unzip them into the rana/data/tiledata directory

Maps that you can download

Generating your own maps

To generate a set of maps from an OSM file, download the tiledata2 program:

svn co http://svn.openstreetmap.org/applications/utils/export/tiledata2 

Create the necessary folders if they do not exist

mkdir {data,output}

then run

python initialParse.py < yourOsmFile.osm


bzcat yourOsmFile.osm.bz2 | python initialParse.py


For proper UTF-8 handling the patch posted at Talk:Rana works. The important part is

-      string = str(string)
+      string = string.encode('utf-8')

You may need to rm data/nodes.dat after unsuccessful runs.

FIXME: how are places.txt generated? initialParse.py does not seem to generate them.

Once you have generated maps (or especially if you regularly generate maps), please share them by posting them on a website somewhere and adding a URL to this page.

Map file format

The directories are numbered according to the zoom-8 tile they contain. e.g. 127,84 at z8 would contain data for north London, and comprise 4096 files stored in rana/data/tiledata/127_84/*.bin

Files are numbered according to the zoom-14 tile they contain, e.g. rana/data/tiledata/127_84/8185_5448.bin would contain the area around Buckingham Palace

For details of the binary file format, see tiledata2/binary file format

Customising the rendering

Currently there is only one map style available, and it's coded into:


Look for the setupStyles() function

Why vector maps?

Vector maps are currently used in preference to downloading map images from the web, for various reasons:

  • Can render lots of zoom levels from one dataset
  • Can use same data for routing
  • Can change the rendering on-the-fly (e.g. to make your current mode of transport the most highlighted)
  • Different needs on mobile devices to PCs:
    • Need higher contrast than web-maps
    • Higher resolution screen, and viewed when moving, both mean wider lines needed
    • Useful to have yellow-on-black and similar for viewing in sunlight

Next steps

See Rana/User guide for running the program once it's installed