mapbox / rio-rgbify

Encoded arbitrary bit depth rasters in pseudo base-256
MIT License
99 stars 36 forks source link

Remove background values #37

Closed fmariv closed 2 years ago

fmariv commented 2 years ago

I've managed to generate a RGB DEM, but my problem is that the process generates the background values that I point in the image. When I try to simbolyze the dem in Maputnik this values are still present and I need to get rid of them. I suppose that is related to the base value, which is set to 10000, but I wonder if there is any way of removing these values once I have the MBTiles.

image

fmariv commented 2 years ago

If anyone interested, this is how I've solved the issue:

  1. Translate the MBTiles back to a GeoTiff with gdal_translate -of GTiff input.mbtiles output.tif
  2. Remove the unwanted RGB values with nearblack -of GTiff -color 1,134,160,255 -o output.tif input.tif
  3. Generate the MBTiles again with any desired tool.

The final MBTiles will look like these

image