AnsweredAssumed Answered

Arcpy: Spatial Join crashes ArcGIS

Question asked by Geolaird on Dec 2, 2014
Latest reply on Jul 19, 2017 by CMosnick-esristaff

Hello everyone, I'm having some problems with an Arcpy script that I've attached below.

 

It should be a simple script, it was converted from ModelBuilder so it mostly just a series of tools, although the script iterates between each feature (features = arcpy.GetParameterAsText(1)) and runs a different set of tools. The goal is to intersect all input features (mulitvalue in the toolbox settings) convert lines and polygons into points, merge all points than get a sum of how many points are in each "TWP" Polygon.

 

The entire script functions fine except the Spatial Join, which I commented out at one point to check the later tools. I've run the Spatial Join with the same data in both ModelBuilder and ArcMap, both are done within seconds. In Arcpy, the script will run until ArcMap crashes, closing on its own. If the Spatial Join is commented out the script will run to completion.

 

You can find the Spatial Join in line 127, and just above that you can see I have tried repairing the geometry, converting to feature layers, and adding spatial indices to both inputs.

 

Please let me know if you have any other ideas, it would be a huge help, thanks.

 

 

Ryan

Outcomes