Dear Community.
I am trying to load in ESRI's new 10m land cover data to a Leaflet map, but having trouble. I can call the WMS and receive a response, e.g.:
`d3.json('https://tiledimageservices.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/Esri_2020_Land_Cover_V2/...')`
returns an Object:
Object {
Solved! Go to Solution.
A solution is outlined here with a live demo and code sample: https://github.com/Esri/esri-leaflet/issues/726#issuecomment-884481812
Hi, thanks for the question. It looks like that service is a "Tiled Imagery Layer" (see that on the item details page). Given that, I think it would probably be better to use L.esri.tiledMapLayer().
I tested using L.esri.tiledMapLayer(): https://codepen.io/gavinr/pen/QWvvdpm?editors=0010 If you open the developer console, you'll see the message "L.esri.TiledMapLayer is using a non-mercator spatial reference". In other words, the service is published in a non-web-mercator WKID. Specifically it's using WGS84 (4326). So the first task will be to get that 4326 layer onto your map. See these resources:
Additionally, if you look more at that service, you'll notice the format is LERC2D. I do not think L.esri.tiledMapLayer() will currently support that. There was a discussion on supporting this in Esri Leaflet: https://github.com/Esri/esri-leaflet/issues/726
That issue was closed due to lack of activity, but perhaps with interest in this new service (and others like it) now is the time. If you'd like to chime in on that issue or create a new one, your feedback (or code contributions, if you figure out how to do it) would be appreciated.
I Gavin! Thank you for your time and help! I see that your CodePen was still not able to load the layer? Switching to `tiledMapLayer` s gives me a 404 on called resources, e.g.:
tiledimageservices.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/Esri_2020_Land_Cover_V2/ImageServer/tile/13/3060/2455
(plus a stack of about 5 other failed requests). This still looks like a server-side issue?
Thanks also for your notes and guidance on projections. I am new to this and learning. WGS(84) (4326) is (in my understanding) the correct default for Leaflet, so that shouldn't be an issue?
Thank you for pointing me to the GitHub issues. I'll also raise an additional comment there.
It's weird, b/c I have no issue with similar layers. Here's an example:
https://observablehq.com/@ambassadors/3band_cir_8bit_imagery
From your comments, I still have to learn more to distinguish how / in what format different layers are served. It's still a bit cryptic to me 😞 thank you for your time and guidance!
Happy for more help to diagnose and resolve!
Sincerely,
Aaron
Aaron, thanks for commenting as well in the related GitHub issue for esri-leaflet. I've continued with some fresh comments over there. https://github.com/Esri/esri-leaflet/issues/726
But yes, we'll need to get Leaflet into WGS84 (wkid 4326) instead of its default Spherical Mercator (wkid 3857). Then, we'll look into experimenting with decoding LERC tiles manually.
A solution is outlined here with a live demo and code sample: https://github.com/Esri/esri-leaflet/issues/726#issuecomment-884481812
Wow Jacob! This is beautiful (and very complex). Thank you!
For fun, here's your code ported to an Observable notebook--properly attributed and licensed 😉
https://observablehq.com/@aaronkyle/esri-2020-land-cover
Thanks for your generosity and expertise!
Dear Jacob, Gavin and Community:
I really appreciate your time and help on this! Having re-worked through Gavin's initial reply, I learned a lot about diagnosing errors (I found the console messages I initially missed in my first reply), determining map service types, etc. This is all very helpful! Thank you. I caught another message form Jacob via GitHub [https://github.com/Esri/esri-leaflet/issues/726]: it's incredible the help you're sharing! Thank you so much.