[OSM-dev] invalid geometry in planet_polygon

Michael Kussmaul kussmaul.list at nix.ch
Wed Aug 25 07:00:32 BST 2010


This is how we do it:

1.) I import with osm2pgsql like usual, this will create some invalid geometries

2.) I clean the invalid geometries after the import like this:
- Download the cleanGeometry.sql script:
- add it to the db:
 sudo -u postgres ./psql -d <dbname> -f cleanGeometries.sql
- then run this update query, where I just replace the invalid geometry with a cleaned geometry:
SQL: update planet_osm_polygon set way=cleanGeometry(way) where not ST_IsValid(way);
(I just do it for polygons, you can do it for ways as well if needed)

This takes a couple of minutes on the europe-db - but not too long.

kind regards

More information about the dev mailing list