Arcpy: Spatial Join crashes ArcGIS

5267
12
Jump to solution
12-02-2014 02:56 PM
RyanLaird
New Contributor III

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
1 Solution

Accepted Solutions
DenisSavItskiy
New Contributor II

Found a nasty solution. I exclude all parameters from arcpy.SpatialJoin_analysis after join_type and tool finished successfully. Probably something wrong with field_mapping object, but this is still bad manner to silently close all application if I use wrong parameter, IMHO

P.S. Problem with Spatial Join exist on both of 10.2.2 and 10.3 versions

View solution in original post

0 Kudos
12 Replies
DenisSavItskiy
New Contributor II

I have the same problem with arcpy.SpatialJoin_analysis

ArcCatalog and ArcMap Windows closed when script try to call this method

Still didn't find any solution

0 Kudos
DenisSavItskiy
New Contributor II

Found a nasty solution. I exclude all parameters from arcpy.SpatialJoin_analysis after join_type and tool finished successfully. Probably something wrong with field_mapping object, but this is still bad manner to silently close all application if I use wrong parameter, IMHO

P.S. Problem with Spatial Join exist on both of 10.2.2 and 10.3 versions

0 Kudos
NobbirAhmed
Esri Regular Contributor

Hi Denis, is it possible for you to send me the steps and data to reproduce the issue?

0 Kudos
DenisSavItskiy
New Contributor II

Hi!

It's not easy to me due to complexity of scripts library on customes site.

I will try to reproduce problem on less complicated data.

0 Kudos
SepheFox
Frequent Contributor

I have no idea if it's related, but I have had sudden and unexplained crashes when there are geometry problems with my features. Ty running a repair geometry on your input features first.

0 Kudos
NobbirAhmed
Esri Regular Contributor

Hi Ryan, could you please let us know which version of ArcGIS you are using? Also, if possible, please share your model as well or post a screenshot of your Model workflow.

0 Kudos
AlexRebelo
New Contributor

I am also having a similar problem using model builder.

Spatial join crashes Arcgis when I'm using a large dataset, but other times it runs smoothly?

It's very frustrating.

0 Kudos
NobbirAhmed
Esri Regular Contributor

Please mention ArcGIS version. I need to reproduce the issue as I cannot repro on my machine with ArcGIS 10.3.1

Please provide a screenshot (or description) of the Model along with the dataset type (polygon, polyline, point etc) along with their size (number of features) of target and join data.

Otherwise, it would be difficult and time-consuming to reproduce the issue.

0 Kudos
AlexRebelo
New Contributor

Hi Nobbir,

I am using 10.3.1.

I managed to get it working, I think there were some bad input data that I corrected (non-numerical). Perhaps this is why large data-sets have this problem.

Cheers

0 Kudos