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

Matthias Kuhn matthias at opengis.ch
Tue Feb 26 08:49:13 PST 2019


Hi Martin

Interesting topic.

On 2/26/19 5:23 PM, Martin Dobias wrote:
> 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.

If I understand you correctly, the scaling that you see on OSM is only
done on client side (in javascript)?


> 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.
Agreed!
>
> 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.
That sounds like a promising path.

Alternatively, I was wondering if this could be done on layer/renderer
level instead of provider level, with no provider changes involved, as a
"magnification factor" on the layer. The advantage would be that it
could be applied to any raster format (WMS or even local tif files
generated using the "Convert map to raster" processing algorithm).

Just an idea, I didn't look into if/how this is doable code-wise.

> 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).

I wouldn't worry too much about that and rather have a clean and
powerful API.

- anything can be hidden in an advanced box in the beginning

- Configuring those is advanced magic anyway, QMS and whatever comes
along to ease the configuration can ship those parameters pre-filled so
the user does not need to care about it

Best regards

Matthias

>
> Are there any opinions / ideas how to deal with that?
>
> Cheers
> Martin
>
> [1] https://tile.osmand.net/hd/{z}/{x}/{y}.png
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-- 
Matthias Kuhn
matthias at opengis.ch <mailto:matthias at opengis.ch>
+41 (0)76 435 67 63 <tel:+41764356763>
OPENGIS.ch Logo <http://www.opengis.ch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190226/85d4ffbe/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6671 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190226/85d4ffbe/attachment.png>


More information about the QGIS-Developer mailing list