[postgis-users] problems cleaning geometry - other options?
Mark Cave-Ayland
mark.cave-ayland at siriusit.co.uk
Thu Dec 4 02:44:17 PST 2008
William Kyngesburye wrote:
> I'm trying to fix some polygons-with-holes imported from shapefiles
> where the main polygon is not the first in the list, one of the hole
> polygons is, making them invalid.
>
> These are 3D multipolygons - imported from the SRTM SWBD shapefiles
> (with GDAL). (file w162n55n if anyone wants to try)
>
> The cleanGeometry funtion at:
>
> http://postgis.refractions.net/support/wiki/index.php?CleanPolygons
>
> isn't working, I get an error:
>
> =>select astext(cleangeometry(wkb_geometry)) from swbd where cell =
> 145018 and wb = 353;
> NOTICE: Hole lies outside shell at or near point -161.201 55.9992 0
> CONTEXT: PL/pgSQL function "cleangeometry" line 15 at IF
> ERROR: Dimensions mismatch in lwcurve
> CONTEXT: PL/pgSQL function "cleangeometry" line 19 at assignment
>
> I tried forcing the geometry to 2D (st_force_2d()) and I get a different
> error:
>
> NOTICE: Hole lies outside shell at or near point -161.201 55.9992
> CONTEXT: PL/pgSQL function "cleangeometry" line 15 at IF
> ERROR: Exception in LWGEOM2GEOS: curved geometry not supported.
> CONTEXT: PL/pgSQL function "cleangeometry" line 19 at assignment
>
> These shapefiles don't have curved geometry (I'm not sure it's supported
> in shapefiles).
>
>
> I wonder if there is a simpler operation that could reorder sub-polygons
> to put the one that contains all the others first? And would it be
> faster or slower?
Hi William,
Which versions of PostgreSQL/PostGIS is this? Since the error message in
question is only in the lwcurve curve, it sounds like an internal error.
If you can extract a standalone test case and post it on the bug
tracker, I'll take a look at it.
ATB,
Mark.
--
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063
More information about the postgis-users
mailing list