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
wrote:
> Selon Mike Toews :
>
> > On 8 March 2011 23:22, Even Rouault
> wrote:
> > > Not exactly. In fact you have to use the Geometry.GetGeometryCount()
> that
Selon Mike Toews :
> On 8 March 2011 23:22, Even Rouault 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 in
On 8 March 2011 23:22, Even Rouault 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
Selon Chaitanya kumar CH :
> 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 num
You could use the `interiors` length in Shapely:
from osgeo import ogr
from shapely.wkb import loads
source = ogr.Open('my_polygons.shp')
layer = source.GetLayer()
feature = layer.GetNextFeature()
num = 0
while feature:
g = loads(feature.GetGeometryRef().ExportToWkb())
if g.geom_type == 'P
I'm sorry. I now see that this method is not exposed in the python bindings.
On Tue, Mar 8, 2011 at 2:59 PM, Chaitanya kumar CH
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, S
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
wrote:
> Hi List,
>
> I am using ogr via the python bindings to construct various polygons.
> Here's just a simple quest
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
st