We're importing a whole bunch of ArcGIS shapefiles into PostGIS, converted on the fly with shp2pgsql
. Problem is, if the shapefiles have any ring self-intersections, the import chokes:
NOTICE: Ring Self-intersection at or near point -80.1338 25.8102
ERROR: new row for relation "place_shapes" violates
check constraint "shape_is_valid"
How can we fix this?
This query often fixes it for me:
UPDATE place_shapes
SET geometry=ST_Buffer(geometry, 0.0);