23

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.

5
  • With satellite you may be able to request better rasters from server, like here: gis.stackexchange.com/questions/194953/… . But with the OSM tiles I don't have more than 512 source, so I expect QGIS to upscale from there.
    – JaakL
    Jun 13, 2018 at 11:42
  • what is your background map source? is it DPI aware?
    – Ian Turton
    Jun 13, 2018 at 11:43
  • It is defined simply as "XYZ tiles" layer with following URL: http://1.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png
    – JaakL
    Jun 13, 2018 at 11:52
  • please edit your question with this new information
    – Ian Turton
    Jun 13, 2018 at 11:53
  • looks like I have the same problem: gis.stackexchange.com/questions/286315/… - I am using both OSM from Openlayers plugin and Terrestris OSM WMS: ows.terrestris.de/osm/service?&format_options=dpi:300 but trying to play with the DPI parameter did not help.
    – Juhele
    Jun 14, 2018 at 16:39

3 Answers 3

13

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.
1
  • The solution 1 is OK!
    – HMadadi
    Apr 3, 2020 at 12:31
6

In the layout editor in Layout Settings -> Export Settings you can change the export DPI from say 300 to 96, that changes the resolution of the tiles used.

Screen snip showing location of Export resolution setting

1

Maybe this could help, if you are willing to install the fantastic MapProxy Server: How to lock a WMS layer to scale in QGIS?

And you can even resolve this problem without MapProxy, using the fantastc GDAL tools: How to lock a WMS layer to scale in QGIS?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.