5

I've imported the shapefile of corine land cover project to my postgis database and the

select gid, ST_IsValidReason(geom) from gis.clc2000 where not ST_IsValid(geom);

returns in every occasion

gid    |                                st_isvalidreason                                
-------+--------------------------------------------------------------------------------
     1 | IllegalArgumentException: Points of LinearRing do not form a closed linestring
.....

I know that my polygons are closed by visually instecting some of the errors.

How can I fix the topologies errors from withing the server?

edit: I'm using postgresql/postgis2.0.1, Ubuntu12.04

2

Dump the geometry as WKT (ST_AsText), fix it manually (editing the coordinates) or in a gis like Qgis (use snapping) and update the record with the new geometry.

If you can connect the server with Qgis, you can skip the first and last steps.

One good practice is to check the topology before importing data, for that I would suggest GRASS.

  • the data are about 800mb. Which about half of them give that error. The grass suggestion although seems that might work – nickves Sep 24 '12 at 20:06
  • oh, I I thought it was only few records... – Pablo Sep 24 '12 at 20:08
  • 1
    Check v.clean: grass.fbk.eu/gdp/html_grass62/v.clean.html – Pablo Sep 24 '12 at 20:11
  • :) thats why Im looking for automated ways. The source shapefile seems to be the problem. The road through grass might help. – nickves Sep 24 '12 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.