[geos-devel] geos_c question from new user

Stephen Woodbridge woodbri at swoodbridge.com
Thu Dec 22 09:40:22 EST 2005

strk at refractions.net wrote:
> On Thu, Dec 22, 2005 at 09:17:30AM -0500, Stephen Woodbridge wrote:
>>Hi all,
>>I'm making my first attempt at using the GEOS C api. Basically, what I 
>>am trying to do is take a bunch of linestrings, polygonize them, extract 
>>the polygons and write them to a shapefile. This seems all pretty 
>>straight forward to do using GEOS.
>>My questions are:
>>1. How do I decompose a MULTIPOLYGON?
>>It appears the GEOSGetNumGeometries() and GEOSGetGeometryN() only work 
>>on collections.
> If confirmed I'd call this a bug, and eventually handle it from
> the C-API.

I say the above because that is what is stated in the comments in geos_c.h

>>2. Is a POLYGON only a single ring and a MULTIPOLYGON a single exterior 
>>ring and some N interior rings? but multiple exterior rings would always 
>>be returned from polygonize as a COLLECTION? If this is true, then I see 
>>how to do it.
> A Polygon is a "shell" ring and an arbitrary number of "hole" rings.
> polygonize would return both exterior-ring only and shell/holes versions.
> You might want to take a look at the BuildArea function in postgis
> which contained an algorithm suggested by Carl Anderson for extracting
> *valid* (multi)polygons from polygonize.

Thanks I will look at that.


More information about the geos-devel mailing list