Select to view content in your preferred language

Spatial join in Toolbox: how to define output when no join is possible?

1512
4
10-24-2011 07:05 AM
KerstinKober
Emerging Contributor
Hi all,
I hope this is an easy question for you.

I would like to do a spatial join (in the toolbox, Analysis tools) between two shapefiles:
(1) the target file: a point dataset, of which all fields should be retained
(2) the join feature: a polygon shapefile with various polygons. I want to add to the target shapefile the information for each point into which polygon (identified by the polygon id) of the they occur. If they don't occur in one of the polygons, the code should be some number which cannot be confused with a polygon ID (e.g. 999).

This works well when using the Spatial Join tool (setting it to Join-one-to-one, keep all target features, and choose in "Field map of joining feature" only the column with the polygon ID), however, if points from the target file fall within none of the polygons of the join file, unfortunately the value "0" is joined. As there is also a polygon with the ID "0", this is bad and will lump in supsequent analysis the points from the "0" polygon together will all points not falling into any polygon at all.

Is there a way to let ArcGIS know what code to give to those target features to which no join feature can be  joined to ?

Thank you very much!

Kerstin
Tags (2)
0 Kudos
4 Replies
DanLee
by Esri Regular Contributor
Esri Regular Contributor
I think you are talking about the output of Join-one-to-many, which contains the JOIN_FID field. Yes, we realized this issue and have had a fix in 10.1 so that the unjoined features will get -1 in this field.

You can do this as a workaround:
Select points with Joint_Count of 0 and calculate the JOIN_FID to be 999, as you wished.

Sorry about the inconvenience. Hope that helps.
0 Kudos
RichardFairhurst
MVP Alum
I think you are talking about the output of Join-one-to-many, which contains the JOIN_FID field. Yes, we realized this issue and have had a fix in 10.1 so that the unjoined features will get -1 in this field.

You can do this as a workaround:
Select points with Joint_Count of 0 and calculate the JOIN_FID to be 999, as you wished.

Sorry about the inconvenience. Hope that helps.


Actually, I would calculate it to -1 as the fix at 10.1 does (since you could easily get to a real FID of 999 in your polygons, but not -1).  Also you would need to select the polygon that actually has an ID of 0 and then do a select by location on the Spatial Join points file.  Anything that get selected should be calculated back to 0 (since it actually is a point associated with the Polygon having an FID of 0).
0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor
Good point on the -1 vs 999!

I don't think it is an issue with the JOIN_FID 0, because they won't be selected by Joint_Count = 0. Did I misunderstand you?
0 Kudos
RichardFairhurst
MVP Alum
Good point on the -1 vs 999!

I don't think it is an issue with the JOIN_FID 0, because they won't be selected by Joint_Count = 0. Did I misunderstand you?


I missed that suggestion.  My second step would not be necessary if the Join_Count value is used in the selection.
0 Kudos