Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

171 isochrone center cannot be set as destination #191

Merged
merged 7 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions ORStools/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@
"INPUT_AVOID_POLYGONS",
"INPUT_SMOOTHING",
]

LOCATION_TYPES = ["start", "destination"]
2 changes: 2 additions & 0 deletions ORStools/help/isochrones_from_layer.help
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Current <a href="https://openrouteservice.org/restrictions/">restriction limits<

<i>Ranges</i>: parameter needs to be a comma-separated list of integer values, no decimal points.

<i>Location Type</i>: start treats the location(s) as starting point, destination as goal.

<i>Advanced Parameters</i>: see <a href="https://giscience.github.io/openrouteservice/documentation/routing-options/Routing-Options.html">the documentation</a> for descriptions.

<i>Output layer</i>: a Polygon layer with ID, isochrone center latitude and longitude, range value, travel mode and total population (from <a href="https://ghsl.jrc.ec.europa.eu/about.php">GHSL</a>).
Expand Down
2 changes: 2 additions & 0 deletions ORStools/help/isochrones_from_layer_de.help
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Ein gültiger API-Key ('Web'-Menü > 'Dienst-Einstellungen') oder Registrierung

<i>Zusätzliche Parameter</i>: Beschreibung in der <a href="https://giscience.github.io/openrouteservice/documentation/routing-options/Routing-Options.html">Dokumentation</a>.

<i>Ortstyp</i>: start behandelt den/die Ort(e) als Startpunkt, destination als Ziel.

<i>Ausgabelayer</i>: Polygonlayer mit ID, Längen- und Breitengrad des Isochronen-Mittelpunkts, Reichweiten-Wert, Verkehrsmittel und Bevölkerung (aus <a href="https://ghsl.jrc.ec.europa.eu/about.php">GHSL</a>). KBS ist EPSG:4326.

Der Mittelpunkt kann über das <code>Punktlayer aus Tabelle erzeugen</code>-Werkzeug ('Verarbeitungswerkzeuge' ► 'Vektorerzeugung') extrahiert werden.
Expand Down
2 changes: 2 additions & 0 deletions ORStools/help/isochrones_from_point.help
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Current <a href="https://openrouteservice.org/restrictions/">restriction limits<

<i>Ranges</i>: parameter needs to be a comma-separated list of integer values, no decimal points.

<i>Location Type</i>: start treats the location(s) as starting point, destination as goal.

<i>Advanced Parameters</i>: see <a href="https://giscience.github.io/openrouteservice/documentation/routing-options/Routing-Options.html">the documentation</a> for descriptions.

<i>Output layer</i>: a Polygon layer with ID, isochrone center latitude and longitude, range value, travel mode and total population (from <a href="https://ghsl.jrc.ec.europa.eu/about.php">GHSL</a>).
Expand Down
2 changes: 2 additions & 0 deletions ORStools/help/isochrones_from_point_de.help
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Ein gültiger API-Key ('Web'-Menü > 'Dienst-Einstellungen') oder Registrierung

<i>Zusätzliche Parameter</i>: Beschreibung in der <a href="https://giscience.github.io/openrouteservice/documentation/routing-options/Routing-Options.html">Dokumentation</a>.

<i>Ortstyp</i>: start behandelt den/die Ort(e) als Startpunkt, destination als Ziel.

<i>Ausgabelayer</i>: Polygonlayer mit ID, Längen- und Breitengrad des Isochronen-Mittelpunkts, Reichweiten-Wert, Verkehrsmittel und Bevölkerung (aus <a href="https://ghsl.jrc.ec.europa.eu/about.php">GHSL</a>). KBS ist EPSG:4326.

Der Mittelpunkt kann über das <code>Punktlayer aus Tabelle erzeugen</code>-Werkzeug ('Verarbeitungswerkzeuge' ► 'Vektorerzeugung') extrahiert werden.
Expand Down
Binary file modified ORStools/i18n/orstools_de.qm
Binary file not shown.
36 changes: 23 additions & 13 deletions ORStools/i18n/orstools_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,63 +165,73 @@
<context>
<name>ORSIsochronesLayerAlgo</name>
<message>
<location filename="../proc/isochrones_layer_proc.py" line="64"/>
<location filename="../proc/isochrones_layer_proc.py" line="67"/>
<source>Input Point layer</source>
<translation>Eingabelayer (Punkte)</translation>
</message>
<message>
<location filename="../proc/isochrones_layer_proc.py" line="73"/>
<location filename="../proc/isochrones_layer_proc.py" line="76"/>
<source>Input layer ID Field (mutually exclusive with Point option)</source>
<translation>ID-Attribut (schließt Punkt-Option aus)</translation>
</message>
<message>
<location filename="../proc/isochrones_layer_proc.py" line="79"/>
<location filename="../proc/isochrones_layer_proc.py" line="82"/>
<source>Dimension</source>
<translation>Dimension</translation>
</message>
<message>
<location filename="../proc/isochrones_layer_proc.py" line="85"/>
<location filename="../proc/isochrones_layer_proc.py" line="88"/>
<source>Comma-separated ranges [min or m]</source>
<translation>Komma-getrennte Reichweiten [min oder m]</translation>
</message>
<message>
<location filename="../proc/isochrones_layer_proc.py" line="225"/>
<location filename="../proc/isochrones_layer_proc.py" line="236"/>
<source>Isochrones from Point-Layer</source>
<translation>Isochronen aus Punkt-Layer</translation>
</message>
<message>
<location filename="../proc/isochrones_layer_proc.py" line="90"/>
<location filename="../proc/isochrones_layer_proc.py" line="93"/>
<source>Smoothing factor between 0 [detailed] and 100 [generalized]</source>
<translation>Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert]</translation>
</message>
<message>
<location filename="../proc/isochrones_layer_proc.py" line="100"/>
<source>Location Type</source>
<translation>Ortstyp</translation>
</message>
</context>
<context>
<name>ORSIsochronesPointAlgo</name>
<message>
<location filename="../proc/isochrones_point_proc.py" line="58"/>
<location filename="../proc/isochrones_point_proc.py" line="62"/>
<source>Input Point from map canvas (mutually exclusive with layer option)</source>
<translation>Eingabepunkt aus Kartenansicht (schließt Ebenen-Option aus)</translation>
</message>
<message>
<location filename="../proc/isochrones_point_proc.py" line="63"/>
<location filename="../proc/isochrones_point_proc.py" line="68"/>
<source>Dimension</source>
<translation>Dimension</translation>
</message>
<message>
<location filename="../proc/isochrones_point_proc.py" line="69"/>
<location filename="../proc/isochrones_point_proc.py" line="74"/>
<source>Comma-separated ranges [min or m]</source>
<translation>Komma-getrennte Reichweiten [min oder m]</translation>
</message>
<message>
<location filename="../proc/isochrones_point_proc.py" line="163"/>
<location filename="../proc/isochrones_point_proc.py" line="172"/>
<source>Isochrones from Point</source>
<translation>Isochronen von einzelnem Punkt</translation>
</message>
<message>
<location filename="../proc/isochrones_point_proc.py" line="74"/>
<location filename="../proc/isochrones_point_proc.py" line="79"/>
<source>Smoothing factor between 0 [detailed] and 100 [generalized]</source>
<translation>Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert]</translation>
</message>
<message>
<location filename="../proc/isochrones_point_proc.py" line="86"/>
<source>Location Type</source>
<translation>Ortstyp</translation>
</message>
</context>
<context>
<name>ORSMatrixAlgo</name>
Expand Down Expand Up @@ -254,12 +264,12 @@
<context>
<name>ORStoolsDialog</name>
<message>
<location filename="../gui/ORStoolsDialog.py" line="392"/>
<location filename="../gui/ORStoolsDialog.py" line="390"/>
<source>Apply</source>
<translation>Anwenden</translation>
</message>
<message>
<location filename="../gui/ORStoolsDialog.py" line="393"/>
<location filename="../gui/ORStoolsDialog.py" line="391"/>
<source>Close</source>
<translation>Schließen</translation>
</message>
Expand Down
11 changes: 10 additions & 1 deletion ORStools/proc/isochrones_layer_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion ORStools/proc/isochrones_point_proc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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:
Expand Down