-
Notifications
You must be signed in to change notification settings - Fork 447
Open
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
Problem description
I am using the isochrones api and realised that there might be an inconsistancy on how ferry-lines are treated when asking for a walking-isochrone, depending on wether the source point is on water or not. If on water within the Kiel harbor, I can easily walk to the other side of the baltic sea (by ferry, and far longer then the defined walking-limit). But when I ran the same algorithm from land (50m next to it) I only reach the asked distance into the sea (on the ferry line).
Proposed solution
Handle both cases the same (preferably stay within limits).
Additional context
This is small script reproducing the issue from within the qgis-python-console (using the qgis-plugin, though error comes from api, i think):
import processing
from qgis.core import (
QgsVectorLayer,
QgsFeature,
QgsGeometry,
QgsPointXY,
QgsProject,
QgsFields,
QgsField
)
from PyQt5.QtCore import QVariant
# Punktkoordinaten (Längengrad, Breitengrad)
coordinatepairs = (
(10.170385,54.336271),
(10.166104, 54.336526)
)
# Memory-Layer erstellen
layer = QgsVectorLayer("Point?crs=EPSG:4326", "Startpunkt", "memory")
prov = layer.dataProvider()
# Attributfeld hinzufügen (z. B. für Walk_ID)
prov.addAttributes([QgsField("Walk_ID", QVariant.String)])
layer.updateFields()
for i, (lon, lat) in enumerate(coordinatepairs):
# Feature mit Punkt und Attribut erstellen
feat = QgsFeature()
feat.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(lon, lat)))
feat.setAttributes([f"Start_{i}"])
prov.addFeature(feat)
# Layer aktualisieren und zur Karte hinzufügen
layer.updateExtents()
QgsProject.instance().addMapLayer(layer)
# Name des Layers wie in QGIS (muss exakt übereinstimmen)
layer_name = "Startpunkt"
# Layer-Objekt holen
point_layer = QgsProject.instance().mapLayersByName(layer_name)[0]
# Isochronen berechnen (Distanz: 2000 Meter, Profil: Fußgänger, ohne Fähren)
result = processing.run(
"ORS Tools:isochrones_from_layer",
{
"INPUT_PROVIDER": 0,
"INPUT_PROFILE": 6, # foot-walking
"INPUT_POINT_LAYER": point_layer,
"INPUT_FIELD": "Walk_ID",
"INPUT_METRIC": 1, # 1 = Distanz
"INPUT_RANGES": "2000",
"INPUT_SMOOTHING": None,
"LOCATION_TYPE": 0, # Startpunkt
"INPUT_AVOID_FEATURES": [],
"INPUT_AVOID_BORDERS": None,
"INPUT_AVOID_COUNTRIES": "",
"INPUT_AVOID_POLYGONS": None,
"OUTPUT": "memory:" # temporärer Layer
}
)
# Ergebnis-Layer zur Karte hinzufügen
QgsProject.instance().addMapLayer(result["OUTPUT"])
Forum Topic Link
No response