Select to view content in your preferred language

Arcpy: Spatial Join crashes ArcGIS

6549
12
Jump to solution
12-02-2014 02:56 PM
RyanLaird
Deactivated User

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

0 Kudos
12 Replies
ChristinaMosnick
Occasional Contributor

Spatial join was crashing for me as well, even after trying Denis SavItskiy's suggestion.  It was possible for me to use the Intersect Tool instead, since I was trying to do a simple spatial join with match_option='INTERSECT'. Maybe see if there is another tool that does the same job for you.

0 Kudos
NobbirAhmed
Esri Alum

Hi Christina, could you please let me know which version of ArcGIS you are using? The original question was on 10.3.1.

0 Kudos
ChristinaMosnick
Occasional Contributor

I am also on 10.3.1

0 Kudos