[OSM-dev] Topologicial correctness in OSM

Nicola Ranaldo ranaldo at unina.it
Wed Jan 17 18:08:19 GMT 2007

On Wednesday 17 January 2007 18:19, Nick Black wrote:
> Hello,
> Whilst trying to produce .osm from the brazillian TABs, I've run into
> a problem, in that the output I can produce output in OSM XML, but it
> is topologically incorrect, as it duplicates nodes at intersections.
> My process is:
> TAB > Import to PostGIS usign ogr2ogr > Script to talk to PG, and
> input data to OSM MYSQL via dao.rb .
> One solution to the problem is to go through mysql and compare each
> lat and lon value to each other, identifying the duplicate nodes and
> then deleting one set and correcting their parent segment - this seems
> a rediculous way to do it though.
> Does anyone have a better idea how to go about it?  I cant see how
> PostGIS maintains topology, but it obviously does somehow.

I had the same problem and i solved checking for duplicates before adding 
nodes or segments, it's the same but faster.
I suppose the gis model does not need to maintains a topology as it simply 
uses different layers for data. If a node at lat,lon is traversed by x ways, 
for example by 4 ways, 2 primary and 2 secondary, there will be 3 layers:
1) a point layer with the node if it is interesting
2) a way layer for primary roads with two linestring objects with all the 
belonging points
3) the same but for secondary roads.

If in the same layer two different ways have the same nodes they are 
duplicated too.

Please correct if i'm wrong.


More information about the dev mailing list