[gdal-dev] OGR Geometry methods
Marius Jigmond
mariusjigmond at hotmail.com
Mon Jul 11 21:46:22 EDT 2011
I suppose a piece of code speaks louder :):
xsect = False
for i in range(gridLayer.GetFeatureCount()):
feat = gridLayer.GetFeature(i)
geom = feat.GetGeometryRef()
point = geom.Centroid()
for j in range(aqLayer.GetFeatureCount()):
aqfeat = aqLayer.GetFeature(j)
aqgeom = aqfeat.GetGeometryRef()
if point.Intersect(aqgeom):
xsect = True
print 'ibound = 1'
break
if xsect:
feat.SetField('IBOUND', 1)
gridLayer.SetFeature(feat)
xsect = False
-marius
On Mon, 2011-07-11 at 20:34 -0500, Marius Jigmond wrote:
> Hi everyone,
>
> I am trying to test whether centroids of polygons lie/intersect within
> another polygon. I have tried Intersect, Within, and Contains but they
> always return false. Should these methods work for my intended purpose
> or do I need to implement a point in polygon function? Thanks.
>
> -marius
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110711/e80a6117/attachment.html
More information about the gdal-dev
mailing list