I have a multipoint feature class and a polyline feature class (transects) filled with the same number of objects. Basically, each set of points corresponds to a single transect.
I want to run the intersect analysis tool for each individual set of rows, so each transect and set of points should have an output. The output would be a set points that is "snapped" to the transect polyline. Then at the end of the code, I have as many intersect outputs as I do transects.
How can I get two search cursors to run simultaneously? I need a search cursor that can take one row from each file, run the intersect tool, and then move to the next set of rows.
A nested loop does not work (unsurprisingly). Is there a workaround for this?
EDIT: I don't want to compare two datasets, I actually want to analyze corresponding features of both. The formatting here didn't copy well... apologies.
# Import system modules import arcpy import numpy as np import sys, os, string, arcgisscripting arcpy.env.overwriteOutput=True #Define local variables workspace= transect= point_file= output_file="clusters.shp" sr=arcpy.Describe(point_file).spatialReference arcpy.env.overwriteOutput=True gp=arcgisscripting.create() output_fc=gp.CreateFeatureClass_management(workspace,output_file, "MULTIPOINT", "#", "DISABLED", "ENABLED",sr) #Perform fits and intersections with arcpy.da.SearchCursor(transect,["SHAPE@"]) as cursor1: for row in cursor1: profile=row with arcpy.da.SearchCursor(point_file,["SHAPE@"]) as cursor2: for row in cursor2: point=row #Create Swath Profile clusterTolerance=0.5 swath_points=arcpy.Intersect_analysis([point,profile],output_fc,"",clusterTolerance,"point")