Spatial Join - Count of Points within a distance of a Line

1727
3
03-14-2018 07:53 AM
ChrisWalker4
New Contributor III

Hi All

I am trying count the number of points within a distance of 1.5m of a line.

I have the count part down no problem.. Spatial join --> One to One --> Intersect --> Search Radius of 1.5m

This gives me the a field with the Count of points within 1.5m of each line

Only problem is I have lines that intersect, and if there is a point near this intersection and within 1.5m of both lines the one point will be added as a count to BOTH lines.  I know why this happens, but my question is how would you all go about fixing it?  For my purposes, the points can only be counted once, and that would be to the closest line..

Is there a way to set the join so that the points are only counted once?

Tags (1)
0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

from the help topic (PRO shown, but it is the same for arcmap) http://pro.arcgis.com/en/pro-app/tool-reference/analysis/spatial-join.htm

Generate Near table is suggested for the closest and I suspect that is your workaround for 'within a distance of'

When the Match Option is set to Closest or Closest geodesic, it is possible that two or more join features are at the same distance from the target feature. When this situation occurs, one of the join features is randomly selected as the matching feature (the join feature's FID does not influence this random selection). If you want to find the 2nd, 3rd, or Nth closest feature, use the Generate Near Table tool.

A horrid workaround would be to buffer with square ends then intersect those.

ChrisWalker4
New Contributor III

Thanks Dan!

So your ideas got me thinking and I decided to enlist the use of Excel.

I first did a spatial join on the Points (one to one, Closest), giving each the uniqueID from the line that it is closest too and avoiding any duplication.  I then exported that data to excel and created a pivot table which allowed me sort the data as I needed.  With the UniqueID still in tact but now as a single row due to the pivot table,  I joined the table back to my original Line GIS Data and voila, I had everything I needed.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Glad it worked out Chris

0 Kudos