import 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"
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.