I've found a tutorial showing exactly what I want to do (merge viewshed and hill shade or map) but unfortunately it is for QGIS users and I need it in pure command line instructions because I'm in a headless environment.

Must be only GDAL/GRASS command line and use SRTM HGT as DEM source and hill shade source.

I don't know QGIS enough to think it is very compact and directed to expert users or if it is just full of blah blah blah because it have a lot of images and almost none real instructions.

Can someone translate this tutorial to pure command line GDAL/GRASS so I can achieve the same result like the pictures below?

enter image description here

enter image description here

  • Please remove from the hold. This question is relevant and is earning votes. – Magno C Jun 13 '19 at 10:27
  • That question is rather obvious... pls unhold it. – markusN Jun 13 '19 at 19:47
  • @markusN The question is obvious i.e. "Can someone translate this tutorial to pure command line GDAL/GRASS so I can achieve the same result like the pictures below?" Asking the community to translate a tutorial is what makes it too broad. Asking about a particular part of the tutorial where they are stuck in their own translation would be a focused question. – PolyGeo Jul 25 '19 at 4:56

How about something like this:

radius=5000 # Maximum distance
X=200000    # X coordinate of lookout 
Y=500000    # Y coordinate of lookout

r.import dem.tif output=elev
g.region -a rast=elev
r.viewshed input=elev output=vshed max_distance=$radius coordinates=${X},${Y}
r.to.vect input=vshed output=vshed type=area

This should leave you with a raster named "vshed" and a polygon vector also named "vshed" representing the viewshed from location $X,$Y with maximum radius $radius.

You can add additional parameters such as observer_elevation and target_elevation. See the GRASS manual page.

Yes you can run r.viewshedin a long/lat coordinate system. (You need to create your GRASS location as such from the start). But be aware than ranges will be in decimal degrees.

Regarding SRTM, please do read the GRASS wiki pageon using STRM in GRASS. I think you'll find it helpful.

About the units, in the r.viewshed man page you might have missed the explanation:

By default there is no restriction on the maximum distance to which the observer can see. The user can set a maximum distance of visibility using option max_distance. The value entered is in the same units as the cell size of the raster.

And one last important point. As always, be sure to set the GRASS computational region at the start. I added this to the code above.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.