[GIS] Converting GeoTIFF to tiles using gdal2tiles

gdalgdal-translategdal2tilesgdalwarp

I have a GeoTIFF of weather radar data that I cannot seem to get converted to a raster tileset using gdal2tiles. When the tileset is generated, there are TONS of empty folders in the output directory, with a few holding a single transparent tile in them. I am not sure what is causing this, as I had other GeoTIFFs before (another source) and the same gdal2tiles script worked fine. I recently switched to a new process and I have to add the projection/bounds to the GeoTIFF myself, and I think I am going wrong somewhere when I am adding data to the image.

The original clean TIFF may be downloaded here for inspection :
https://www.dropbox.com/s/2dh74pjrjgkhqe0/latest.zip?dl=0

I know the projection and bounds the image must have, so as a first step before using gdal2tiles I have tried adding them.

First, I add the projection 3857 for use with Mapbox, and add the bounds. Have I done this correctly? The North extent should be 30.8, West is -104.7, East is -103.8, and South is 29.8.

gdal_translate -a_srs EPSG:3857 -a_ullr -104.7 30.8 -103.8 29.8 MRMS_RALA_LATEST.tiff projected.tiff 

Next, I use gdalwarp to warp the raster :

gdalwarp -t_srs EPSG:3857 projected.tiff projected2.tiff

Last, I colorize it :

gdaldem color-relief projected2.tiff mrms_reflectivity.txt colorized.tiff

And this is my gdal2tiles command. Again, all of the tiles it does output are blank.

gdal2tiles --profile=mercator -z 0-13 colorized.tiff outputfolder

For what it is worth, I have attached a screenshot of these commands being executed.
enter image description here

Also, for completeness – this is the colorization file used with gdaldem:
https://www.dropbox.com/s/5v65j3z6orirlk0/mrms_reflectivity.txt?dl=0

Best Answer

Your 1st step is wrong, as the initial raster is in EPSG:4326 it should be:

gdal_translate -a_srs EPSG:4326 -a_ullr -104.7 30.8 -103.8 29.8 MRMS_RALA_LATEST.tiff projected.tiff

Then your 2nd step will correctly reproject the raster to epsg:3857 for web mercator.

Related Question