-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can’t get a crisp basemap to display #1041
Comments
Known issue, see also #603 and #1042 For images like this when the resolution is really low, the only 'fix' is to use the exact same resolution so that resealing is not needed. This is not easy in tmap because it affects all margins, and moreover is graphics device dependent. The best option is to use so-called Retina tiles, which are rendered in much higher resolution. They are not implemented in tmap yet, but are already in |
Retina tiles will only (maybe) fix it for high-resolution tiles providers no ? So that won’t help for the OSM tiles. Zoom level 7 was indeed a bit low in my example, so even the plot_tiles version was a bit blurry. If I switch to zoom level 8, plot_tiles becomes perfectly crisp whereas tmap output is unreadable With a tile server, I would expect not to have to choose the zoom level, but probably the dpi instead if it can’t be autodetected, and have tmap automatically pull the tiles with the optimal zoom level, so that there’s no resizing whatsoever. Easy to say, probably very hard to do ! |
Just found the issue with the difference in sharpness! Via
If it works correctly, you don't need to choose a zoom level, because it is based on a simple heuristic, which is not based on resolution but rather on real-world map scale. Regarding the native tile resolution: Strongly related topic: #914 |
Seems to work now. Just started a new branch "crispy". Feel free to test already. tm_basemap("OpenStreetMap") +
tm_shape(nc) Some open questions:
tm_shape(World) + tm_borders() + tm_basemap("OpenStreetMap") I need to add a tmap option for this, probably something like |
Hi @mtennekes
(Side note: I updated tmap using the crispy branch, but the nc map is still blurry on my computer) |
Just merged the crispy branch to master.
How blurry is your nc map? I get still the same sharpness as my last image (and the same as the 2nd one from the opening post). It should be similar. If not, we'll have to figure out what causes it. The retina tiles look sharper, e.g. I've added |
Hi @mtennekes, The crispy version is much better, thanks a lot ! The reprojection problem seems to be solved, so there’s no more distorsion that I can see. But… it’s not as good as maptiles output, although I think I’ve just understood why. To test it, I’ve done a short Quarto page
And here are the PNG generated If you look at them at 100 %, you’ll see that the maptiles one is much better. And indeed, if I pass TLDR: tmap might benefit from a "smooth" option when rendering rasters. |
@mtennekes yes ! It works perfectly now, thank you so much ! I’ve also tried getting a raster with {basemaps}, and as long as I add the interpolate option, the display is as good with tmap than it is with terra. (unrelated: it seems that opt_tm_rgb is not exported, I had to ::: it).
|
You're welcome! Yes, I also notices we forgot to export |
I’m not able to generate a clean looking basemap.
Using tmap, I get distorted map elements, the text is unreadable.
Using maptiles directly, everything is fine
It looks like there’s some unwanted reprojection and/or scaling somewhere, but whatever I’ve tried, I could not improve it.
It’s not specific to the OpenStreetMap tileset either.
Using tmap 4.0.
The text was updated successfully, but these errors were encountered: