I am trying to recreate this demo using QGIS only. https://thomasthoren.com/2016/02/28/making-a-new-york-times-map.html

Specifically I am trying to reproduce the hillshade and color portion without using a Makefile and the command terminal (i haven't progressed that far in my technical skills).

rm -rf tmp && mkdir -p tmp gdaldem \ hillshade \ tif/afghanistan-cropped.tif \ tmp/hillshade.tmp.tif \ -z 5 \ -az 315 \ -alt 60 \ -compute_edges gdal_calc.py \ -A tmp/hillshade.tmp.tif \ --outfile=tif/afghanistan-color-crop.tif \ --calc="255*(A>220) + A*(A<=220)" gdal_calc.py \ -A tmp/hillshade.tmp.tif \ --outfile=tmp/opacity_crop.tmp.tif \ --calc="1*(A>220) + (256-A)*(A<=220)"

The result will produce something like this: enter image description here

Is it possible to complete this only in QGIS? I have the Raster GDAL plugin installed. I have tried using Raster>Analysis>DEM tool to recreate this but I haven't been able to succeed in getting a similar result.

  • 1
    Use processing toolbox. GDAL / Analysis / Hillshade and GDAL / Miscellaneous / Raster calculator – aldo_tapia Nov 27 '16 at 2:22
  • Could you possible walk me through how to use the Raster calculator. I am not sure how to input this code section using the Raster calculator. 'gdal_calc.py \ -A tmp/hillshade.tmp.tif \ --outfile=tif/afghanistan-color-crop.tif \ --calc="255*(A>220) + A*(A<=220)" gdal_calc.py \ -A tmp/hillshade.tmp.tif \ --outfile=tmp/opacity_crop.tmp.tif \ --calc="1*(A>220) + (256-A)*(A<=220)" ' – mhshaaban Nov 27 '16 at 11:17
  • Paste the code in Cmd (Windows) or Terminal (OS X) and run it. Before, go to GDAL folder using cd + path\to\gdal, you can omit this step if you are a OS X user. Sometimes GDAL functions in QGIS doesn't work as well at the command line. If this is to difficult, use Raster / Raster calculator, you can do the same operations and is the easiest way. – aldo_tapia Nov 27 '16 at 13:07
  • When I use the command line, my result is not as pretty as the image above. The coloring of the map is much darker. – mhshaaban Nov 27 '16 at 13:50
  • 1
    @mhshaaban could you please explain in your question, or as an answer to your question, what you did to obtain the required result? It might help other people. Cheers, – Victor Nov 28 '16 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.