Open m-kuhn opened 1 year ago
I looked at this issue and could reproduce the same behaviour. Changing the value of the combobox doesn't change the rendering of the map. I tried with normal and high dpi (@2x
) services.
Since the actual resolution is given by the tile itself I don't understand what is the point of this settings?
Edit: That on a not-hidpi screen
I have added sample configurations in all combinations
for
XYZ provider
Results on a hidpi screen:
So it seems to have some effect, but it seems confusing.
@wonder-sk does this make sense to you?
Hi @m-kuhn hmm that's strange. The DPI settings do not work correctly for me anymore, yet I get slightly different results: all 6 options (96/192/unknown vs lowres/highres tiles) have the same appearance for me.
The way this was supposed to work last time when I was touching the code was that for raster tiles with labels (e.g. openstreetmap), lowres tiles would be showing up with tiny labels (both on high dpi desktop or phone) by default - that's the "unknown" option. So I added the options for 96 DPI and 192 DPI to let the user specify for what resolution the tiles were made for, to scale them properly. As a result, for OSM tiles if I would set 96 DPI, then the labels would get readable no matter screen DPI was.
I was thinking whether to even keep the "unknown" option, but it seemed useful e.g. for satellite imagery that does not contain labels, so one gets very crisp map on any DPI.
Not sure what could be the cause of the change of the behavior...
@m-kuhn , alright, I've spent more time thinking about this. I think the current behavior is fine. On a normal DPI screen (i.e. 96 DPI), all the settings end up with the same map output, and that's because setting the option to 192 DPI merely indicates the tiles can go up to 192DPI, but will be downscaled on a 96DPI to match the targeted 96 DPI screen (i.e. 256 x 256 tiles).
When you will see a difference is whenever you consume the tiles on a high DPI screen:
This is most likely the right behavior as it allows for renderings across multiple DPI density to look roughly the same (vs. rendering 512x512 tiles without downscaling on a low DPI making everything look huge).
I think we can close this one, and maybe insure documentation properly describes the logic so none of us end up thinking it's not working again :)
@wonder-sk , as author of the original code, do you concur?
hi @nirvn sorry for the slow response times... Yes what you say in your comment is exactly how things were meant to work: to scale up 256x256 tiles on high DPI screens, and use 512x512 tiles as they are for sharp look. On low DPI screens, 256x256 tiles get used as they are (no need for scaling), and 512x512 tiles should get scaled down (ideally 512x512px tiles should not be used on low DPI screens).
So yeah it is maybe a bit of a documentation issue.
Maybe a nice small improvement to fix this would be to allow multiple URLs for XYZ connections - e.g. one for low-res tiles (256x256px) and one for high-res tiles (512x512px), so QGIS would pick automatically the right one. High-res tiles could be possibly even auto-detected by checking the @2x
convention when adding a connection...
Can be closed or better to keep it open?
Checking again.
On a high resolution screen I don't see any difference between specifying 96 and 192dpi. Based on the explanation by @nirvn on a high res screen I should be seeing a difference (whereas on low res screens the setting will be ignored).
@wonder-sk on the other hand says, that tiles should be scaled up or down on low or high res screens.
Is someone actually able to confirm that the setting 96dpi or 192dpi does make a difference on their system?
Maybe a nice small improvement to fix this would be to allow multiple URLs for XYZ connections - e.g. one for low-res tiles (256x256px) and one for high-res tiles (512x512px), so QGIS would pick automatically the right one. High-res tiles could be possibly even auto-detected by checking the @2x convention when adding a connection...
This sounds like a very good proposal in any case :+1:
Hello,
Please note that this setting for XYZ tiles connexion introduce distinct behaviours when rending layouts.
If my XYZ layer in my project is configured with Tile Resolution : Unknown (not scaled), then the zoom level of tiles is different depending on DPI resolution chosen for exporting the layout. See the following results. PNG AT 120DPI PNG AT 240DPI Much more details when zooming in the picture
If my XYZ layer in my project is configured with *Tile Resolution : Standard (256256 / 96DPI), then the zoom level for tiles is always the same, and there is only one DPI resolution for layout export that fits exactly the resolution of tiles. Compare with the following results. PNG AT 120DPI PNG AT 240DPI** Exactly the same detail when zooming in the picture, and in this case there is no benefit when increasing the layout resolution
@bsaglio2001 , confirmed.
Am I concluding correctly, that this setting has the desired effect when used for print layouts, but does not have an effect for on-screen rendering?
@m-kuhn , the opposite. ATM, it works quite well on-screen, but it regressed within layouts (due to high dpi upgrades done during this year).
You can easily see this by adding an OSM layer (insuring that it has a known tile resolution), adding a layout and zooming in/out:
https://github.com/user-attachments/assets/808f9d65-3f1d-4059-b5a5-bd68e97cfddc
The logic regressed, resulting it what looks like an inverted calculation whereas the more you zoom out, the higher the the Z level. It's in the to do list for bug fixing period.
What is the bug or the crash?
XYZ connections allow a user to specify the DPI of the source with "tile resolution". Changing this settings does not have any effect.
Steps to reproduce the issue
or
then
N.B. In the layer information, there's a different
tilePixelRatio
set in the datasource of the layer, it seems the issue is not in the configuration dialog but the providerVersions
QGIS 3.26 and master
Supported QGIS version
New profile
Additional context
No response