[Qgis-developer] Valid or invalid geom in PostGIS?

Paolo Cavallini cavallini at faunalia.it
Mon Jan 16 04:33:38 PST 2017


Il 16/01/2017 13:23, Mark Johnson ha scritto:
> This is a GEOS error that is being reported
> - your Geometry has a Topological error
> 
>     > 2017-01-16T11:34:52   1       NOTA: NOTICE:  Self-intersection at or near point
>     > 619746.32941695023 4869530.4882389866
>     > 2017-01-16T11:34:52   1       NOTA: NOTICE:  IllegalArgumentException: Invalid
>     > number of points in LinearRing found 3 - must be 0 or >= 4
> 
> 
> Look for  'ST_SelfIntersections(..)' in PostGis
> - it will show the points that cause such errors
> -- not sure of PostGis has this command
> 
> The first error
> - is often a POLYGON that has been created from single LINESTRINGs
> -- 1 or more of these LINESTRINGs have been included more than once
> --- remove the double LINESTRINGs to correct
> ---> will start at the given point: 619746.32941695023 4869530.4882389866
> 
> The error message will only show the first POINT, if there are more than
> one you should look for the next.
> 
> The second error means that the ExteriorRing of the POLYGON only has 3
> POINTs
> - 4 are required to be Topologicaly correct
> SELECT ST_NumPoints(ST_ExteriorRing(geometry))
> - should return 3 in this case, but should be 4 at least
> 
> Certain functions, that use GEOS, will not bring correct results
> - when Topological error exists
> -- and should be corrected

Hi Mak,
thanks for your feedback. Shouldn't this be reported by ST_IsValid also?

select ST_IsValid(the_geom) from istat where ST_IsValid(the_geom) = FALSE;
 st_isvalid
------------
(0 rows)

All the best.
-- 
Paolo Cavallini - www.faunalia.eu
QGIS & PostGIS courses: http://www.faunalia.eu/training.html
https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis


More information about the Qgis-developer mailing list