[postgis-users] exterior rings in multipolygons

Sandro Santilli strk at keybit.net
Tue Jul 26 14:15:54 PDT 2011


On Tue, Jul 26, 2011 at 03:16:09PM -0500, Mr. Puneet Kishor wrote:

> So, as advised, I got a real pencil and paper, drew out all my options, scanned them in, and discovered that I had a poor understanding on the relationship of MULTIPOLYGONs and GEOMETRIES. Turns out, my MULTIPOLYGON has 1 GEOMETRY, 4 rings, one being exterior and three interior rings. Hence, an expression like the following works well
> 
> 	ST_NumPoints(ST_InteriorRingN(ST_GeometryN(the_geom, 1), 2))

Good job !

> Now, here is where it gets interesting. My test feature in reality is a lot more complicated, as can be seen in the attached image (see the blue bordered multipoly). I took the shapefile and shp2pgsql-ed it, and now I get only 4 rings in my query. My guess is that these four rings are the ones on the top of the image. So, I thought maybe I have another GEOMETRY that I am missing out on. But, no... ST_NumGeometries(the_geom) = 1.
> 
> Can anyone theorize what happened to the rest of the feature? How did it get lost in translation? Was it simply ignored, or was it made into a different feature? Or, is it there, but I still haven't understood the MULTIPOLYGON/GEOMETRY/POLYGON/LINERSTRING nexus really well.

Could be a bug in shp2pgsql ... did it tell you anything interesting
at load time ? Do you have the shapefile published somewhere to look at ?

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-users mailing list