In PostGIS I have imported a shapefile - some of this is Invalid according to PostGIS.
Following online help I have first split the invalid polygons into a new table:
CREATE TABLE s_invalid AS SELECT * FROM sdata WHERE NOT ST_IsValid(the_geom); DELETE FROM sdata WHERE NOT ST_IsValid(the_geom);
I then buffered the invalid polygons by 0 to sort out the issue:
UPDATE s_invalid SET the_geom = ST_Buffer(the_geom,0); SELECT count(*), ST_IsValid(the_geom) FROM s_invalid GROUP BY ST_IsValid;
All seems ok, now I want to append the cleaned-up polygons back into the original table and this is where I have an issue. I have tried:
INSERT INTO sdata SELECT * FROM s_invalid;
But there seems to be a mismatch with the geometry type from the best I can see - I get the message:
ERROR: new row for relation "sdata" violates check constraint "enforce_geotype_the_geom" ********** Error ********** ERROR: new row for relation "sdata" violates check constraint "enforce_geotype_the_geom" SQL state: 23514
How can I sort this... where is the issue? Is there an easier way to sort this out? Thanks, I really want to get to grips with this!