How to add ArcGIS server layer using leaflet.esri package?

964 views Asked by At

I am trying to add a layer from a published ArcGIS service feature into a leaflet map in R using the leaflet.esri package.

I've read the documentations here https://rdrr.io/cran/leaflet.esri/man/addEsriTiledMapLayer.html and here https://cran.r-project.org/web/packages/leaflet.esri/leaflet.esri.pdf and have tested the examples

My code looks like this:

library(leaflet)
library(leaflet.esri)

leaflet() %>% setView(lng = 55.0876632, lat = 25.0755935, zoom = 10) %>% 
  addEsriTiledMapLayer(
  url = "https://smart.gis.gov.ae/dmgis104/rest/services/Misc/Env_Imagery/MapServer")

Update: Note that no username or password is required.

I've confirmed that url works by adding it as an ArcGIS server in ArcCatalog, but when I try to run the above in R I just get a blank leaflet map.

How do I specify which layer from the above url to load? There are a number of layers available at that url, such as "Misc/IMAGE2018" and I would like to load these into leaflet.

I am a bit confused as well because when I inspect the url in ArcCatlog it shortens it to "Server URL: https://smart.gis.gov.ae/dmgis104/services" instead of the above, but I am not sure if that matters. See screen shot below as example of ArcCatlog.

Screenshot of ArcCatlog connection

Thanks in advance

1

There are 1 answers

1
john gravois On

the issue is that your map service doesn't use the typical web mercator projection and tiling scheme.

you can find an example which includes extra code to explicitly define a custom projection here: http://esri.github.io/esri-leaflet/examples/non-mercator-projection.html