Therefore it is the same process as creating the hillshading. The raw data is again the SRTM data which origins from a NASA shuttle mission in 2000. You can download this data as *.hgt.zip files.
Assuming that you have all needed files in a directory, you can create the slope gradient visualization like this:
#!/bin/bash
for FILENAME in $(find /opt/mapnik/data/shades/raw/raw -name "*.hgt.zip")
do
echo $FILENAME
/opt/mapnik/data/shades/raw/srtm_generate_hdr.sh $FILENAME
FILEBASENAME="`basename $FILENAME .hgt.zip`"
rm $FILEBASENAME.prj
rm $FILEBASENAME.hgt
rm $FILEBASENAME.bil
rm $FILEBASENAME.hdr
gdal_translate -of GTiff -co "TILED=YES" -a_srs "+proj=latlong" $FILEBASENAME.tif ${FILEBASENAME}_adapted.tif
rm $FILEBASENAME.tif
gdalwarp -of GTiff -co "TILED=YES" -srcnodata 32767 -t_srs "+proj=merc +ellps=sphere +R=6378137 +a=6378137 +units=m" -rcs -order 3 -tr 30 30 -multi ${FILEBASENAME}_adapted.tif ${FILEBASENAME}_warped.tif
rm $FILEBASENAME_adapted.tif
gdaldem slope ${FILEBASENAME}_warped.tif ${FILEBASENAME}_slope.tif
rm ${FILEBASENAME}_warped.tif
gdaldem color-relief ${FILEBASENAME}_slope.tif color_slope2.txt rendered/${FILEBASENAME}_slopecolor.tif
rm ${FILEBASENAME}_slope.tif
done
The *_slopecolor.tif files contain the colors for the slope gradient.
Here is where I got the information from, this post explains how to set the colors: http://blog.thematicmapping.org/2012/06/creating-color-relief-and-slope-shading.html
Keine Kommentare:
Kommentar veröffentlichen