[GIS] QGIS gives different resolution basemap in Print Layout

qgis

I use tiled background map, from online source with 512-pix tiles and try to use it as background for printed map, using Print Layout and PDF export features. Problem: it seems that the choice of tile zoom levels depends automatically from the DPI setting.

Basemap layer is defined simply as "XYZ tiles" layer with following URL: http://1.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png

  • In the preview it uses screen dpi (70 perhaps), and I see this map on both map window and Print Layout. Tiles are here from zoom 16. And the street names are big and readable, as I need.
    enter image description here
  • Now for for print I need 600 (or more) DPI PDF-s. When I set this as Export resolution of Layout and create PDF, then suddenly exporter takes tiles from zoom 18, so exported PDF has different map, as below. Probably QGIS tries to match print resolution with tile raw resolution, but this is bad idea for such raster tiles, as you end up with very small texts. This rescaling probably makes sense for satellites, but not with maps with scale-dependent styles like texts. The pattern is that with 300 DPI there is +1 zoom, with 600 +2 zoom etc.
    enter image description here

In screenshots here the difference is not maybe so visible as it is in real printouts, but it is quite terrible.

Question: is there a way to adjust this multi-resolution raster layer resolution matching magic in QGIS Print Layouts?

This WMS question seems similar, maybe core issue is same: How to print a WMS map with chosen scale and WMS zoom level?

Btw, my quick remedy is now to use raster screenshot from Print Layout, but then I loose PDF vector with this, which would give much clearer vector texts and SVG vector icons on top of map.

Best Answer

It seems I found not the perfect, but "pretty good" solution for specific and probably for few similar cases.

  1. In the "XYZ" tiled basemap definitions I limit max zoom to the 16 - the zoom I really need in my print. This way I trick QGIS to rescale lower zoom tiles instead of using higher zoom tiles
  2. Discovered by accident that the server can give also 1024-pixel tiles, so this gives additional clarity to the basemap: http://tiles.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@4x.png . In general - use as high resolution in raster source as possible.
Related Question