Thanks a lot. Didn't know that GetGeometryCount did that on polygons :-)<br><br>Cheers,<br>Simon<br><br><br><div class="gmail_quote">On Tue, Mar 8, 2011 at 11:51 AM, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org">even.rouault@mines-paris.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Selon Mike Toews <<a href="mailto:mwtoews@gmail.com">mwtoews@gmail.com</a>>:<br>
<div class="im"><br>
> On 8 March 2011 23:22, Even Rouault <<a href="mailto:even.rouault@mines-paris.org">even.rouault@mines-paris.org</a>> wrote:<br>
> > Not exactly. In fact you have to use the Geometry.GetGeometryCount() that<br>
> > returns 1 (the exterior ring) + the number of interior rings. So<br>
> > polygon.GetGeometryCount() - 1 should return the number of interior rings<br>
><br>
> I initially thought so too, except that assumption doesn't work for<br>
> MultiPolygon geometry types.<br>
<br>
</div>In that case, you have to first test the geometry type (<br>
geometry.GetGeometryType() )<br>
<br>
If equal to ogr.wkbPolygon, apply the above method.<br>
If equal to ogr.wkbMultiPolygon, iterate over the polygons with<br>
geometry.GetGeometryRef(i) the index varying between 0 and<br>
geometry.GetGeometryCount() (which in that case will be the number of polygons).<br>
For each polygon, apply the above method.<br>
<div><div></div><div class="h5"><br>
><br>
> -Mike<br>
><br>
<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div></div></blockquote></div><br>