[geos-devel] GEOSPolygonize() ERROR: Shell is not a LinearRing

Stephen Woodbridge woodbri at swoodbridge.com
Wed Dec 28 19:39:43 EST 2005


I am trying to write a simple utility that will read a shapefile of 
polygons, decompose them into simple linestrings and feed them to 
GEOSPolygonize() so I can take the results and write  a new shapefile 
with good polygons.

So, I have this coded using geos_c.h. I used postgis buildarea() as an 
example of how to process the output of GEOSPolygonize(), but get the 
following  ERROR thrown by GEOS from this statement:

   g = GEOSPolygonize(geoms, nedge);

   if (! g || GEOSGeomTypeId(g) != GEOS_GEOMETRYCOLLECTION)
     goto DONE;

   ngeoms = GEOSGetNumGeometries(g);

   printf("GEOSPolygonize returned %d geoms\n", ngeoms);

...

       extring = GEOSGeom_createPolygon(
         GEOSGeom_clone(GEOSGetExteriorRing(GEOSGetGeometryN(g, i))),
         NULL, 0);


GEOSPolygonize returned 6 geoms
Processing Geom 0
ERROR: Shell is not a LinearRing

I guess, my question is what does this error mean? And why would 
GEOSPolygonize return something that is not a polygon or LinearRing?

If it would by helpful, I can post fixpoly.c and the shapefile.

-Steve



More information about the geos-devel mailing list