From Navit's Wiki
Revision as of 13:59, 27 November 2007 by (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Some words about the binary driver, used to convert OSM maps to a format usable for navigation :

The map coordinates of binfile are in meters, measured from equator and null meridian, with a merkator projection. The limit of this world is about 20000 km in earch direction from this null point. This doesn't cover polar regions, but it's ok for now.

So, the world gives a 40000x40000km rectangle. This rectangle is divided into 4 equally-sized sub-rectangles called a,b,c and d...

  • a is top left
  • b top right
  • c bottom left
  • d bottom right

Each of this sub-rectangles is then further subdivided, so a rectlangle "aa" is top left in "a"

This is continued further up to 14 levels (but the number of levels might be variable). So in the end effect you get many tiles which are containing objects which are within this tile... And the tiles are also containing references to tiles which are within them.

Each tile is a member file in a zip file. So to extract an area of this file, you just read the zip file sequentially.

How to extract a specific area from this map format

You can calculate the bounding box of the current tile.

Then there are two possibilities:

  • The tile overlaps with the area you are interested in : Then simply copy the whole file data, including its header to the output, and add an entry to the directory which will be written later
  • - The tile doesn't overlap : Then don't drop that file, but instead write a file with size 0 and the same name to the output (I will explain later why this is needed), and add an entry to the directory