1

Currently, I'm developing a plug-in with Python for QGIS, which allows me to perform Line-Of-Sight Calculations. For the calculations, I'm using a python-script which calls modules like "r.viewshed" from GRASS to create the viewshed-maps.

R.viewshed requires some raster-file as input, and that's why I'm using a method called "r.in.gdal" in my python-script to rasterize the elevation-map (tiff.file). The Line-Of-Sight Calculations are working properly, but there's just one problem:

r.viewshed requires one parameter called "observer_elevation". As for now, I've "hardcoded" this parameter since I don't know the elevation (height) of the given coordinate.

Does someone know, how to retrieve the elevation from a given coordinate so that I can process it in my python-script?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338

1 Answers1

2

You are probably confusing on how using the parameters for the r.viewshed GRASS module. In fact, from the manual of r.viewshed algorithm:

observer_elevation=value

Viewing elevation above the ground

Default: 1.75

This parameter doesn't refer to the elevation (height) of the given coordinate, but to the height of the observer. This observer usually is a man (this justifies the default value of 1.75 m), but you may adjust it on the basis of your needs.

For an example on how to run r.viewshed using Python, see also:

Programmatically performing viewshed on points from a shapefile

mgri
  • 16,159
  • 6
  • 47
  • 80