1

I'm drawing rivers and roads as linestrings with width set in map units from an attribute.

When zooming out, of course they vanish quickly, because 10, 20 or 100m is less than a pixel at 1:100,000

How do I tell QGIS to always draw that line, maybe by changing from map scale to millimeters or by setting a scale-dependent minimum width?

For comparison, Google Maps always draws major roads (highways, etc.) even when the scale becomes such that they're the width of cities. I'm looking for that kind of effect.

3

That's quite easy: use pixel, points or mm as units for the width of the line (road, river) - thus a unit that refers to your rendered image/screen and not to the real world. Like this, you have the "Google-maps-effect" you refer to: your line is rendered always in the same width on your screen, whatever scale you zoom to.

However, if you want to have "real-world" units (like: 10 meter on earth surface) when zoomed in, but a constant line-width when zooming out (and the real-world-line disappears), then define two (or more) different styles with rule-based-style and add a scale-range for each style.

Even more sophisticated styles can be achieved with data-driven override - use the variable map_scale in the expression editor. But I think for what you would like to do, changing units to pixel, points or mm should do the job.

See screenshot: Line styling

  • That was my thought (changing units) - but I couldn't figure out how exactly to do that in QGIS 3.8 – Tom Sep 6 at 5:59
  • I just added a screenshot to my answer - it's QGIS 3.8.2 in german, but it should be clear where to find everything - otherwise ask again – babel Sep 6 at 6:08
  • brilliant, that's it. Thanks! – Tom Sep 6 at 6:18
  • 1
    It's actually much simpler then this - click the spanner button which shows next to the unit choice when it's set to map units, and set a minimum size in mm. – ndawson Sep 6 at 9:32

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.