nilsnolde / valhalla-qgis-plugin

QGIS plugin to use Valhalla for routing, isochrones and matrices.
GNU General Public License v3.0
12 stars 3 forks source link

Isochrones not working on 2.4.0 #9

Closed e-shirt closed 1 year ago

e-shirt commented 1 year ago

I am not able to produce isochrones since updating to 2.4.0. I get errors I assume have something to do with Python, but I am nowhere able to solve the issue on my own as I don't know Python.

I have tested both bycicle and pedestrian isochrones. I worked with a shapefile single point layer, that has worked before. I have tested with QGIS 3.28.0 and 3.30.1.

Here is the log (disguised personal data with ###):


QGIS-Codeversion: 9035a01e
Qt-Version: 5.15.3
Python-Version: 3.9.5
GDAL-Version: 3.6.3
GEOS-Version: 3.11.2-CAPI-1.17.2
PROJ-Version: Rel. 9.2.0, March 1st, 2023
PDAL-Version: 2.5.2 (git-version: 57c4e7)
Algorithmus gestartet um: 2023-04-28T09:05:58
Algorithmus Isochrones Pedestrian startet…
Eingabeparameter:
{ 'INPUT_FIELD' : 'osm_id', 'INPUT_MODE' : 0, 'INPUT_POINT_LAYER' : '###.shp|layername=###', 'INPUT_PROVIDER' : 1, 'alley_factor' : None, 'avoid_locations' : None, 'contours' : '', 'contours_distance' : '0.3', 'denoise' : '', 'driveway_factor' : None, 'generalize' : '', 'max_hiking_difficulty' : None, 'polygons' : 0, 'show_locations' : False, 'use_ferry' : None, 'walkway_factor' : None, 'weight' : None }

Traceback (most recent call last):
File "C:\Users/###/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\valhalla\proc\isochrones\isochrones_layer_auto.py", line 395, in processAlgorithm
response = clnt.request('/isochrone', post_json=params)
File "C:\Users/###/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\valhalla\common\client.py", line 126, in request
body = QJsonDocument.fromJson(json.dumps(post_json).encode())
File "C:\PROGRA~1\QGIS33~1.1\apps\Python39\lib\json\__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "C:\PROGRA~1\QGIS33~1.1\apps\Python39\lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\PROGRA~1\QGIS33~1.1\apps\Python39\lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\PROGRA~1\QGIS33~1.1\apps\Python39\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type QVariant is not JSON serializable

Execution failed after 49.13 Sekunden

Lade Ergebnis Layer
Algorithmus 'Isochrones Pedestrian' beendet```
nilsnolde commented 1 year ago

Thanks for reporting, I'll have a quick look when sitting in the train and upload a new version.

nilsnolde commented 1 year ago

Hm, I can't reproduce the bug. I just fail to see how this can happen.. Is it possible to share a file that reproduces the problem?

e-shirt commented 1 year ago

I played around a bit more and found the problem: I had used a dataset extracted from OSM and then added two points myself. I didn't enter IDs for the new points and that got the plugin confused. After giving them IDs, it worked fine.

In a case like this, a more comprehensive error message could be useful.