[postgis-users] exterior rings in multipolygons

Mr. Puneet Kishor punk.kish at gmail.com
Tue Jul 26 07:31:50 PDT 2011


On Jul 26, 2011, at 7:33 AM, Sandro Santilli wrote:

> On Tue, Jul 26, 2011 at 07:16:15AM -0500, Mr. Puneet Kishor wrote:
> 
>> Thanks for confirming the above. However, per my follow-up email (see http://postgis.refractions.net/pipermail/postgis-users/2011-July/030366.html), I am not getting the interior rings as polygons. They are coming out as LINESTRINGs. Shouldn't the indivdual components of the MULTIPOLYGON be POLYGONs?
> 
> Individual components of MULTIPOLYGONs are POLYGONs.
> You get them with ST_GeometryN.
> Components of POLYGONs are RINGs.
> Ring are represented as closed LINESTRINGS, following OGC spec.
> You can make polygons out of closed LINESTRINGs using ST_MakePolygon.
> 

Ok. I am still foxed. The following 

	ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_geom, 2))))

returns with

	ERROR:  function st_interiorringn(geometry) does not exist
	LINE 7:  ST_AsText(ST_MakePolygon(ST_InteriorRingN(ST_GeometryN(the_...
                                  ^
	HINT:  No function matches the given name and argument types. You might 
	need to add explicit type casts.

I am using the latest binary release for Snow Leopard available at kyngchaos.com

Looking at the docs, I see that ST_InteriorRingN() "will not work for MULTIPOLYGONs. Use in conjunction with ST_Dump for MULTIPOLYGONS." Looking at ST_Dump, I am getting a bit lost.

Essentially, I want to unravel a (MULTI)POLYGON. I want all the points of each component polygon for each feature. To do that, I have to get to each individual "ring" (which, by its name, "ring," I take it to mean a polygon, not a linestring, but whatever). So, now it seems I am able to get to the exterior ring via `ST_AsText(ST_MakePolygon(ST_ExteriorRing(ST_GeometryN(the_geom, 1))))` but not the individual interior rings.

Much advance appreciation for any help/guidance.

Puneet.


More information about the postgis-users mailing list