Thanks a lot. Didn't know that GetGeometryCount did that on polygons :-)

Cheers,
Simon


On Tue, Mar 8, 2011 at 11:51 AM, Even Rouault
<[email protected]>wrote:

> Selon Mike Toews <[email protected]>:
>
> > On 8 March 2011 23:22, Even Rouault <[email protected]>
> wrote:
> > > Not exactly. In fact you have to use the Geometry.GetGeometryCount()
> that
> > > returns 1 (the exterior ring) + the number of interior rings. So
> > > polygon.GetGeometryCount() - 1 should return the number of interior
> rings
> >
> > I initially thought so too, except that assumption doesn't work for
> > MultiPolygon geometry types.
>
> In that case, you have to first test the geometry type (
> geometry.GetGeometryType() )
>
> If equal to ogr.wkbPolygon, apply the above method.
> If equal to ogr.wkbMultiPolygon, iterate over the polygons with
> geometry.GetGeometryRef(i) the index varying between 0 and
> geometry.GetGeometryCount() (which in that case will be the number of
> polygons).
> For each polygon, apply the above method.
>
> >
> > -Mike
> >
>
>
> _______________________________________________
> gdal-dev mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to