Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer
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
Check v.clean: – 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 posting your answer, you agree to the privacy policy and terms of service.

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