Closed zoran-cuckovic closed 8 years ago
Hello, I'm using "Viewshep analysis" functioning well in version 0.4.2 "QGIS 2.16.1-Nødebo". But the current stable version 0.5.2 on "QGIS 2.16.1-Nødebo" giving me errors. I reported the following error. Using the parameters:
Elevation raster: MDT_1050_100_WGS_84_30S Observation points: nucleos_1050_100_WGS_84_30S Output file: Save the result as "Cuenca" (for example) Search radius: 5000 Observer heigth: Indicates the HEIGHT field (which keeps the height of each point of observation) Output: Binary viewshed Options: Cumulative (for raster output) (thus generate cumulative visibility).
Returning the error:
Ha ocurrido un error mientras se ejecutaba el código de Python:
TypeError: Cannot cast ufunc subtract input from dtype('float64') to dtype('int64') with casting rule 'same_kind' Traceback (most recent call last): File "/home/valero/.qgis2/python/plugins/ViewshedAnalysis/viewshedanalysis.py", line 197, in run Algo) File "/home/valero/.qgis2/python/plugins/ViewshedAnalysis/doViewshed.py", line 443, in Viewshed mx_x_rev = numpy.subtract ( t[:,:,1], (t[:,:,1]-x0) *2 , dtype=int ) TypeError: Cannot cast ufunc subtract input from dtype('float64') to dtype('int64') with casting rule 'same_kind'
Versión de Python: 2.7.12+ (default, Aug 4 2016, 20:04:34) [GCC 6.1.1 20160724] Versión de QGIS: 2.16.1-Nødebo Nødebo, 8545b3b
Ruta de Python: /usr/share/qgis/python/plugins/processing /usr/share/qgis/python /home/valero/.qgis2/python /home/valero/.qgis2/python/plugins /usr/share/qgis/python/plugins /usr/lib/python2.7 /usr/lib/python2.7/plat-x86_64-linux-gnu /usr/lib/python2.7/lib-tk /usr/lib/python2.7/lib-old /usr/lib/python2.7/lib-dynload /usr/local/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages/PILcompat /usr/lib/python2.7/dist-packages/gtk-2.0 /usr/lib/python2.7/dist-packages/wx-3.0-gtk2 /home/valero/.qgis2//python /home/valero/aprender_qgis/Viewshed_QGIS
Attached files Viewshed_QGIS.zip
Greetings.
Hello!
It seems that there are some problems with the latest QGIS version : on 2.8 it should work. I will take a look this weekend.
Regards.
2016-08-17 14:11 GMT+02:00 diofantico notifications@github.com:
Hello, I'm using "Viewshep analysis" functioning well in version 0.4.2 "QGIS 2.16.1-Nødebo". But the current stable version 0.5.2 on "QGIS 2.16.1-Nødebo" giving me errors. I reported the following error. Using the parameters:
Elevation raster: MDT_1050_100_WGS_84_30S Observation points: nucleos_1050_100_WGS_84_30S Output file: Save the result as "Cuenca" (for example) Search radius: 5000 Observer heigth: Indicates the HEIGHT field (which keeps the height of each point of observation) Output: Binary viewshed Options: Cumulative (for raster output) (thus generate cumulative visibility).
Returning the error:
Ha ocurrido un error mientras se ejecutaba el código de Python:
TypeError: Cannot cast ufunc subtract input from dtype('float64') to dtype('int64') with casting rule 'same_kind' Traceback (most recent call last): File "/home/valero/.qgis2/python/plugins/ViewshedAnalysis/viewshedanalysis.py", line 197, in run Algo) File "/home/valero/.qgis2/python/plugins/ViewshedAnalysis/doViewshed.py", line 443, in Viewshed mx_x_rev = numpy.subtract ( t[:,:,1], (t[:,:,1]-x0) *2 , dtype=int ) TypeError: Cannot cast ufunc subtract input from dtype('float64') to dtype('int64') with casting rule 'same_kind'
Versión de Python: 2.7.12+ (default, Aug 4 2016, 20:04:34) [GCC 6.1.1 20160724] Versión de QGIS: 2.16.1-Nødebo Nødebo, 8545b3b
Ruta de Python: /usr/share/qgis/python/plugins/processing /usr/share/qgis/python /home/valero/.qgis2/python /home/valero/.qgis2/python/plugins /usr/share/qgis/python/plugins /usr/lib/python2.7 /usr/lib/python2.7/plat-x86_64-linux-gnu /usr/lib/python2.7/lib-tk /usr/lib/python2.7/lib-old /usr/lib/python2.7/lib-dynload /usr/local/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages/PILcompat /usr/lib/python2.7/dist-packages/gtk-2.0 /usr/lib/python2.7/dist-packages/wx-3.0-gtk2 /home/valero/.qgis2//python /home/valero/aprender_qgis/Viewshed_QGIS
Attached files Viewshed_QGIS.zip https://github.com/zoran-cuckovic/QGIS-visibility-analysis/files/422522/Viewshed_QGIS.zip
Greetings.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zoran-cuckovic/QGIS-visibility-analysis/issues/2#issuecomment-240392981, or mute the thread https://github.com/notifications/unsubscribe-auth/AGUO1tq3mcR9VfUN08QW_fgU4aEle4Ddks5qgvqBgaJpZM4JlbFL .
Zoran Čučković zoran-cuckovic.from.hr
@diofantico Hello! I tested the thing on QGIS 2.14 - and it still works. It has to be an issue with newer numpy libraries in 2.16.
The error says number formats are not matching (which is usually automatically handled by numpy). I found a spot which seems to be the problem, and I fixed it (the latest commit to doViewshed module). But I don't have QGIS 2.16 (and don't feel like installing it) - is it possible that you test the patch? If it works, I will publish a new plugin version.
All you need to do is to replace doViewshed.py module with the new one and (re)start QGIS. (do a file search or find it in {your home folder}.qgis2/python/plugins/ViewshedAnalysis folder.
(or you can copy paste two changed lines of code (443 and 444))
Thanks a lot!
This problem should be resolved in 0.5.3 version.
You've done a great job. The first tests work perfectly. Thank you.
2016-08-18 19:55 GMT+02:00 Zoran Čučković notifications@github.com:
This problem should be resolved in 0.5.3 version.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zoran-cuckovic/QGIS-visibility-analysis/issues/2#issuecomment-240803467, or mute the thread https://github.com/notifications/unsubscribe-auth/AUGpiAF5Pb3G9EiDt8ELEzi4M-9kLWNrks5qhJx7gaJpZM4JlbFL .
Some people reported problems with newer QGIS versions (2.16) while 2.8 works fine. To be checked ...