I have a layer with municipal limits. With the following code I calculated the number of adjacent municipals:
SELECT distinct a.id, count (b.*), a.geom, a.codistat, a.name FROM municipal a JOIN municipal b ON ST_Intersects(b.geom, a.geom) where a.id != b.id GROUP BY a.id, a.geom, a.codistat, a.name
Now I am looking for the solution to calculate the number of adjacent municipalities that are connected by a road (layer
way with only
id attribute) to understand the value of the connections between municipalities.
In some cases this value will be lower than the one I previously calculated.
I have some problems figuring out how to integrate the code.
Any help is welcome