diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f8e9bc8..ff378dc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ RELEASING: ### 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 +- option to set location type for isochrones ([#191](https://github.com/GIScience/orstools-qgis-plugin/pull/191)) ## [1.6.0] - 2023-07-25 diff --git a/ORStools/common/__init__.py b/ORStools/common/__init__.py index 5dbffe60..f684c4af 100644 --- a/ORStools/common/__init__.py +++ b/ORStools/common/__init__.py @@ -56,3 +56,5 @@ "INPUT_AVOID_POLYGONS", "INPUT_SMOOTHING", ] + +LOCATION_TYPES = ["start", "destination"] diff --git a/ORStools/help/isochrones_from_layer.help b/ORStools/help/isochrones_from_layer.help index 3c68816b..668fa225 100644 --- a/ORStools/help/isochrones_from_layer.help +++ b/ORStools/help/isochrones_from_layer.help @@ -9,6 +9,8 @@ Current restriction limits< Ranges: parameter needs to be a comma-separated list of integer values, no decimal points. +Location Type: start treats the location(s) as starting point, destination as goal. + Advanced Parameters: see the documentation for descriptions. Output layer: a Polygon layer with ID, isochrone center latitude and longitude, range value, travel mode and total population (from GHSL). diff --git a/ORStools/help/isochrones_from_layer_de.help b/ORStools/help/isochrones_from_layer_de.help index 66dc6a38..15ead1fb 100644 --- a/ORStools/help/isochrones_from_layer_de.help +++ b/ORStools/help/isochrones_from_layer_de.help @@ -10,6 +10,8 @@ Ein gültiger API-Key ('Web'-Menü > 'Dienst-Einstellungen') oder Registrierung Zusätzliche Parameter: Beschreibung in der Dokumentation. +Ortstyp: start behandelt den/die Ort(e) als Startpunkt, destination als Ziel. + Ausgabelayer: Polygonlayer mit ID, Längen- und Breitengrad des Isochronen-Mittelpunkts, Reichweiten-Wert, Verkehrsmittel und Bevölkerung (aus GHSL). KBS ist EPSG:4326. Der Mittelpunkt kann über das Punktlayer aus Tabelle erzeugen-Werkzeug ('Verarbeitungswerkzeuge' ► 'Vektorerzeugung') extrahiert werden. diff --git a/ORStools/help/isochrones_from_point.help b/ORStools/help/isochrones_from_point.help index 18051e8e..5088a78c 100644 --- a/ORStools/help/isochrones_from_point.help +++ b/ORStools/help/isochrones_from_point.help @@ -7,6 +7,8 @@ Current restriction limits< Ranges: parameter needs to be a comma-separated list of integer values, no decimal points. +Location Type: start treats the location(s) as starting point, destination as goal. + Advanced Parameters: see the documentation for descriptions. Output layer: a Polygon layer with ID, isochrone center latitude and longitude, range value, travel mode and total population (from GHSL). diff --git a/ORStools/help/isochrones_from_point_de.help b/ORStools/help/isochrones_from_point_de.help index 37a2ef38..0755e632 100644 --- a/ORStools/help/isochrones_from_point_de.help +++ b/ORStools/help/isochrones_from_point_de.help @@ -8,6 +8,8 @@ Ein gültiger API-Key ('Web'-Menü > 'Dienst-Einstellungen') oder Registrierung Zusätzliche Parameter: Beschreibung in der Dokumentation. +Ortstyp: start behandelt den/die Ort(e) als Startpunkt, destination als Ziel. + Ausgabelayer: Polygonlayer mit ID, Längen- und Breitengrad des Isochronen-Mittelpunkts, Reichweiten-Wert, Verkehrsmittel und Bevölkerung (aus GHSL). KBS ist EPSG:4326. Der Mittelpunkt kann über das Punktlayer aus Tabelle erzeugen-Werkzeug ('Verarbeitungswerkzeuge' ► 'Vektorerzeugung') extrahiert werden. diff --git a/ORStools/i18n/orstools_de.qm b/ORStools/i18n/orstools_de.qm index 1185a507..2e48662e 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 8707ee41..81ab0030 100644 --- a/ORStools/i18n/orstools_de.ts +++ b/ORStools/i18n/orstools_de.ts @@ -165,63 +165,73 @@ ORSIsochronesLayerAlgo - + Input Point layer Eingabelayer (Punkte) - + Input layer ID Field (mutually exclusive with Point option) ID-Attribut (schließt Punkt-Option aus) - + Dimension Dimension - + Comma-separated ranges [min or m] Komma-getrennte Reichweiten [min oder m] - + Isochrones from Point-Layer Isochronen aus Punkt-Layer - + Smoothing factor between 0 [detailed] and 100 [generalized] Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert] + + + Location Type + Ortstyp + ORSIsochronesPointAlgo - + Input Point from map canvas (mutually exclusive with layer option) Eingabepunkt aus Kartenansicht (schließt Ebenen-Option aus) - + Dimension Dimension - + Comma-separated ranges [min or m] Komma-getrennte Reichweiten [min oder m] - + Isochrones from Point Isochronen von einzelnem Punkt - + Smoothing factor between 0 [detailed] and 100 [generalized] Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert] + + + Location Type + Ortstyp + ORSMatrixAlgo @@ -254,12 +264,12 @@ ORStoolsDialog - + Apply Anwenden - + Close Schließen diff --git a/ORStools/proc/isochrones_layer_proc.py b/ORStools/proc/isochrones_layer_proc.py index 656f8c3c..f0582f33 100644 --- a/ORStools/proc/isochrones_layer_proc.py +++ b/ORStools/proc/isochrones_layer_proc.py @@ -40,7 +40,7 @@ QgsProcessingParameterNumber, ) -from ORStools.common import isochrones_core, PROFILES, DIMENSIONS +from ORStools.common import isochrones_core, PROFILES, DIMENSIONS, LOCATION_TYPES from ORStools.proc.base_processing_algorithm import ORSBaseProcessingAlgorithm from ORStools.utils import transform, exceptions, logger @@ -60,6 +60,7 @@ def __init__(self): self.IN_DIFFERENCE = "INPUT_DIFFERENCE" self.USE_SMOOTHING = "USE_SMOOTHING" self.IN_SMOOTHING = "INPUT_SMOOTHING" + self.LOCATION_TYPE = "LOCATION_TYPE" self.PARAMETERS = [ QgsProcessingParameterFeatureSource( name=self.IN_POINTS, @@ -95,6 +96,12 @@ def __init__(self): maxValue=100, optional=True, ), + QgsProcessingParameterEnum( + name=self.LOCATION_TYPE, + description=self.tr("Location Type"), + options=LOCATION_TYPES, + defaultValue=LOCATION_TYPES[0], + ), ] # Save some important references @@ -111,6 +118,7 @@ def processAlgorithm(self, parameters, context, feedback): profile = dict(enumerate(PROFILES))[parameters[self.IN_PROFILE]] dimension = dict(enumerate(DIMENSIONS))[parameters[self.IN_METRIC]] + location_type = dict(enumerate(LOCATION_TYPES))[parameters[self.LOCATION_TYPE]] factor = 60 if dimension == "time" else 1 ranges_raw = parameters[self.IN_RANGES] @@ -151,6 +159,7 @@ def processAlgorithm(self, parameters, context, feedback): "attributes": ["total_pop"], "id": id_value, "options": options, + "location_type": location_type, } # only include smoothing if set diff --git a/ORStools/proc/isochrones_point_proc.py b/ORStools/proc/isochrones_point_proc.py index 9017b95b..1eb30ddc 100644 --- a/ORStools/proc/isochrones_point_proc.py +++ b/ORStools/proc/isochrones_point_proc.py @@ -37,7 +37,7 @@ QgsProcessingParameterNumber, ) -from ORStools.common import isochrones_core, PROFILES, DIMENSIONS +from ORStools.common import isochrones_core, PROFILES, DIMENSIONS, LOCATION_TYPES from ORStools.utils import exceptions, logger from .base_processing_algorithm import ORSBaseProcessingAlgorithm @@ -54,6 +54,7 @@ def __init__(self): self.IN_KEY = "INPUT_APIKEY" self.IN_DIFFERENCE = "INPUT_DIFFERENCE" self.IN_SMOOTHING = "INPUT_SMOOTHING" + self.LOCATION_TYPE = "LOCATION_TYPE" self.PARAMETERS = [ QgsProcessingParameterPoint( name=self.IN_POINT, @@ -81,6 +82,12 @@ def __init__(self): maxValue=100, optional=True, ), + QgsProcessingParameterEnum( + name=self.LOCATION_TYPE, + description=self.tr("Location Type"), + options=LOCATION_TYPES, + defaultValue=LOCATION_TYPES[0], + ), ] # Save some important references @@ -97,6 +104,7 @@ def processAlgorithm(self, parameters, context, feedback): profile = dict(enumerate(PROFILES))[parameters[self.IN_PROFILE]] dimension = dict(enumerate(DIMENSIONS))[parameters[self.IN_METRIC]] + location_type = dict(enumerate(LOCATION_TYPES))[parameters[self.LOCATION_TYPE]] factor = 60 if dimension == "time" else 1 ranges_raw = parameters[self.IN_RANGES] @@ -117,6 +125,7 @@ def processAlgorithm(self, parameters, context, feedback): "attributes": ["total_pop"], "id": None, "options": options, + "location_type": location_type, } if smoothing or smoothing == 0: