<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi Martin</p>
    <p>Interesting topic.</p>
    <div class="moz-cite-prefix">On 2/26/19 5:23 PM, Martin Dobias
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAC2XbFf6G9tA+cNovv-dQthgxfo9zfrDzJ8OeFmrPt6+CT128A@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">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.</pre>
    </blockquote>
    <p>If I understand you correctly, the scaling that you see on OSM is
      only done on client side (in javascript)?</p>
    <p><br>
    </p>
    <blockquote type="cite"
cite="mid:CAC2XbFf6G9tA+cNovv-dQthgxfo9zfrDzJ8OeFmrPt6+CT128A@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">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.</pre>
    </blockquote>
    Agreed!<br>
    <blockquote type="cite"
cite="mid:CAC2XbFf6G9tA+cNovv-dQthgxfo9zfrDzJ8OeFmrPt6+CT128A@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">

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.</pre>
    </blockquote>
    That sounds like a promising path.
    <p>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).<br>
    </p>
    <p>Just an idea, I didn't look into if/how this is doable code-wise.<br>
    </p>
    <blockquote type="cite"
cite="mid:CAC2XbFf6G9tA+cNovv-dQthgxfo9zfrDzJ8OeFmrPt6+CT128A@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">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).</pre>
    </blockquote>
    <p>I wouldn't worry too much about that and rather have a clean and
      powerful API.<br>
    </p>
    <p>- anything can be hidden in an advanced box in the beginning</p>
    <p>- 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</p>
    <p>Best regards</p>
    <p>Matthias<br>
    </p>
    <blockquote type="cite"
cite="mid:CAC2XbFf6G9tA+cNovv-dQthgxfo9zfrDzJ8OeFmrPt6+CT128A@mail.gmail.com">
      <pre class="moz-quote-pre" wrap="">

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

Cheers
Martin

[1] <a class="moz-txt-link-freetext" href="https://tile.osmand.net/hd/">https://tile.osmand.net/hd/</a>{z}/{x}/{y}.png
_______________________________________________
QGIS-Developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:QGIS-Developer@lists.osgeo.org">QGIS-Developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-developer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a>

</pre>
    </blockquote>
    <blockquote type="cite"
cite="mid:CAC2XbFf6G9tA+cNovv-dQthgxfo9zfrDzJ8OeFmrPt6+CT128A@mail.gmail.com"></blockquote>
    <div class="moz-signature">-- <br>
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div class="moz-signature">
        <title></title>
        <div class="moz-signature"> <span style="text-align: left;
            color: #000000; font-family: 'Verdana', sans-serif;
            font-size: 10pt">Matthias Kuhn</span><br>
          <a href="mailto:matthias@opengis.ch" target="_blank"> <span
              style="text-align: left; color: #000000; font-family:
              'Verdana', sans-serif; font-size: 8pt">matthias@opengis.ch</span>
          </a><br>
          <span style="text-align: left; color: #000000; font-family:
            'Verdana', sans-serif; font-size: 8pt"><a
              href="tel:+41764356763">+41 (0)76 435 67 63</a></span><br>
          <div> <a href="http://www.opengis.ch"> <img
                moz-do-not-send="false"
                src="cid:part3.57F172D1.563C875A@opengis.ch"
                alt="OPENGIS.ch Logo" width="200" height="80"></a> </div>
        </div>
      </div>
    </div>
  </body>
</html>