I have the following information/layer:

  1. Address points (point layer)
  2. Points which represent the entries to urban green spaces (point layer) - I built these cutting the roads with the borders of a polygon layer for green spaces
  3. Road/path network (network layer)

Now, I want to know for each address point, which is the closest entry to a green space and how far is it. For this distance calculation, I do not want to use the direct beeline, but the shortest path on the road network.

The QGIS main functions allow network analysis "layer to point", "point to layer" and "point to point". There is no layer to layer function. Is there a plugin which fits to my problem?

  • You could group your adress points by their nearest green space (here bee line should do) and then run layer to point for each green space - though that would take some time.
    – Erik
    Jun 1, 2021 at 9:31
  • 1
    Do your points lay on lines i.e. are they snapped? Can you please provide some graphic of your problem?
    – Taras
    Jun 1, 2021 at 12:16
  • Providing your data (or a sample of it) would indeed help testing possible solutions.
    – Babel
    Jun 1, 2021 at 12:45

1 Answer 1


The tool to use

Iso-Area-approach can do both jobs for you, thus for each adress point, using the network:

  • 1: find the closest entry to a park
  • 2: get the distance to the closest park

In QGIS, use the QNEAT3 plugin with the function Iso-Area as Pointcloud (from Layer). It requires two layers as input: Network and Startpoint. It then creates for every vertex of the network layer a point with the following attributes:

  • cost: the distance along the network to the nearest feature of the Startpoint Layer: use the park-layer here
  • origin_point_id: the id of the nearest feature from the Startpoint layer, in our case: the parks

To include the address layer, create additonal vertices from the address-points on the network layer. Then they will be automatically included in the output of the plugin and here we are with the result you're looking for!

The workflow in detail

I suppose the addresses (as well as the parks) are point-layers, snapped to the network. Otherwise, see at the bottom how to do that.

  1. To split up the network-layer at the addresses (create new vertices), create a small line at each point of the address-layer. In fact, create two perpendicular lines to be sure to always get a line-split, even in the highly unlikely case when the street and the created auxiliary lines would perfectly overlap. So create two perpendicular auxiliary lines at each address point using Geometry by expression with this expression:
collect_geometries (
    array_foreach (
        array (0,90),
        extend (
            make_line (
                project (

Screenshot: auxiliary lines (red lines) at each address (red points), used to split up the network (black lines) - here created with geometry generator for visualization purpose:

enter image description here

  1. Convert the lines to single parts using Menu Vector / Geometry tools / Multipart to singleparts.

  2. Use Menu Processing / Toolbox / split with lines, set the network (road layer) as input and the single part layer created in step 2 as split layer. Let's call the resulting layer of this operation road_split.

  3. Now run the Iso-Area as Pointcloud (from Layer), set the layer road_split created as Network layer and the park layer as Startpoint layer and select an unique Point ID field. Choose a Size of Iso-Area (maximum distance from the parks, using the network) and set the Optimization criterion to Shortest Path (distance optimization). You can leave empty the rest of the settings.

  4. In the resulting point-layer, select all points that correspond to a point in the address-layer. Use select by expression with this expression: overlay_nearest( 'buildings', max_distance:=1). The max_distance:=1 is a tolerence setting to find points even if (for rounding error or else) are not 100% exactly in the same place (as is often the case after processing) - adapt the distance (here: 1 [meter]) to your needs.

  5. Use Invert selection (Ctrl+R) to select all points that do not represent a building. Then toggle editing, delete them. You're left with a point layer with the same points as you addresses, but with additional values for distance to next park (cost) and id of the nearest park (origin_point_id).

Screenshot: Green dots: parks; black lines: network (roads); red points: addresses = the layer resulting in step 6. It is labeled with the cost attribute created in step 4, indicating the distance in meters, using the network, form each address to the nearest park:

enter image description here

Snapping points to the network

If your points (addresses, parks) are not yet snapped to the lines of the network layer called road, create a new point layer for each with this expression and then use these new layers for the steps described above. This works regardless of whether your addresses and parks layers are points, lines or polygons:

    collect_geometries ( 
  • 1
    Note that the above snapping of a point to the network makes lots of assumptions about the road network - which - depending upon your problem context, can be problematic eg: One way roads, pedestrian only footpaths, bridges, footbridges etc. The closest road might not be the real road that the user would use in real life.
    – nr_aus
    Aug 16, 2021 at 8:12
  • Indeed! The scope of this answer was just to provide a working solution for the main problem, based on the limited information the OP provided. Of course, every implementation has to consider additional details. The points you mention must be addressed/included in the network data. However, this was not part of the question and is assumed to be pre-existing in usable form. Also the problem of finding the shortest distance from an address to a park let me suppose we indeed deal with pedestrians here - but I might be wrong.
    – Babel
    Aug 16, 2021 at 8:21
  • Actually I thought the same thing - is this pedestrians/car travel? The OP does mention Road/Path network, so I assumed Pedestrians as well, however this even further complicates the road network situation as to which roads are walkable. ugh nightmares .......The process of 100% correctly establishing connectivity of house-road (or point to network at a high level) as part of spatial analysis is a difficult one.
    – nr_aus
    Aug 16, 2021 at 23:59

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.