MultiPolygonZ to nearest line using a road network (or: how far is the next highway from a project site?)

I have a MultiPolygonZ layer of Project Sites (ca. 700 features, mostly 1 polygon per feature) and want to get the shortest distance on a road network to the nearest subset of a line layer, e.g. the next highway, by driving on the whole line layer. Lets say, I want to do it with multiple subsets (e.g. highways or trunk roads).

I would take the road network from OSM.

This seems to be a combination of distance matrix and networks as far as i understand:

• Distance matrix because for every location, there will be many lines which can be the nearest subset of roads (e.g. highways). Our destination can be any of them.
• Networks because well, we will use a road network to get to it.

It is possible to use "shortest path point to point" if you convert both the origin to points, and the destinations to points. Is it possible with a different way than point to point network analysis?

• Your question is not clear to me. What to you mean by destination as "subset of a line layer"? What is wrong with point to point network analysis in your case? Can you show a screenshot to better understand what you want to do? Can you even share your data - at least a sample of it, be it even dummy data for testing? Dec 29, 2021 at 12:04
• The whole line layer would be the road network, and the subset a specific type of roads, e.g. for highway data from OSM would be highway=motorway (and highway=motorway_link). There is nothing wrong with point to point, but i thought there would be a better way to do it than "converting" the features into other data types. I have no data extracted from the osm database yet, since i was looking for a better workflow. But I can prepare some sample data the next days.
– axre
Dec 29, 2021 at 15:38
• I still don't understand completely: you want to get the shortest way from each polygon, using the network, to let's say: 1) the nearest motorway, 2) the nearest trunk way etc.? As far as I know, both start- and destination in network analysis are always points, never polygons or lines. So you should first think about how to convert your polygon/line start/destinations to points. For polygons, it should be easy: the closest point to the network. Dec 29, 2021 at 15:59
• Maybe have a look here: does it help? gis.stackexchange.com/a/398299/88814 Dec 29, 2021 at 16:00