mapzen / terrarium

A series of experiments on terrain and elevation data for Tangram
MIT License
45 stars 3 forks source link

decoding PIXEL RGB Values in Browser Only (no server dependencies) #6

Open geospatialmapmashup opened 6 years ago

geospatialmapmashup commented 6 years ago

Is there any reference code for decoding the MapZen Terrarium PNG Code in the browser

matteblair commented 6 years ago

The encoding and decoding of Terrarium PNGs is documented here: https://mapzen.com/documentation/terrain-tiles/formats/#terrarium

geospatialmapmashup commented 6 years ago

I am well aware of the formula. I am talking about getting RGB Pixel Values from Leaflet or Tangram in Javascript. Not the calculation once you have those RGB Values. Thanks!

matteblair commented 6 years ago

Ah, I misunderstood! @meetar might know whether that's possible.

meetar commented 6 years ago

@geospatialmapmashup So you're just trying to read pixels? You've mentioned "decode" a few times in this thread including in its title, so I'm a bit confused as well...

The technique you need will vary depending on what exactly you're trying to accomplish and at what step in the process – for instance, whether in a Tangram shader, or when loading the tiles as a plain Leaflet tilesource, or after rendering them in a Tangram map, or after getting them through an xhttp request, etc. Could you tell us more about your use case?

geospatialmapmashup commented 6 years ago

I am looking to just show SPOT elevation in Leafletjs - eventually use Tilelayer-GL to do some shading/coloring. But it needs to be just in browser because it's an offline need. I downloaded some of the AWS S3 Hosted Terrarium PNG's and made MBTILES. I am also looking to build a terrain profile view of a route defined.