Select to view content in your preferred language

# Distance in Spatial Join

2146
3
05-21-2014 01:31 AM
New Contributor
Hi there,
I am trying to create a distance matrix between a number of polygons and a number of points that are within a certain distance from the polygons. I managed to get exactly what I needed by using the ArcToolbox function "spatial join" (in Analysis Tools / Overlay) EXCEPT for one important detail: the distance can only be added to the result when the match option "CLOSEST" is selected. If I choose the match option "INTERSECT" (which I have to do in order to get the result needed) the distance field name is greyed out and the distance is not added to the resulting layer.
Does anyone have an idea how to get the distance between the polygons and the respective points?
So far, the attribute table of the resulting layer looks like this:
id polygon 1 - id point a
id polygon 1 - id point b
id polygon 1 - id point c
id polygon 2 - id point b
id polygon 2 - id point d
...and so on. It is important that double values are allowed. What I would need now is the distance in meters...
Any help is appreciated!
Thanks
Claas, Hamburg, Germany
Tags (3)
3 Replies
MVP Honored Contributor
Hi there,
I am trying to create a distance matrix between a number of polygons and a number of points that are within a certain distance from the polygons. I managed to get exactly what I needed by using the ArcToolbox function "spatial join" (in Analysis Tools / Overlay) EXCEPT for one important detail: the distance can only be added to the result when the match option "CLOSEST" is selected. If I choose the match option "INTERSECT" (which I have to do in order to get the result needed) the distance field name is greyed out and the distance is not added to the resulting layer.
Does anyone have an idea how to get the distance between the polygons and the respective points?
So far, the attribute table of the resulting layer looks like this:
id polygon 1 - id point a
id polygon 1 - id point b
id polygon 1 - id point c
id polygon 2 - id point b
id polygon 2 - id point d
...and so on. It is important that double values are allowed. What I would need now is the distance in meters...
Any help is appreciated!
Thanks
Claas, Hamburg, Germany

If you have an Advanced License use the Generate Near Table tool in addition.  Then calculate a concatenation of the two ID numbers in a text field within delimiters like curly brackets or with a separator character like a comma in both the Spatial Join output and the Generate Neat Table output and join on that value.  An example join value would be "{1}{1}" or "1,1" for the first polygon and first point in each feature class if they were within the near distance.  Parenthesis do not work as delimiters for a text join value, because the join fails for most databases, so do not use them.  Be sure to index the join fields in both the polygons and the table to dramatically improve performance.  Then you can calculate over the distance values or export the joined features to create a combined attribute table for your polygon features.
New Contributor
Hi rfairhur24,
thanks so much for your answer. Unfortunately I am only using a basic license. So I guess that won't work.
Thank you kindly anyway for your effort!
MVP Honored Contributor
Perhaps one of the tools provided in ET Geo Tools or ET Geo Wizards would do what you need.  It may require the paid version, but it is much cheaper than an Advanced License.