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

Change isochrone renderer to QgsGraduatedSymbolRenderer to support more than 10 colors #265

Open merydian opened 1 month ago

merydian commented 1 month ago

To log the correct ApiError message in the isochrone processing algorithm window, when there are more than 10 ranges inputted.

Otherwise this will be printed:


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```
koebi commented 3 weeks ago

I think the limit of 10 ranges only exists for the public API. For this, we should see that a useful error is reported when trying more than 10 isochrones. For everything else, we should implement some sort of cycling through colors, or using random colors when over 10.

merydian commented 3 weeks ago

Current implementation uses QgsGraduatedSymbolRenderer with Spectral color ramp. The amount of possible ranges is no longer limited like this.

20 ranges: image