<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
I suppose a piece of code speaks louder :):<BR>
<BR>
xsect = False<BR>
for i in range(gridLayer.GetFeatureCount()):<BR>
&nbsp; feat = gridLayer.GetFeature(i)<BR>
&nbsp; geom = feat.GetGeometryRef()<BR>
&nbsp; point = geom.Centroid()<BR>
&nbsp; for j in range(aqLayer.GetFeatureCount()):<BR>
&nbsp;&nbsp;&nbsp; aqfeat = aqLayer.GetFeature(j)<BR>
&nbsp;&nbsp;&nbsp; aqgeom = aqfeat.GetGeometryRef()<BR>
&nbsp;&nbsp;&nbsp; if point.Intersect(aqgeom):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xsect = True<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'ibound = 1'<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break<BR>
&nbsp; if xsect:<BR>
&nbsp;&nbsp;&nbsp; feat.SetField('IBOUND', 1)<BR>
&nbsp;&nbsp;&nbsp; gridLayer.SetFeature(feat)<BR>
&nbsp;&nbsp;&nbsp; xsect = False<BR>
<BR>
-marius<BR>
<BR>
On Mon, 2011-07-11 at 20:34 -0500, Marius Jigmond wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
    Hi everyone,<BR>
    <BR>
    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.<BR>
    <BR>
    -marius 
<PRE>
_______________________________________________
gdal-dev mailing list
<A HREF="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</A>
<A HREF="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</A>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>