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.
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.
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).
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.
As mentioned, I'm using build 4000. It appears to work fine on build 3200.
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.
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?