[Routing] Binary file format

Adam Boardman osm-routing at adamboardman.co.uk
Mon Dec 10 21:10:24 GMT 2007


Adrian,

I've been working on: 
http://wiki.openstreetmap.org/index.php/OSM_Mobile_Binary_Protocol

Which is basically a vector tile base mechanism for downloading OSM 
data.

With a view towards routing over the data (and trying to keep the data 
as small as possible) I've been planning to parse the data on 
downloading the tile in the mobile device and match up nodes that appear 
in more than one way and mark them as junction nodes, along with 
distances to other junction nodes. All that data would then be saved in 
the db, I'm not convinced that the processing power of mobile phones (my 
target device) is such that this is not possible with the latency of 
network connections and flash file system save speeds would make it 
worth doing server side.

Having said that the binary protocol is designed to permit differnet 
clients request different reply data so some clients could request 
server generated routing tables, and others not.

My next planned improvement to the PHPProxy code is to support relations 
(currently ignored), but to make them useful by automatically creating 
extra ones server side (in the proxy so would use negative id's, only 
valid for that tile) if it would reduce the data to be transmitted. So 
two (or more) consecutive ways that have the same name (or other key 
assignments), remove the key values from the way, and ceate a relation 
that references all ways and has one copy of the name/key values.

If were talking two ways that have the value ref=A7, then I'd making a 
whole relation (4+1+1+2+4+4) = 16 bytes is more costly than storing the 
data directly in the way (1+2+1+2) = 6 bytes, so in that case we wouldnt 
do it, but in the case of two ways of Princes Street (4+1+1+14) = 20 
bytes extra for relation, or in way (1+14+1+14) = 30 bytes, then you 
would.

The best thing would of course be to have these kind of relations 
automatically created by the API in the main OSM database, they would 
then have official ids and I wouldnt have to worry about assigning 
local ID's on the client for any negative ones. Also relations would 
then work crossing tile boundarys much better.

Cheers,

Adam.




More information about the Routing mailing list