[OSM-talk] fixing multipolygons

Robert Vollmert rvollmert-lists at gmx.net
Sat Mar 8 20:16:02 GMT 2008


Hello,

I've attached an ugly python script that does some manipulations to  
relations in an OSM file it reads from stdin. In particular, for  
relations that aren't degenerate, it puts role=outer on the largest  
polygon and role=inner on all others. It also removes tags from inner  
ways that are the same as on the outer way.

It only works on multipolygons that consist of closed ways. There's a  
lot of multipolygons with two opposing riverbanks in the database.  
Also some worse ones like http://api.openstreetmap.org/api/0.5/ 
relation/240. These really aren't multipolygons and should be  
relations of a different type -- should I modify them to  
type=multi_way_area or something?

There's both relations with less than two members, and ways with less  
than two nodes in here. Ok if I delete these?

Here's some statistics for the relations with id up to 500:

393 relations
235 with non-closed ways
  53 with less than two members
  32 containing ways with less than two nodes
  56 modified relations

122 modified ways

Cheers
Robert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: multi.py
Type: text/x-python-script
Size: 3599 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20080308/153bc59f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osmxml.py
Type: text/x-python-script
Size: 2649 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20080308/153bc59f/attachment-0001.bin>


More information about the talk mailing list