esri-leaflet
esri-leaflet copied to clipboard
decode LERC tiles from Esri ImageServer to draw in Leaflet
investigate how much work would be necessary to refactor/extend imageMapLayer
to take advantage of tile caches when they are present.
http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer
in the case of Esri's recent work to open source LERC, it would be really cool if we could download/decode and draw them in Leaflet.
cc/ @tomwayson
more info in Esri/lerc#4
work in progress here using L.GridLayer
, straight up FOSS!
Since users don't seem to be asking for this and this issue is 3 years old I'm going to close this.
Sorry for the crypto-bump! I am trying to access this new ESRI offering, and seem to be hitting errors related to this thread: livingatlas.arcgis.com/landcover/
I have an open question here; https://community.esri.com/t5/esri-leaflet-questions/how-to-diagnose-error-rendering-esri-2020-land/m-p/1079790#M427
Essentially, I am trying to use standard ESRI.leaflet methods to call in a layer that exists, offers a JSON response, but won't render into Leaflet. Happy for help!
While it's a bit obscure, here's a notebook showing the working pattern and the failed attempt to call ESRI's new 10m land cover:
https://community.esri.com/t5/esri-leaflet-questions/how-to-diagnose-error-rendering-esri-2020-land/m-p/1079790#M427
Welcome help and guidance!
@aaronkyle I'll make an attempt to get a demo working to illustrate how this might work. If it is successful, then we can revisit within esri-leaflet
how to support LERC decoding. And thanks @jgravois for your earlier work figuring this out!
In this particular example with the new landcover service, we have 2 separate items to deal with, as @gavinr outlined in the Community thread:
- Tiles are served out as WGS84 (wkid 4326) but Leaflet defaults to Spherical Mercator (Web Mercator) (wkid 3857). First we'll try to get Leaflet in wkid 4326 and assume we'll only load the landcover layer in the map.
- Decode LERC format tiles into a format Leaflet understands, since the service isn't providing an image in jpg/png or JSON pointing to an image url.
@aaronkyle here is a screenshot to provide hope. 😃 The approach is as expected: use a Leaflet map in WGS84, and for the layer itself manually decode pixels from each tile and write them into a 2d image canvas with appropriate RGB values. This was inspired by @jgravois's https://github.com/jgravois/lerc-leaflet but customized for this particular landcover service.
I'd like to first clean up the code before sharing, but I hope to have something to show soon in the coming days.
Wow, this is great! I really appreciate your help to make this resource available via ESRI-Leaflet.
Here's a working sample and brief write-up: https://github.com/jwasilgeo/leaflet-experiments#lerc-imagery-land-cover-layer
Happy to discuss the code a bit more. It is based on the LeafletJS GridLayer
approach pioneered by @jgravois but customized for this particular land cover ImageServer: https://github.com/jwasilgeo/leaflet-experiments/blob/master/lerc-landcover/script.js#L4
Between this and @jgravois's https://github.com/jgravois/lerc-leaflet/, we might have some good ideas coalescing to see if/how to bring this into the esri-leaflet ecosystem. I'll write up some more thoughts later.
Truly grateful for all of your time and expertise. I am amazed at how you are able to do this! Fun also to see you on Observable! Thanks for allowing me to share your solution under the MIT attribution license! :rocket:
@jwasilgeo Can we overlay this land cover wms layer (wgs84, 4326) on another wms layer with pseudo mercator projection (epsg 3857)? I tried with leaflet and esri-leaflet but I could not overlay.
I want to overlay with some other layers and compare the results.
a generic plugin for this would still be welcome, but i don't think we need an open issue to track given that no one is actively pursuing it.
All of the new hosted tiled imagery layers on ArcGIS.com (and many from the Living Atlas) will be served this way, so please re-consider re-opening this issue as it would allow all of this content to be consumed via this API.
Since the Living Atlas layers will be using this pattern going forward, I agree with @jgrayson-apl that we should re-open this issue to support decoding LERC tiles, via a plugin, in the future.
Unfortunately, there are issues with the approach suggested by John & Jacob as I can't get the tiled imagery layer to overlay with existing basemaps layers, in either 4326 or 3857. Here's a quick attempt: https://codepen.io/john-grayson/pen/gOzJRgg