[gdal-dev] Polygon topology

Even Rouault even.rouault at mines-paris.org
Tue Mar 8 05:22:19 EST 2011


Selon Chaitanya kumar CH <chaitanya.ch at gmail.com>:

> I'm sorry. I now see that this method is not exposed in the python bindings.

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

See http://gdal.org/ogr/ogr__api_8h.html#1fa07ddf969f97f6444de6ae5128d842

>
> On Tue, Mar 8, 2011 at 2:59 PM, Chaitanya kumar CH
> <chaitanya.ch at gmail.com>wrote:
>
> > Simon,
> >
> > You can use the OGRPolygon::getNumInteriorRings() method to get the number
> > of holes in an OGR polygon object.
> >
> > On Tue, Mar 8, 2011 at 2:27 PM, Simon Lyngby Kokkendorff <silyko at gmail.com
> > > wrote:
> >
> >> Hi List,
> >>
> >>   I am using ogr via the python bindings to construct various polygons.
> >> Here's just a simple question, to which someone might have some input. Is
> >> there anyway to determine the topology, i.e. the number of holes, of a
> >> polygon without e.g. having to export to WKT and examining the output
> >> string. There doesn't seem to be any methods exposed in the bindings to do
> >> this directly?
> >>
> >>   Cheers,
> >>   Simon Kokkendorff,
> >>   National Survey and Cadastre of Denmark
> >>
> >>
> >> _______________________________________________
> >> gdal-dev mailing list
> >> gdal-dev at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >>
> >
> >
> >
> > --
> > Best regards,
> > Chaitanya kumar CH.
> > /tʃaɪθənjə/ /kʊmɑr/
> > +91-9494447584
> > 17.2416N 80.1426E
> >
>
>
>
> --
> Best regards,
> Chaitanya kumar CH.
> /tʃaɪθənjə/ /kʊmɑr/
> +91-9494447584
> 17.2416N 80.1426E
>




More information about the gdal-dev mailing list