[OSM-dev] Segment-free OSM database and API

Nick Whitelegg nick at hogweed.org
Fri Jan 5 18:54:28 GMT 2007


Been thinking a bit more about the idea of a segment-free OSM database and its 
benefits for shapefile, and consequently easy Mapnik map, production. 
Therefore, if there's interest, I'll set up a segment free OSM database on 
dev, consisting of linear ways made up of ordered list of nodes, with 
direction (no superways as yet!) and based on planet.osm. It could also have 
its own API (Richard - maybe this could tie in with Potlatch?)

Current data will of course need to be cleaned up before adding to the 
database, to correct ways which have the segments in non-sequential order, or 
not all aligned in the right direction. Branched ways would also need to be 
split.

I've quickly devised some rough, high-level pseudocode for each of these 
tasks. This is based on simply thinking about the problem, maybe there are 
some not-immediately-obvious algorithms which would do it faster, please let 
me know if there are.

Thanks,
Nick

---------------

Re-order ways:

Find one node common to only one segment
Add to ordered list of nodes
Get parent segment
Until we find another node common to only one segment
	Find the other node in the segment
	Add to ordered list of nodes
	Get parent segment
Loop

Split branched way:

Find one linear way as in "re-order ways", above

Find the first node in the first linear way belonging to more than two 
segments
Find another segment common to the node, not done already
Find another way as in "re-order ways", above
Recursively repeat this process to completely split the branched way




More information about the dev mailing list