Spatial join polygon-to-polygon using "closest" as join field

1896
4
05-30-2012 06:38 AM
AnneRiddle
New Contributor
Hi all,

Just a quick question about how using a spatial join with "closest" as the match option works. I'm trying to spatially join a shapefile of world ecoregions with a shapefile of world country boundaries to get a country code for each ecoregion. Since ecoregions pass over country boundaries, I'd like to select the country code where most of the ecoregion falls, and I'm trying to figure out if "closest" is the best option for this; however the technical info on how "closest" works for polygon-to-polygon matches isn't very detailed. Can anyone give me more info on how this option works (i.e. does it use centroids or boundaries as the point of measurement, etc).

anne
0 Kudos
4 Replies
MathewCoyle
Frequent Contributor
HAVE_THEIR_CENTER_IN would be my best guess for that operation if you want to keep it simple. Or a more in depth operation utilizing scripting. Not sure exactly how closest would work in your case.
0 Kudos
AnneRiddle
New Contributor
I've tried this, but it creates mostly null values. I'm looking into the error but was wondering if any of the other tools are comparable.
0 Kudos
JoelCalhoun
New Contributor III
I've tried this, but it creates mostly null values. I'm looking into the error but was wondering if any of the other tools are comparable.



Just out of curiosity have you applied the most recent patch?
There was a bug with the Spatial Join Tool introduced at Service Pack 4.
The most recent patch might fix your issue.

Link to patch: http://resources.arcgis.com/content/patches-and-service-packs?fa=viewPatch&PID=160&MetaID=1857



Joel
0 Kudos
NobbirAhmed
Esri Regular Contributor
Just a quick question about how using a spatial join with "closest" as the match option works.

'Closest' finds the nearest feature - it always returns only 1 feature. If more than one feature intersect a target feature then all have a distance of zero (thus nearest) to the target - in that case, one of them is selected randomly.

Since ecoregions pass over country boundaries, I'd like to select the country code where most of the ecoregion falls

In your case, 'closest' is not the option. I guess 'Intersect' will be the best option.
0 Kudos