[OSM-talk] "OSMBabel" - a universal OSM-to-other-formats application

Lars Aronsson lars at aronsson.se
Wed Sep 27 00:03:55 BST 2006


Nick Whitelegg wrote:

> I'm wondering whether the best way forward would  be to develop a 
> universal OSM-to-other-formats application, kind of like GPSBabel in the 

What kind of question is this?  Do you expect a yes or no answer?
Of course we want it, if we can have it for free!

I'd say the broken part is the current OSM format.  After 
downloading the planet.osm dump, it is very hard to pick out the 
part that is Sweden or downtown London.  This is for the same 
reason that it's hard to draw a tile in the slippy map.  You just 
cannot pick the right segments without having to consult the 
(entire) nodes table.  Both the database and the planet.osm dump 
have geo coordinates tied to nodes, while segments refer to node 
numbers, and ways refer to segment IDs. This is of course a good 
Boyce-Codd Normal Form (BCNF) from any textbook on database design 
and normalization.  But it doesn't make things as fast as they 
could be.  If instead the segment and way tables were given some 
extra columns to represent a bounding box for that object, and 
every update of the database took the extra work of updating these 
columns, then ways and segments could be directly retrieved based 
on overlapping bounding boxes.

What you can do, without redesigning all of OSM, is that you can 
convert the planet.osm dump to one that has this bounding box 
information added.  In terms of data format, this is very easy 
thanks to XML's extensibility.  Instead of

  <segment id="7" from="9" to="34" timestamp="2005-04-18T15:09:57+01:00"/>

You just output something like this:

  <segment id="7" from="9" to="34" timestamp="2005-04-18T15:09:57+01:00"
   bbox="-0.145203,51.523945,-0.145921,51.525119" />

If OSM ever decides to implement these new columns in the 
database, your program could be useful as a conversion utility.
Awaiting that, your program could be universally useful to anybody 
who wants to extract a limited region from the planet.osm dump.



-- 
  Lars Aronsson (lars at aronsson.se)
  Aronsson Datateknik - http://aronsson.se




More information about the talk mailing list