1

I am currently writing a app in R / Shiny where I use Leaflet. Background layers are WMS and it works fine for most services without specifying any projection anywhere. When using fiddler I see that the bounding box is specified in meters which is logical since Leaflet uses ESPG 3857.

Then to the problem: When I try to access NASA's WMS services with addWMSTiles I dont get it to work since NASA's wmses require a lat/lon bounding box.

Does not work: https://neo.sci.gsfc.nasa.gov/wms/wms?service=WMS&request=GetMap&layers=MOD_LSTD_CLIM_M&styles=&format=image%2Fpng&transparent=true&version=1.3.0&CRS=CRS%3A84&width=256&height=256&bbox=-20037508.342789244,-20037508.34278071,20037508.342789244,20037508.34278071

Works: https://neo.sci.gsfc.nasa.gov/wms/wms?service=WMS&request=GetMap&layers=MOD_LSTD_CLIM_M&styles=&format=image%2Fpng&transparent=true&version=1.3.0&CRS=CRS%3A84&width=256&height=256&bbox=-180,-90,180,90

I have tried to define the projection and force Leaflet to use this projection without success.

Defining WGS84

epsg4326 <- leafletCRS(
 crsClass = "L.Proj.CRS",
 code = "EPSG:4326",
 proj4def = "+proj=longlat +datum=WGS84 +no_defs ",
 resolutions = c(8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5 ),
 origin =c(0, 0))

Then initiating Leaflet with:

leaflet(options=leafletOptions(crs=epsg4326, worldCopyJump = FALSE)) %>%

So the question is, how do I get Leaflet to send a bounding box in lat/lon??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.