[QGIS-Developer] WMTS/XYZ on high DPI screens

Martin Dobias wonder.sk at gmail.com
Tue Feb 26 08:23:47 PST 2019


Hi all

Whenever I use a background map like OpenStreetMap on my high-res
laptop screen (192 DPI) in QGIS, the labels are tiny. That is
"natural" because tiles are made for screens with ~96 DPI where the
size of labels is just fine. When I look at OSM tiles in the browser,
I can see that the browser displays the tiles scaled ... so even
though the tiles do not look super crisp, at least I do not need a
magnifying glass to read labels.

A similar problem I have encountered before is when using tiles from
WMTS/XYZ in print/PDF output: with higher resolution of print the
rendering engine picks very detailed tiles which again may contain
very tiny labels.

I would like to fix this in QGIS but I am wondering what would be the
correct approach.

One simple (and wrong?) solution would be to just scale tiles of all
tile layers, but I guess if the service displays some raw imagery it
would be wasteful to scale them as this unnecessarily would remove
details which could be still shown on high res display.

Other solution would be to introduce a new flag for WMTS/XYZ layers
where users could set native DPI. By default this flag would be
disabled, but for services like OSM one could explicitly set their DPI
to 96 and get the tiles scaled accordingly. This would need an update
of raster block request API as well where we would also need to
specify output DPI in addition to output width/height (but that should
not be a big deal).

This solution could also work nicely with services that provide
high-res tiles (using 512x512 for each tile instead of 256x256) -
right now QGIS thinks they are 256x256 so instead of a magnifying
glass one needs a microscope - you can try it [1]. Setting explicitly
DPI of high-res tiles to 192 DPI should also fix also that issue.

My only worry is if this setting is not going to be too difficult to
use for ordinary users... But maybe a combo box would make the choice
easier: "Normal resolution (96 DPI)" / "High resolution (192 DPI)" /
"Custom resolution" (with a spin box).

Are there any opinions / ideas how to deal with that?

Cheers
Martin

[1] https://tile.osmand.net/hd/{z}/{x}/{y}.png


More information about the QGIS-Developer mailing list