Comments (6)
@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:
- Translate geotiff to web mercator projection
EPSG:3857
. Using gdal withgdalwarp -t_srs EPSG:3857 -r lanczos -wo SOURCE_EXTRA=1000 -co COMPRESS=LZW [input-file] [output-file]
- Create mbtiles using
rio rgbify -b -10000 -i 0.1 --max-z 12 --min-z 0 --format png [input-file] [output-mbtiles]
- Create a
raster-dem
source in mapbox, usingpngraw
tiles. Add layer to map, tada!
from rio-rgbify.
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:- You should use the same encoding as
terrain-rgb
, with an interval of0.1
and a basevalue of-10000
- If you try to generate low zoom tiles with a large elevation range, the tiles generated will be too large, and the upload will fail. I don't have a good rule of thumb on what this zoom is, but -- if you experience this error I'd try backing off a few zooms
- You should use the same encoding as
-
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 requestpngraw
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.
from rio-rgbify.
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: #17 (comment)
so it might result in something like π
I'm not aware this will change soon, you may contact mapbox support and ask about it.
from rio-rgbify.
I still have my π€ 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
.
from rio-rgbify.
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."
from rio-rgbify.
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?
from rio-rgbify.
Related Issues (20)
- Is it possible to import a rio-rgbify generated mbtiles file into Mapbox Studio? HOT 1
- rgb tiles only show CornerοΌ
- CRSError: CRS is empty or invalid: u'' HOT 8
- TIF -> MBTILES -> Mapbox Studio?
- Use Rasterio to create webp HOT 4
- Script can't quit automatically after finishing the conversion of TIFF -> mbtiles
- How to merge multiple raster .mbtiles into the single one? HOT 2
- Using rio-rgbify on windows
- Deal with bigtiff as source? HOT 1
- can't fully understand the '-interval' params HOT 1
- Error occurred over-altitude terrain RGB raster tileset in Mapbox GL JS HOT 4
- raster edge normalization
- Fix reprojection issue making plugin unusable & roll out new release HOT 2
- Remove background values HOT 1
- Fix nodata values at source edges
- rasterio._err.CPLE_AppDefinedError: densify_pts must be at least 2 if the output is geograpic HOT 12
- Custom terrain RGB/hillshade HOT 2
- Latest pre-built wheel does not match source HOT 1
- Error: RGB terrain shifted -10000 when rendered using 3d terrain (raster-dem) Maplibre GL HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rio-rgbify.