The addresses of the road accidents were known and I did geocoding in order to find their position. But their position are not snapped on the road. I managed to snap them to road segments by following Snapping points to lines in ArcGIS Desktop and automate using VBA? . Now, I want the segments to obtain a new field which counts the number of accidents which occured on them. I want sth like the tool "points in polygon". I have heard that linear referencing is helpful but I haven't found something for me.


Since your accidents are snapped to your lines, if your lines are already segmented the way you want and you don't mind the accidents being counted on two or more segments when they fall exactly on an intersection you can use Spatial Join with the One To One option with your lines as the target and the points as the join features. This will create a new line feature class with the point counts that you can use to replace your original lines or join to them to transfer the count.

If you need to control the accidents so that they only associate to one primary road at the intersection, then you could do this in a few steps with the first Spatial Join being a One-to-Many join where the points are the target and the lines are the join features. Then you would select the points that connected to the correct route of the primary street and perform a summary statistics only on that set of points, using the joinFID of the road segment as the case field to get a count of the points by line. Then join the summary table to the roads and calculate your count into them

I personally use Linear Referencing for the whole process of geocoding (based on cross street and offset descriptions, not address locations), segmenting my road network (into all manner of event line segments without disturbing my underlying line network), counting, etc., and recommend it as the better approach. Locate Features along Routes replaces the Spatial Join steps and can do the snapping. As an ongoing management of road systems, in my view LR is the better tool for integrating all of the event data onto a single common road reference so that all correlations can be explored.

However, since setting up LR would take you back to the beginning, and you are very near the end, the approach I have given should work to get a count field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.