Using QGIS and the Multi-distance buffer plugin, your buffer zones around the locations of traffic intersections would be non-overlapping, and each zone would be identified in the attribute distance by the distance to the outer border of the zone.
That means that you can do a simple spatial join or point-polygon overlay to get the buffer zone added to your "location of road accidents" dataset.
Spatial join:
Vector-> Data management tools-> Join attributes by location
Use your "accidents" point dataset as target and your buffer dataset as join. Take attribute of first located feature. For Output table choose the option that suits you.
Overlay:
Vector-> Geoprocessing tools-> Intersect
Vector-> Geoprocessing tools-> Union
Use the "accidents" point dataset as input and the buffer dataset as intersect / union layer.
If you want to select points within the 50m buffer while excluding those that fall outside it and within the 25m buffer, you would select the features with a value of 50 for the distance attribute in the resulting dataset.
Script below designed to run from mxd. It assumes that you have empty a table (“nearLines”) to populate in mxd:
Where pointID and lineID are fields to store OIDs of input layers (type long), Distance field type double.
import arcpy
# parameters to re-type
maxDistance=100
mxd = arcpy.mapping.MapDocument("CURRENT")
# get lines
lines = arcpy.mapping.ListLayers(mxd,"lines")[0]
d=arcpy.Describe(lines)
fidLine = d.OIDFieldName
# get points
points = arcpy.mapping.ListLayers(mxd,"points")[0]
d=arcpy.Describe(points)
fidPoint = d.OIDFieldName
table = arcpy.mapping.ListTableViews(mxd,"nearLines")[0]
# process
curT=arcpy.da.InsertCursor(table,("POINTID","LINEID","DISTANCE"))
nodesDict={}
with arcpy.da.SearchCursor(points,(fidPoint,"Shape@")) as cursor:
for fid,shp in cursor:nodesDict[fid]=shp.firstPoint
with arcpy.da.SearchCursor(lines,(fidLine,"Shape@")) as cursor:
for fid,shp in cursor:
for key, point in nodesDict.iteritems():
dist=shp.distanceTo(point)
if dist > maxDistance:continue
curT.insertRow((key,fid,dist))
I hope there are enough comments in script to understand it’s logic...
It took 1 min 8 seconds to process 1000 points and 1200 lines on my rather solid machine.
I summarised nearLines table, points below coloured by count of lines within 100 m:
Learn Python and you’ll be able to work around licensing limitations, e.g. this and sometimes absence of extension.
Best Answer
I strongly suggest the method mentioned by yourself and @user3338197 as it's probably the simplest.
Another method to calculate the distance from a point to its nearest line involves first having to convert your line layer to points using Convert lines to points from SAGA (in the Processing Toolbox). Select Yes for the Insert Additional Points option and use a very low value for the Insert Distance (such as 0.01, note that this is measured in metres). This adds a point every 0.01 m so the lower this value is, the more accurate you will be when finding the nearest distance.
Now you can use the Distance to nearest hub tool which calculates the distance (in metres, feet, layer units etc.) from a source to the destination layer.
You will have the option of exporting another point shapefile which will have an attribute containing the distances of each point to its nearest line:
You can then use the Field Calculator or Select by expression tool to only show/select points within x metres:
Hope this helps!