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

raster coarsens when added to smaller-extent map #1394

Closed
AMBarbosa opened this issue Jan 9, 2024 · 1 comment
Closed

raster coarsens when added to smaller-extent map #1394

AMBarbosa opened this issue Jan 9, 2024 · 1 comment

Comments

@AMBarbosa
Copy link
Contributor

In some circumstances, when a raster map is added to a smaller-extent vector map, it is plotted at a coarser resolution, without a warning or message. This may be undesirable, and it doesn't appear to be documented. Here's a reproducible example:

v <- geodata::gadm("Greenland", level=1, path=tempdir())

r <- geodata::worldclim_country("Greenland", var="wind", path=tempdir())
r <- r[[1]]

# plot raster over smaller extent:
plot(r, ext=ext(v[1, ]))  # OK
plot(v[1, ], add=TRUE)

# add raster to smaller-extent vector:
plot(v[1, ])
plot(r, add=TRUE)  # coarser pixels!
@rhijmans
Copy link
Member

rhijmans commented Jan 9, 2024

Thanks. When using "add=TRUE" the raster data was sampled without considering the extent of the map. That was not intentional. Fixed now.

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

2 participants