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

decode LERC tiles from Esri ImageServer to draw in Leaflet #726

Open
jgravois opened this issue Jan 13, 2016 · 14 comments
Open

decode LERC tiles from Esri ImageServer to draw in Leaflet #726

jgravois opened this issue Jan 13, 2016 · 14 comments

Comments

@jgravois
Copy link
Contributor

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

@jgravois
Copy link
Contributor Author

more info in Esri/lerc#4

@jgravois
Copy link
Contributor Author

jgravois commented Feb 2, 2016

work in progress here using L.GridLayer, straight up FOSS!

@jgravois jgravois closed this as completed Feb 2, 2016
@jgravois jgravois reopened this Feb 3, 2017
@patrickarlt
Copy link
Contributor

Since users don't seem to be asking for this and this issue is 3 years old I'm going to close this.

@aaronkyle
Copy link

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!

@jwasilgeo
Copy link
Contributor

jwasilgeo commented Jul 20, 2021

@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:

  1. 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.
  2. 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.

@jwasilgeo jwasilgeo reopened this Jul 20, 2021
@jwasilgeo
Copy link
Contributor

jwasilgeo commented Jul 20, 2021

@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.

image

I'd like to first clean up the code before sharing, but I hope to have something to show soon in the coming days.

@aaronkyle
Copy link

Wow, this is great! I really appreciate your help to make this resource available via ESRI-Leaflet.

@jwasilgeo
Copy link
Contributor

jwasilgeo commented Jul 21, 2021

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.

@aaronkyle
Copy link

aaronkyle commented Jul 22, 2021

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! 🚀

@venkanna37
Copy link

@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.

@jgravois
Copy link
Contributor Author

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.

@jgrayson-apl
Copy link

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.

@gavinr
Copy link
Contributor

gavinr commented Oct 11, 2022

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.

@gavinr gavinr reopened this Oct 11, 2022
@jgrayson-apl
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants