I'm trying to generate a slope tif from a HGT DEM file from SRTM.
I'm following this posts:
https://blog.mastermaps.com/2012/06/creating-hillshades-with-gdaldem.html https://blog.mastermaps.com/2012/06/creating-color-relief-and-slope-shading.html
But since I need to do it using the SRTM data, my first step is to convert the HGT file to TIF so I try this SRTM HGT to GeoTIFF conversion using GDAL:
gdal_translate S23W044.hgt S23W044.tif
but the result is not what I expect. I have only a black image with small white dots (seems the voids from the HGT or "no data" - don't know).
Well, I try to apply a color relief using the slope ramp from the example:
gdaldem color-relief S23W044.tif slope-ramp.txt S23W044-slope.tif
But the result is far from that I see in the tutorial:
Here are my other tryings from color-relief and hillshade:
(this try was using the HGT file directly because the TIF was too ugly and dark)
gdaldem hillshade -co TILED=YES -co compress=lzw -s 111120 -z 5 -alt 60 -az 315 -combined -compute_edges S23W044.hgt hs_S23W044.tif
gdaldem color-relief -nearest_color_entry S23W044.hgt color_ramp.txt co_S23W044.tif
My color ramp is:
4500 255 255 255
3000 105 82 14
2900 168 134 29
2500 191 179 142
1100 235 220 175
950 233 228 214
800 241 232 205
700 236 228 198
600 226 221 192
500 213 210 178
400 208 224 190
300 190 230 189
200 200 237 202
100 230 244 228
50 236 241 230
0 242 242 236
nv 255 255 255
The slope ramp (don't know why the values are in ASC order in the post):
0 255 255 255
90 0 0 0
My question is: why my result are to dark? My goal is to achieve this beauty image using HGT file to hillshade, slope and color relief:
but seems I'm messing with the parameters.
By the way, I'm merging the hillshade to color relief using this ( sorry for the $1,$2 and $3. They are parameters from my bash script - "hillshade file", "color relief file" and "out file"):
gdal_calc.py -A $1 --outfile="gamma_"$1 --overwrite --calc="uint8(((A / 255.)**(1/0.5)) * 255)"
gdal_calc.py -A "gamma_"$1 -B $2 --overwrite --allBands=B --calc="uint8( ( 2 * (A/255.)*(B/255.)*(A<128) + ( 1 - 2 * (1-(A/255.))*(1-(B/255.)) ) * (A>=128) ) * 255 )" --outfile=$3
This is the merge result ( without the slope because it is too dark and the things goes worth ):
as you can see is far from the result I'm expecting. My HGT file came from here (you may need a login to download)
http://e4ftl01.cr.usgs.gov/MEASURES/SRTMGL1.003/2000.02.11/S23W044.SRTMGL1.hgt.zip
Please... I think I have all tools I need right here in front of me but I don't now how to use them right.






Z factorin gdaldem hillshade is to "Vertical exaggeration used to pre-multiply the elevations" : https://gdal.org/programs/gdaldem.html#cmdoption-z how it work in this case? and how vertical exageration is linked to a projection? By the way, I'm using already-z 5in my gdaldem hillshade command. Se my command above. Thjis only made my mountains higher. – Magno C Sep 06 '21 at 04:01-s 111120already in my command. This is not the case. By the way, the hillshade seems the only thing working well here. My problem is in slope, merge and relief. – Magno C Sep 06 '21 at 04:18gdaldem slope– Magno C Sep 07 '21 at 16:53gdal slopeneeds a scale when you work with HGT files... so adding-s 111120 -compute_edgesmakes the result all fine. Now I can go to the next step: MERGE – Magno C Sep 07 '21 at 23:06