[OSM-dev] Topologicial correctness in OSM

Jon Burgess jburgess777 at googlemail.com
Wed Jan 17 18:53:52 GMT 2007

On Wed, 2007-01-17 at 17:19 +0000, 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.

It is fairly ridiculous but works. If you can get the data into an OSM
style XML file then the script in utils/simplify/simplify.pl will do
this for you. Specify a fairly small minimum feature size e.g.
--simplify=0.00001 which should get rid of any nodes within about 1m of
each other. 

The script is quite memory hungry on larger data sets. If this is an
issue then I may be able to provide a C implementation at some time in
the future.


More information about the dev mailing list