zoran-cuckovic / QGIS-visibility-analysis

Quantum GIS plugin for visibility analysis
GNU General Public License v3.0
72 stars 17 forks source link

FloatingPointError: divide by zero encountered in true_divide #35

Closed Ben19Foster closed 4 years ago

Ben19Foster commented 4 years ago

Hi Zoran,

I am trying to create a viewshed using the graphical modeler, the first part of creating the viewpoints works fine, however when I create the viewshed I get the following error. Also, when I do the exact same process outside of graphical modeler it works fine. Viewshed Error

Traceback (most recent call last):

File"C:/Users/Ben/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\viewshed_raster.py", line 245, in processAlgorithm interpolate = precision > 0) File"C:/Users/Ben/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ViewshedAnalysis\algorithms\modules\visibility.py", line 178, in viewshed_raster data /= distance_matrix #all one line = (data -z - mxcurv) /mx_dist FloatingPointError: divide by zero encountered in true_divide

Error encountered while running Viewshed

zoran-cuckovic commented 4 years ago

Hello, you have quite a complex routine, many things could go wrong... There seems to be a zero viewshed radius somewhere (division by zero error). I can't tell where this could come from. (Perhaps if you attach your model I might be able to test the thing).

Ben19Foster commented 4 years ago

Hello,

The create viewpoints seems to work fine, it’s the viewshed part that’s the problem; I have even tried creating the viewpoints first outside of the modeler, leaving just the viewshed algorithm in the modeler, but it still comes up with the same error.

I can't seem to attach the model, I tried emailing it as a zip file but don't think it worked, how do I do this?

Ben19Foster commented 4 years ago

Hello,

I've copy and pasted the script into a PDF, let me know if it doesn't work and I will try something else.

Viewshed Script.pdf

zoran-cuckovic commented 4 years ago

Hello, I can't tell what is wrong here... If you're trying to create a cumulative viewshed from a point-grid, I've attached here a model which should work : test_cumulative_viewshed.zip As an image : cumulative_image Hope this would help!