Closed gotestrand closed 6 years ago
Hi @gotestrand thank, for opening the issue.
After uploading the files to mapbox as a raster-layer the rgb-values get messed up by the compression of the tiles, causing the elevation-styling to be corrupt.
I'm may be wrong but last time I checked we cannot use geotiff/mbtiles terrain rgb in studio because when you upload it, it is recognized as raster
and not as raster-dem
. ref: https://github.com/mapbox/rio-rgbify/issues/17#issue-309403586
so it might result in something like 👇
I'm not aware this will change soon, you may contact mapbox support and ask about it.
Hi @gotestrand ! A few notes on this:
If you want to upload these files to Mapbox, you must use the mbtiles
format. There are a few other gotchas here, specifically that:
terrain-rgb
, with an interval of 0.1
and a basevalue of -10000
As @vincentsarago noted, you can't yet use Mapbox Studio to create the hillshade. You can with Mapbox GL JS. Here's an example with custom data: http://bl.ocks.org/dnomadb/raw/24d0d99f3ad85d3b65ef0ca552a53017/#15.86/37.741901/-119.489521/-109.5
Note that you must request pngraw
tiles: https://gist.github.com/dnomadb/24d0d99f3ad85d3b65ef0ca552a53017#file-index-html-L31
I should create a section in the README for this -- this tool was created before live hillshading in Mapbox GL JS existed, so wasn't a specifically planned use when this was written.
I still have my :crossed_fingers: that eventually you'll be able to upload your single band GeoTIFF DEM to Mapbox and it will automatically handle converting it to terrain-rgb as a raster-dem
.
Hi - I've been trying to do the same thing (Is it possible to import a rio-rgbify generated mbtiles file into Mapbox Studio?) got the following answer from the Mapbox support folks:
"While we do have terrain-rgb data available in our basemaps, it's not possible to create your own and use it within Mapbox Studio, and while it may be possible in Mapbox GL JS, there would be a lot of hurdles."
@dnomadb Thank you! After a bit of struggle I've succesfully managed to get my raster-dem working in mapbox-gl 😄
The final piece that was missing was to translate my geotiff to EPSG:3857
projection, before generating the final mbtiles
file. The projection translation would be a nice feature to add to this repo!
My final steps in summary:
EPSG:3857
. Using gdal with gdalwarp -t_srs EPSG:3857 -r lanczos -wo SOURCE_EXTRA=1000 -co COMPRESS=LZW [input-file] [output-file]
rio rgbify -b -10000 -i 0.1 --max-z 12 --min-z 0 --format png [input-file] [output-mbtiles]
raster-dem
source in mapbox, using pngraw
tiles. Add layer to map, tada!I used mbtiles-server to release my own tiles service and it worked, but its format is png
. So I used png
tiles instead of pngraw
tiles. I think they are the same?
Hi,
I'm trying to achieve the same results as in the blogpost https://blog.mapbox.com/realistic-terrain-with-custom-styling-ce1fe98518ab
I've managed to create both geotif and .mbtiles from my terrain geotif, using rio-rgbify. After uploading the files to mapbox as a raster-layer the rgb-values get messed up by the compression of the tiles, causing the elevation-styling to be corrupt.
I don't know if this is the right forum, but any ideas would be helpful!