Skip to content

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

Open
@Erudition

Description

@Erudition

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

  • Okay: add this limitation to the documentation
  • Good: improve the error message, say exactly what went wrong
  • Better: Enforce the limit in the UI, don't let more than 10 ranges be entered in the textbox
  • Best: Remove the limitation, which seems to have something to do with code trying to pick default colors for the 11th (index 10) isochrone and up

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions