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?

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

|improve this answer|||||
  • Thanks so much! So this means that the observer_elevation is per default set to | ELEVATION ON THE THE GIVEN POINT + 1,75 | . Is that correct? – Aleks Maksimovic Mar 8 '17 at 2:32
  • 1
    @AleksMaksimovic yes, it should be like that. – mgri Mar 8 '17 at 7:35

Your Answer

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

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