GIScience / orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice API´s, based on openstreetmap
https://plugins.qgis.org/plugins/ORStools/
MIT License
91 stars 31 forks source link

Undocumented limit of 10 isochrone ranges (KeyError: 10) #264

Open Erudition opened 1 month ago

Erudition commented 1 month ago

Example: Generating an isochrone heatmap for driving distance from Compressed Natural Gas stations in North America. Ideally I want 10,20,30...150 mile increments.

Here's what I did

QGIS version: 3.30.1-'s-Hertogenbosch
Qt version: 5.15.10
Python version: 3.10.7
GDAL version: 3.6.1
GEOS version: 3.12.1-CAPI-1.18.1
PROJ version: Rel. 9.3.1, December 1st, 2023
Algorithm started at: 2024-05-30T23:49:27
Algorithm 'Isochrones from Point-Layer' starting…
Input parameters:
{ 'INPUT_AVOID_BORDERS' : None, 'INPUT_AVOID_COUNTRIES' : '', 'INPUT_AVOID_FEATURES' : [], 'INPUT_AVOID_POLYGONS' : None, 'INPUT_FIELD' : 'ID', 'INPUT_METRIC' : 1, 'INPUT_POINT_LAYER' : QgsProcessingFeatureSourceDefinition('file:///home/adroit/Downloads/alt_fuel_stations%20(May%2030%202024).csv?type=csv&maxFields=10000&detectTypes=yes&xField=Longitude&yField=Latitude&crs=EPSG:4326&spatialIndex=no&subsetIndex=no&watchFile=no', selectedFeaturesOnly=True, featureLimit=-1, flags=QgsProcessingFeatureSourceDefinition.FlagOverrideDefaultGeometryCheck | QgsProcessingFeatureSourceDefinition.FlagCreateIndividualOutputPerInputFeature, geometryCheck=QgsFeatureRequest.GeometrySkipInvalid), 'INPUT_PROFILE' : 0, 'INPUT_PROVIDER' : 0, 'INPUT_RANGES' : '16093,\n32187,\n48280,\n64374,\n80467,\n96561, 112654,\n128748,\n144841,\n160934, 177028', 'INPUT_SMOOTHING' : 0, 'LOCATION_TYPE' : 1, 'OUTPUT' : '/media/adroit/Extreme SSD/Mapping/station-isochrones-bottom-only-allmiles.gpkg' }

Executing iteration 1/166…

Here's what I got

Traceback (most recent call last):
File "/home/adroit/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ORStools/proc/isochrones_layer_proc.py", line 218, in postProcessAlgorithm
self.isochrones.stylePoly(processed_layer)
File "/home/adroit/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ORStools/common/isochrones_core.py", line 208, in stylePoly
color=colors[cid], strokeColor=QColor("#000000")
KeyError: 10

This appears on every iteration, so long as there is more than 10 ranges in the range field. It does not occur when there is less than 10.


Here's what I was expecting

The isochrones to be generated for 11+ ranges the same way it works fine for 10 or less.


Here's what I think could be improved

merydian commented 1 month ago

Hi, the interval limitation is documented under: https://openrouteservice.org/restrictions/ . Yet, as you imply, the error logging can be improved and there seems to be an inconsistency with the naming for ranges/intervals. So thanks for posting about this. We'll look into it.

Erudition commented 3 weeks ago

Thanks! I'm running ORS locally, since my project doesn't fit within those restrictions.