Not sure if this is what you're afterOuter loop though feature class to extract an attribute from specified fieldUse value to construct 'where' clauseInner loop selects features(s) in second feature classSelection syntax is assuming a string field in a shapefile and I'm using ArcGIS 9.2import arcgisscripting
gp = arcgisscripting.create()
gp.OverwriteOutput = 1
fcPoly = "C:/test_polygons.shp"
fcPoint = "C:/test_points.shp"
myField = "TEST_FIELD"
gp.MakeFeatureLayer(fcPoint,"fcPoint_lyr")
outers = gp.SearchCursor(fcPoly)
outer = outers.Next()
# Print road name and road type
while outer:
myVal = outer.GetValue(myField)
strWhere = '"' + myField + '"' + " = '" + myVal + "'"
gp.SelectLayerbyAttribute_management("fcPoint_lyr", "NEW_SELECTION", strWhere)
inners = gp.SearchCursor("fcPoint_lyr")
inner = inners.Next()
while inner:
# do stuff here with the selected rows
inner = inners.Next()
outer = outers.Next()
print "done looping"