0

GDAL has a function called gdal_viewshed. I checked on the GDAL's Python API to see if there is a function I can call in a Python script and I found gdal.ViewshedGenerate.

https://gdal.org/python/index.html

However, when I run a script calling this function I get the following message:

AttributeError: module 'osgeo.gdal' has no attribute 'ViewshedGenerate'

I tried with the latest GDAL version (3.0.2) and version 2.3.3 and I always get this message.

The problem is not the code but the fact that GDAL doesn't recognize this function. Does anybody know why I can't use this function although it is on the Python API documentation?

I couldn't even find any information about this function anywhere apart from the mentioned documentation.

1
  • GDAL 3.0.2 is not the latest. – user30184 Sep 12 '20 at 16:25
1

Have a closer look at https://gdal.org/programs/gdal_viewshed.html.

New in version 3.1.0.

1
  • Thank you. Anaconda only let me update to version 3.0.2 so I supposed it was the latest version. – dangimar Sep 12 '20 at 17:41
-1

I explained how to install GDAL successfully on MS Windows. Follow this post on GIS Stackchange to install GDAL easily on your machine.

1
  • Thanks. I installed GDAL using Anaconda on Windows and I haven't had any problem using its functions. The only problem I had is when I tried to call gdal.ViewshedGenerate. – dangimar Sep 12 '20 at 15:44

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.