root676 / QNEAT3

QNEAT3 - Qgis Network Analysis Toolbox 3
GNU General Public License v3.0
63 stars 12 forks source link

TypeError: must be a real number in QGIS 3.10 #22

Closed merkato closed 4 years ago

merkato commented 4 years ago

After updating to QGIS3.10 today QNEAT3 crashes with

[QNEAT3Algorithm] Calculating Iso-Pointcloud... [QNEAT3Network][calcIsoPoints] Processing Point 0 TypeError: must be real number, not QgsPointXY

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/mechanik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QNEAT3/algs/IsoAreaAsPointcloudFromLayer.py", line 228, in processAlgorithm iso_pointcloud = net.calcIsoPoints(list_apoints, max_dist) File "/home/mechanik/.local/share/QGIS/QGIS3/profiles/default/python/plugins/QNEAT3/Qneat3Framework.py", line 197, in calcIsoPoints pt_m = QgsPoint(self.network.vertex(current_vertex_id).point()) SystemError: <class 'qgis._core.QgsPoint'> returned a result with an error set

In QGIS 3.8 same dataset calculates as an charm :)

root676 commented 4 years ago

Hi @merkato ! Thank you for reporting this issue - I can confirm that QNEAT3 is currently broken with QGIS 3.10. The bug seems to be caused by a change in the QgsPoint() API which currently doesn't except QgsPointXY() objects. This can be tested by opening the python console in QGIS and typing pt = QgsPoint(QgsPointXY(1,2)) which yields same error as you experience. I will try to publish a fix based on changing the line to something like pt = QgsPoint(QgsPointXY(1,2).x(), QgsPointXY(1,2).y()) (which works) and filing a bug ticket at the QGIS repository. I will keep you posted.

root676 commented 4 years ago

I just pushed a solution to the QNEAT3 repo. Could you clone the repo and test with the fix? It works on my machine. If it also works for you I will release a new QNEAT3 version to plugins.qgis.org.

merkato commented 4 years ago

Works for me :) Thanks @root676 !!

root676 commented 4 years ago

Nice! I just uploaded the new version, waiting for approval from QGIS.

root676 commented 4 years ago

The new version of QNEAT3 has been approved by the QGIS devs and is available for download in the QGIS plugin manager. Additionally, a bugfix for the QGIS API has been pushed to the QGIS master branch (bugfixing in less than 24 hours - cudos to the QGIS devs!).