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

addRasterImage doesn't work if latitude limits are -90 and +90 #831

Open
edwardlavender opened this issue Nov 29, 2022 · 1 comment
Open

Comments

@edwardlavender
Copy link

I tried to use addRasterImage to add a raster with limits -180, 180, -90, 90 to a leaflet map.

I expected the raster to be added to the map as usual, but it wasn't. The issue seems to come from the latitude limits. If you reduce the limits slightly, the map is produced as expected.

Here is a reproducible example:

library(raster)
library(leaflet)

packageVersion("raster")  # 3.6.11
packageVersion("leaflet") # 2.1.1

# This works
r <- raster(nrows = 180, ncols = 720,
            xmn = -180, xmx = 180, ymn = -89.999, ymx = 89.999)
r[] <- runif(prod(dim(r)), 0, 20)
leaflet() |>
  addTiles() |>
  addRasterImage(x = r)

# This doesn't work
r2 <- raster(nrows = 180, ncols = 720,
            xmn = -180, xmx = 180, ymn = -90, ymx = 90)
r2[] <- runif(prod(dim(r2)), 0, 20)
leaflet() |>
  addTiles() |>
  addRasterImage(x = r2)
@jaseeverett
Copy link

This is occurring for me too. I have reduced the latitude limits but it would be great if there was a fix.

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