Tiledata2/binary file format

From OpenStreetMap Wiki
Jump to: navigation, search

The structure of the binary file format is also visible by reading the python script which loads it or the script which creates it

Files contain ways. There is no header, and the end of the file is marked only by EOF().

Each way contains:

  • WayID (4-byte int)
  • Number of nodes (currently 4-byte int)
  • 0 or more nodes:
  • x (4-byte int - treat the x,y coordinates as being a zoom-31 tile number to get lat/lon)
  • y (as per x)
  • ID (4-byte int)
  • Style (currently 4-byte int - this corresponds to one of the line types in enum.txt, where enum.txt is generated at the same time as the data)
  • Layer (1-byte signed int - negative numbers are below ground level, positive numbers are bridges, flyovers, etc.)
  • Size in bytes of all misc info for this way
  • 0 or more bits of misc info:
  • type (1 character)
  • size (2-byte int)
  • text (however long size said)

Misc info types can be:

  • N = name
  • r = ref

Sample enums.txt at: