diff --git a/CHANGELOG.md b/CHANGELOG.md
index cdbbbb44..4f8e9bc8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -42,6 +42,7 @@ RELEASING:
## Unreleased
### Added
+- Additional parameter for the "smoothing factor" to isochrones processing algorithms ([#172](https://github.com/GIScience/orstools-qgis-plugin/issues/172))
- Mention omission of configuration options when using traveling salesman
## [1.6.0] - 2023-07-25
@@ -50,7 +51,6 @@ RELEASING:
- translation mechanism ([#183](https://github.com/GIScience/orstools-qgis-plugin/pull/183))
- german translation ([#183](https://github.com/GIScience/orstools-qgis-plugin/pull/183))
-
## [1.5.3] - 2023-03-30
### Fixed
diff --git a/ORStools/common/__init__.py b/ORStools/common/__init__.py
index 60314a51..5dbffe60 100644
--- a/ORStools/common/__init__.py
+++ b/ORStools/common/__init__.py
@@ -54,4 +54,5 @@
"INPUT_AVOID_BORDERS",
"INPUT_AVOID_COUNTRIES",
"INPUT_AVOID_POLYGONS",
+ "INPUT_SMOOTHING",
]
diff --git a/ORStools/i18n/orstools_de.qm b/ORStools/i18n/orstools_de.qm
index 3bd0286f..1185a507 100644
Binary files a/ORStools/i18n/orstools_de.qm and b/ORStools/i18n/orstools_de.qm differ
diff --git a/ORStools/i18n/orstools_de.ts b/ORStools/i18n/orstools_de.ts
index 61f669aa..8707ee41 100644
--- a/ORStools/i18n/orstools_de.ts
+++ b/ORStools/i18n/orstools_de.ts
@@ -165,53 +165,63 @@
ORSIsochronesLayerAlgo
-
+
Eingabelayer (Punkte)
-
+
ID-Attribut (schließt Punkt-Option aus)
-
+
Dimension
-
+
Komma-getrennte Reichweiten [min oder m]
-
+
Isochronen aus Punkt-Layer
+
+
+
+ Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert]
+
ORSIsochronesPointAlgo
-
+
Eingabepunkt aus Kartenansicht (schließt Ebenen-Option aus)
-
+
Dimension
-
+
Komma-getrennte Reichweiten [min oder m]
-
+
Isochronen von einzelnem Punkt
+
+
+
+ Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert]
+
ORSMatrixAlgo
@@ -244,12 +254,12 @@
ORStoolsDialog
-
+
Anwenden
-
+
Schließen
diff --git a/ORStools/proc/isochrones_layer_proc.py b/ORStools/proc/isochrones_layer_proc.py
index 50b40412..f44cdc6b 100644
--- a/ORStools/proc/isochrones_layer_proc.py
+++ b/ORStools/proc/isochrones_layer_proc.py
@@ -37,6 +37,8 @@
QgsProcessingParameterFeatureSource,
QgsProcessingParameterString,
QgsProcessingParameterEnum,
+ QgsProcessingParameterNumber,
+ QgsProcessingParameterDefinition,
)
from ORStools.common import isochrones_core, PROFILES, DIMENSIONS
@@ -57,6 +59,7 @@ def __init__(self):
self.IN_RANGES = "INPUT_RANGES"
self.IN_KEY = "INPUT_APIKEY"
self.IN_DIFFERENCE = "INPUT_DIFFERENCE"
+ self.IN_SMOOTHING = "INPUT_SMOOTHING"
self.PARAMETERS = [
QgsProcessingParameterFeatureSource(
name=self.IN_POINTS,
@@ -84,6 +87,14 @@ def __init__(self):
description=self.tr("Comma-separated ranges [min or m]"),
defaultValue="5, 10",
),
+ QgsProcessingParameterNumber(
+ name=self.IN_SMOOTHING,
+ description=self.tr("Smoothing factor between 0 [detailed] and 100 [generalized]"),
+ defaultValue=None,
+ minValue=0,
+ maxValue=100,
+ optional=True,
+ ),
]
# Save some important references
@@ -104,10 +115,12 @@ def processAlgorithm(self, parameters, context, feedback):
factor = 60 if dimension == "time" else 1
ranges_raw = parameters[self.IN_RANGES]
ranges_proc = [x * factor for x in map(int, ranges_raw.split(","))]
+ smoothing = parameters[self.IN_SMOOTHING]
# self.difference = self.parameterAsBool(parameters, self.IN_DIFFERENCE, context)
source = self.parameterAsSource(parameters, self.IN_POINTS, context)
+ # get smoothness parameter value
options = self.parseOptions(parameters, context)
# Make the actual requests
@@ -131,16 +144,20 @@ def processAlgorithm(self, parameters, context, feedback):
if feedback.isCanceled():
break
- requests.append(
- {
- "locations": locations,
- "range_type": dimension,
- "range": ranges_proc,
- "attributes": ["total_pop"],
- "id": id_value,
- "options": options,
- }
- )
+ params = {
+ "locations": locations,
+ "range_type": dimension,
+ "range": ranges_proc,
+ "attributes": ["total_pop"],
+ "id": id_value,
+ "options": options,
+ }
+
+ # only include smoothing if set
+ if smoothing is not None:
+ params["smoothing"] = smoothing
+
+ requests.append(params)
(sink, self.dest_id) = self.parameterAsSink(
parameters,
diff --git a/ORStools/proc/isochrones_point_proc.py b/ORStools/proc/isochrones_point_proc.py
index ed5d27ce..effd512a 100644
--- a/ORStools/proc/isochrones_point_proc.py
+++ b/ORStools/proc/isochrones_point_proc.py
@@ -34,6 +34,8 @@
QgsProcessingParameterString,
QgsProcessingParameterEnum,
QgsProcessingParameterPoint,
+ QgsProcessingParameterNumber,
+ QgsProcessingParameterDefinition,
)
from ORStools.common import isochrones_core, PROFILES, DIMENSIONS
@@ -52,6 +54,7 @@ def __init__(self):
self.IN_RANGES = "INPUT_RANGES"
self.IN_KEY = "INPUT_APIKEY"
self.IN_DIFFERENCE = "INPUT_DIFFERENCE"
+ self.IN_SMOOTHING = "INPUT_SMOOTHING"
self.PARAMETERS = [
QgsProcessingParameterPoint(
name=self.IN_POINT,
@@ -71,6 +74,14 @@ def __init__(self):
description=self.tr("Comma-separated ranges [min or m]"),
defaultValue="5, 10",
),
+ QgsProcessingParameterNumber(
+ name=self.IN_SMOOTHING,
+ description=self.tr("Smoothing factor between 0 [detailed] and 100 [generalized]"),
+ defaultValue=None,
+ minValue=0,
+ maxValue=100,
+ optional=True,
+ ),
]
# Save some important references
@@ -91,6 +102,7 @@ def processAlgorithm(self, parameters, context, feedback):
factor = 60 if dimension == "time" else 1
ranges_raw = parameters[self.IN_RANGES]
ranges_proc = [x * factor for x in map(int, ranges_raw.split(","))]
+ smoothing = parameters[self.IN_SMOOTHING]
options = self.parseOptions(parameters, context)
@@ -108,6 +120,9 @@ def processAlgorithm(self, parameters, context, feedback):
"options": options,
}
+ if smoothing is not None:
+ params["smoothing"] = smoothing
+
(sink, self.dest_id) = self.parameterAsSink(
parameters,
self.OUT,