[OSM-talk] De-Duplication of areas

Jon Burgess jburgess777 at googlemail.com
Mon Oct 1 01:33:07 BST 2007


On Mon, 2007-10-01 at 01:53 +0200, Frederik Ramm wrote:
> Hi,
> 
>    I have a Perl script that is capable of removing duplicate objects
> from an area, using the following rules:
> 
> * find any nodes with same tags and at same position as other nodes;
>   remove them
> * if any segments use one of the removed nodes, change the segments
>   to use the remaining node at the same position
> * find any segments that use the same from and to nodes and have 
>   identical tags as another segment; remove them
> * if any ways use one of the removed segments, change the way to use
>   the remaining segment
> * if two or more ways are identical, remove them
> 

This sounds very similar to how my old simplify.pl script works:
svn.openstreetmap.org/applications/utils/filter/simplify 

It was designed to quantise things to a grid, e.g. merge nodes within
0.00001 degrees and then fixup all the segment/way references. If you
changed the quantise function to work with '0' as the quantise grid then
you'd end up with something very similar to your program (currently this
would result in a divide by zero error given the way that function
currently works).

One thing my code lacked was any comparison of tags. It was meant more
as a data simplifcation tool instead of something which was too
rigorous. e.g. if you first filtered the planet for natural=coastline
you can then simplify it to 0.1 degrees and end up with a reasonably
compact representation of all the coastline we have currently.

	Jon






More information about the talk mailing list