Yesterday, I received an interesting QGIS question:
is there a way to make road label font size depending on road lenght (with osm layer)?
Indeed, it could be interresting to see all roads, even the smallest, on a city map rendering.
Thanks to the data-defined labeling capabilities of the new QGIS version, we can!
Just click the slightly weird symbol right of the label text size and select Edit …
Since OSM data is in WGS84 by default, street length will be measured in degrees and therefore the values will be small. To get to a reasonable font size, I selected $length * 1000
.
The second part of the question can be addressed using a setting in the Rendering section which is – very descriptively – called “Show all labels for this layer (including colliding labels)”.
While I doubt that this simple method alone will create a great road map, I think it’s still an interesting exercise with sometimes surprising results.
