I am trying to calculate the top three shortest distances from a point file (buildings) to a polygon file (designated natural areas) via road networks. I basically need the "Join attribute by nearest" tool but using road distance instead of straight line distance.

The closest I have gotten is using the ORS Tools Plugin "Matrix from layers" tool, but its not quite right since I have to use a point centroid of the polygons. I also have hundreds of points that the calculation needs to be run on, but I only need the three closet polygons to each point.

Any suggestions on what to try?

  • Dear @keenwild, i deleted a part where you mentioned ArcGIS 'I also have access to ArcGIS Pro', so you can get better chances with your question, otherwise it could be closed as too broad. If you still willing to use ArcGIS, and do not know how to tackle your problem, please ask a new question with including the arcgis as a tag.
    – Taras
    Jun 18 at 5:25
  • 1
    Maybe this can help? gis.stackexchange.com/a/398299/88814
    – Babel
    Jun 18 at 6:05

Try using GRASS algorithms like:

With the first one you can figure out the closest polygons to a point and with the second one you can find out the shortest route along a line layer from point A to point B.


Solution with QGIS:

You can use the Qneat3 plugin or native network analysis of QGIS 3 for this purpose. The requirement is that you need to have a road network in order to be able to calculate the distances.

First convert the polygons to centroids or the points that represent the origin and destination. Then use those layers and one of the aforementioned plugins to calculate the distance. If you do not need the shape of the road, then use OD matrix. Otherwise, there are no fast solutions in QGIS.¨

Solution in python:

Use OSMNX library to calculate the distances between points: https://geoffboeing.com/2016/11/osmnx-python-street-networks/

ArcGIS Solution:

you need to use the closest facility analysis of network analysis extension (If you have access to it). Convert the polygon to points, then load them as facilities in the network analysis tool. Load buildings as incidents and then run the analysis. This can provide you with either shape of the paths or just the distances in values.

P.S: I personally suggest Python as it is much faster and you have more control over it, but it is more complex. QGIS is free and fast but may not offer many options. ArcGIS is a bit slower compared to others, but Interface is easy to work with and offers many options, such as finding several facilities etc.

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