I have some route data with several routes which follow the same path for a distance. I would like to display the data showing thicker polylines where routes overlap, the more that overlap the thicker the line.
Is this possible using QGIS?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
I assume your routes is one layer.
You can create a virtual layer with the code:
with cte as ( Select st_intersection(a.geometry, b.geometry) geom --3: Return the intersecting geometry from "routes" a join "routes" b on st_intersects(a.geometry, b.geometry) --1: If two lines intersect where a.id<>b.id) --2: And the id is not the same select count(*) n_overlaps, geom --4: From the above query, count number of intersecting lines from cte group by geom --5: With the same geometry
Replace "routes" with the name of your layer, and id with the name of your unique id field (which you need to create if you dont have one).
The output layer will have an attribute showing the number of overlapping lines. Use this to symbolize:
array_length(overlay_intersects( @layer, $id))