I'm really interested if anyone has done this successfully.
In Python 2.5, I need to iterate through a point feature layer (searchcursor) and select the underlying record in a polygon feature layer. This just isn't working for me. From what I've come across online, "<cursor>.shape" should be used as the select layer parameter. There could be multiple points in one polygon, so I need to identify and create a polygon for each point.
It seems straightforward, but I'm not getting any selection. If I print the value of the cursor.shape, this is what I get:
<geoprocessing describe geometry object object at 0x009DA5D8>
Heres a sample of the code:
while pointCurRow:
print pointCurRow.X_COORD
print pointCurRow.shape
print
rows = gp.selectLayerByLocation(polyFeatLayer, "INTERSECT", pointCurRow.shape)
row = rows.Next()
print "row count = " + str(row.GetCount)
The error that results is:
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py" , line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\ArcGIS\Python Scripts\test_program.py", line 61, in <module>
row = rows.Next()
AttributeError: 'str' object has no attribute 'Next'
Thanks in advance for any help.