[OSM-dev] invalid geometry in planet_polygon

Stephan Knauss osm at stephans-server.de
Tue Aug 24 08:22:12 BST 2010

Frederik Ramm wrote:
> Stephan Knauss wrote:
> Yes, of course, there are hundreds of thousands of invalid geometries.
For postgis only 11k on the planet are that broken it considers them 

> http://tools.geofabrik.de/osmi/debug.html?view=multipolygon&lon=7.86328&lat=49.49239&zoom=5&overlays=invalid_geometry_hull,duplicate_ways,intersections,intersection_lines,ring_not_closed_hull,ring_not_closed,unconnected_end_nodes,touching_inner_rings_hull,touching_inner_rings,role_mismatch_hull,role_mismatch,duplicate_tags_hull,duplicate_tags,multipolygons_type_is_boundary,type_is_boundary,ways,role_markers,way_end_nodes,way_nodes 
Great tool. I did not know it can also check Multipolygons. Thank you 
for providing this. A big help is it showing the actual intersection 
point causing the problem.

> The API doesn't (and can't) prevent them, and osm2pgsql makes no efforts 
> (and couldn't really) correct them.

So it's best to prepend every whery that relies on valid geometries with 
"AND ST_IsValid(way)"


More information about the dev mailing list