Skip to content
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

Disable downsampling of basemap in facets? #895

Open
SebKrantz opened this issue Jun 28, 2024 · 2 comments
Open

Disable downsampling of basemap in facets? #895

SebKrantz opened this issue Jun 28, 2024 · 2 comments

Comments

@SebKrantz
Copy link

SebKrantz commented Jun 28, 2024

I'm using tm_basemap("Esri.WorldGrayCanvas", zoom = 4) as a basemap. The resolution on large geographies is ok-isch. When using tm_facet_wrap(), the resolution of the basemap decreases, and tmap displays a message "SpatRaster object downsampled to 204 by 224 cells.". I understand that this may be a good idea for memory reasons, but in many cases it really makes the basemap unintelligible. It would be great if the resolution of the map could be increased in general, and if it could be kept for facets. Thanks!

@mtennekes
Copy link
Member

The option raster.max.cells controls this. It is the upperbound for the total number of cells, so the total over all facets. If the number of cells is larger, then it is downsampled. This is intentionally to prevent system crashes and the reduce computation time significantly.

However, I agree that the maps should be as sharp as possible.

The current value is 1e6, which is definitely too small, also for a single map without facets. So 1e7 corresponds to roughly 3000 by 3000, and 1e8 10,000 by 10,000. What would be a good default value in your opinion, @SebKrantz (cc @Nowosad)?

You can play around with this value as follows:

tmap_options(raster.max.cells = 1e6)
tm_shape(World[169,]) +
	tm_borders(col = "red") +
	tm_basemap("Esri.WorldImagery", zoom = 4)

@Nowosad
Copy link
Member

Nowosad commented Jul 3, 2024

My general thinking is that raster.max.cells should relate to each panel separately (that would be my expectation as a user). Currently, when you have one panel, the map is fine; but when you have 10 panels, all of them do not look good -- their resolution is too low...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants