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

Martin Dobias wonder.sk at gmail.com
Wed Feb 27 12:45:17 PST 2019


On Wed, Feb 27, 2019 at 1:03 PM Matthias Kuhn <matthias at opengis.ch> wrote:
> >
> > I am wondering if we should have three options for tile resolutions:
> > - standard (96 DPI) ... autoscaled, for 256x256 tiles for XYZ tiles
> > - high res (192 DPI) ... autoscaled, for 512x512 tiles for XYZ tiles
> > - undefined ... not scaled
>
> Sounds reasonable.
>
> I can see the following options for what a data provider can offer:
>
>   * A predefined set of available DPI from the server (e.g. XYZ)
>
>   * Manually specify DPI (e.g. as WMS parameter "DPI=300")
>
>   * No scaling available

Right.


> Some dataproviders might know what they can offer (WMS might include
> that in the GetCapabilities, AFS maybe?), others might need
> configuration on layer / data provider properties (XYZ, preconfigured
> through QMS or ,qml/.qlr files).

As mentioned in my earlier email, WMS, WMTS, XYZ have no way to tell
the true DPI of tiles (as far as I know). AMS does but QGIS does not
take it into account.


> I assume that it's also not always desired to get the maximum resolution.
>
> E.g. in HighRes atlas printing a WMS via a network connection with
> "DPI=3000" parameter could be very slow, so the API should be prepared
> to specify
>
>  * "data source DPI", i.e. what's requested from the provider
>
>  * and output device DPI, i.e. what it's scaled to for screen/paper

To specify output device DPI there's already
QgsRasterDataProvider::setDpi() call which is also used when drawing
raster layers.

I am not sure how do you mean it with specification of "data source
DPI" ... if I have a tileset with 96 DPI, do you mean that option
should allow overriding of the source DPI?

In any case, here's my take on fixing three problems in one go:
- correct rendering of XYZ tiles on high res screen (and in print output)
- correct rendering of high resolution XYZ tiles (on any screen)
https://github.com/qgis/QGIS/pull/9296

The PR does not address scaling issues with WMTS layers. Compared to
XYZ layers where one connection = one tile layer, with WMTS there may
be multiple tile layers within one connection, each with different DPI
- and as mentioned above, WMTS does not provide information about DPI.

Cheers
Martin


More information about the QGIS-Developer mailing list