Spatial join tool vs. right-click spatial join producing different results?

1638
12
03-29-2012 10:11 AM
deleted-user-dp61qRbKUaMp
New Contributor II
Apologies in advance for the simple question...

I have a point feature class and a polygon feature class.
For each point, I'd like to simply a field based on the polygon that contains them.  This should just be a simple spatial join, no?

When I do the join by right-clicking on the point layer etc etc it seems to work ok.
However, when I do the join via the Spatial Join tool, something strange happens.  Each polygon appears to only be joined to one point.  That is, the fields of the polygon appear null.  Yet, the JOIN_FID field suggest the point was joined to a polygon.  The highlighted feature in the attached image shows this.

[ATTACH=CONFIG]13113[/ATTACH]

I don't suppose anyone can explain what I'm doing wrong?

I need to perform this with Python code, so that's why I was hoping to do the join via the toolbox.  If anyone knows how to access the "right-click join" via Python, that could also solve my problem.  Regardless, it would still be nice to understand what's going on here.

Thanks!
0 Kudos
12 Replies
deleted-user-dp61qRbKUaMp
New Contributor II
Just to update this thread, a colleague did the same operation and it worked for him.  He is using Arc 10, build 3200 (SP2).  I am using Arc 10, build 4000 (SP4).  It seems like one of ESRI's service packs introduced a bug, so I'll see if I can figure out how to report it (assuming it hasn't been reported already).
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
I am not sure what you meant by "the right-click Spatial Join". I only know the right-click on a layer to add/remove Join, but that is not spatial join.

Would you be able to share the sample data as shown in the image? We can take a look. Please describe details - what parameters or options you specified for the process. Thanks.
0 Kudos
deleted-user-dp61qRbKUaMp
New Contributor II
Thanks Dan.
Sorry, I wasn't sure what to call the "right-click" join.  That's the one.  Right-click on the point layer, and select "Join data from another layer based on spatial location".  It's a join that is geospatial, so I wasn't sure what to call it.  Apologies for the confusion.

I'll provide test files, but it seems very easy to replicate.  Just draw some polygons and draw some points.  Where you have multiple points within any given polygon, it appears they don't properly join as I described.  I'll also attached a screen capture of my settings.

[ATTACH=CONFIG]13140[/ATTACH]

As mentioned, I'm using build 4000.  It appears to work fine on build 3200.

Is that enough detail?

Also, I noticed that I'm not the first to see this problem....
http://forums.arcgis.com/threads/53649-SpatialJoin-and-SP4?p=185665&posted=1#post185665

cheers
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
I have confirmed that we introduced a bug in 10 Sp4. Really sorry about that! The problem will be fixed in 10 SP5.

Just FYI (according to my colleague):
The tool works fine if all input points find spatialy related polygons (i.e. Join_Count > 0). The problem happens when a point is encountered without any related (e.g., INTERSECT) join features, all subsequenct records in the output gets null values from the join features. One workaround (if you want to continue using Spatial Join) would be to uncheck 'Keep All Target Features' parameter on tool dialog or use 'KEEP_COMMON' option in script.

I will post this information at the other link you mentioned. Thanks for bringing this up.
0 Kudos
deleted-user-dp61qRbKUaMp
New Contributor II
Ok, thanks for the update and information Dan.  I don't envy your developers.  I can only imagine how complicated Arc's code has become over the years!
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
I really appreciate your comment. The world is a better place becasue we try to understand and help each other.  🙂
0 Kudos
EricPedrotty1
New Contributor
Just for clarification:

This issue is greatly affecting our monthly business processes.  It appears that any time any field in a Spatial Join results in a NULL, all fields of all subsequent rows return NULL as well, i.e. if my feature class has 10 fields and 100 rows and the 4th field of the 25th row results in a NULL, then fields 5 thru 10 of the 25th row are also NULL (whether or not they should be) as well as all fields of all rows 26 thru 100.

Since I expect some NULLs in my geo-data, I am unchecking Keep All Target Features then outputting the resulting feature classes as text files then importing them into MSAccess and outer-joining them together to generate the appropriate NULL values.

I do not see the Spatial Join issue in the list of fixes for SP5 which is not expected out until July 2012.

Is this bug on the list and is July still the expected release date for Service Pack 5?

Thanks in advance
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
There have been multiple posts regarding this tool in 10 SP4. The latest information is in the following thread:
http://forums.arcgis.com/threads/54466-ArcGIS-10-SP4-Spatial-Join-Bug?p=188537#post188537

In short, we are working hard to make a special patch for 10 SP4; hope it will be available soon. We thank you for reporting the problems and for your patience.
0 Kudos
DanMcCoy
Occasional Contributor III
There's a new KB article about this bug...

Bug:  The Spatial Join tool produces NULL results for some fields/features on ArcGIS 10 SP4
http://support.esri.com/en/knowledgebase/techarticles/detail/40174
0 Kudos