[postgis-users] Problem cleaning invalid geometries

L Bogert-O'Brien dlawbob at ncf.ca
Wed Aug 18 16:23:32 PDT 2010


I have been setting up a PostGIS database with the boundary files 
from Census Canada.  There are a number of invalid geometries, either 
Self-intersection at or near point X, Y or Ring Self-intersection at 
or near point X, Y, especially for the year 2006. For most of the 
files, the cleangeometry() function as found at 
http://www.sogis1.so.ch/sogis/dl/postgis/cleanGeometry.sql
created by Duster Horst with suggestions by Kevin Neufeld 
(http://www.mail-archive.com/postgis-users@postgis.refractions.net/msg03531.html) 
cleans the invalid geometries up (although I haven't checked them for 
errors such as  those Kevin talked about).  However, for several 
geometries, the process runs for a very long time and the cpu use is 
listed as 100% from running top.   One process I even left running 
for 2 days before killing it.  Also, it seems that even after the 
cleaning of these geometries is successful, requests such as "SELECT 
* FROM table WHERE NOT ST_ISVALID(the_geom);" take a long time to 
complete and are listed as using 100% of the CPU while they run.

Can anyone shed any light on why this might be?

I was also interested in why some of the function calls in the 
cleangeometry() function do not have the "ST_" prefix in front of 
them.  Is there any difference between a call to boundary and 
st_boundary, for example, in Postgis 1.4 or 1.5.  I am running this 
on Ubuntu LINUX with PostgresPlus 8.4SS from EnterpriseDB, since I 
always set the path as PATH=/opt/PostgresPlus/8.4SS/bin. This is with 
Postgis 1.4, I believe, although it looks like someone else on the 
machine has also enabled postgis 1.5 in the synaptic package manager.

Thanks,

Loretta





More information about the postgis-users mailing list