I am working on a near analysis that determines the closest distance from a polygon layer to one of three other vector layers. The polygon layer relates to the three other layers using EO ID. When I determine the closest distance, I want to only be looking at records with the same EO ID. Here is the Python code that I came up with:
# Copy the input feature class so the near fields can be added arcpy.FeatureClassToFeatureClass_conversion(in_fc, out_path, out_name, subset_query) out_fc = os.path.join(out_path, out_name) # Create search cursor to loop though records in the output feature class srows = arcpy.da.SearchCursor(out_fc, ["EO_ID"]) for srow in srows: # Convert eoid to an integer eoid = int(srow[0]) # Create EO ID queries eoid_query = "{0} = {1}".format(eoid_field, eoid) sf_eoid_query = "EO_ID = {}".format(eoid) # Make feature layers using eoid queries arcpy.MakeFeatureLayer_management(out_fc, "out_lyr", eoid_query) arcpy.MakeFeatureLayer_management(src_1, "src1_lyr", sf_eoid_query) arcpy.MakeFeatureLayer_management(src_2, "src2_lyr", sf_eoid_query) arcpy.MakeFeatureLayer_management(src_3, "src3_lyr", sf_eoid_query) # Run near analysis arcpy.Near_analysis("out_lyr", ["src1_lyr","src2_lyr","src3_lyr"])
When I run this code I get a PyScripter application error:
Access violation at address 56D0E49C in module 'FileGDB.dll'. Write of address B2689930.
When I run the script in IDLE I get "pythonw.exe has stopped working"
Thanks so much for your help.
ArcGIS 10.2
Python 2.7
PyScripter 2.5.3x86 32 bit
Windows 7 64 bit