Hey guys,
after hours of trying to setup ORS locally I finally did it, thanks to several userposts in this forum!
Why local hosted ORS? I need Isochrones with a range of 200km visualized in QGIS.
And that’s where I am stuck right now, I tried running following code to get the Isochrones output I wanted:
import openrouteservice
from openrouteservice import deprecation
def isochrones(client=openrouteservice.Client(base_url='http://localhost:8080/ors'), locations=[[14.162796109871262,48.203382783725814],[16.42160798287258,48.160371565752406],[13.658039698281591,47.99687474740676],[15.72673088284164,47.09050859090878],[14.210175155693273,47.568733368730534]],
profile='driving-hgv',
range_type='distance',
range=200000,
intervals=10000,
segments=None,
interval=None,
units=None,
location_type=None,
smoothing=None,
attributes=None,
validate=True,
dry_run=None):
params = {
"locations": locations
}
if profile:
params["profile"] = profile
if range_type:
params["range_type"] = range_type
if intervals:
deprecation.warning('intervals', 'range')
range = range or intervals
params['range'] = range
if segments:
deprecation.warning('segments', 'interval')
interval = interval or segments
if interval:
params['interval'] = interval
if units:
params["units"] = units
if location_type:
params["location_type"] = location_type
if smoothing:
params["smoothing"] = smoothing
if attributes:
params["attributes"] = attributes
return client.request("/v2/isochrones/" + profile + '/geojson', {}, post_json=params, dry_run=dry_run)
and get the following Warning-message:
2021-02-05T12:41:16 WARNING warning:__console__:1: ResourceWarning: unclosed file
traceback: File "C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\console\console.py", line 653, in runScriptEditor
self.tabEditorWidget.currentWidget().newEditor.runScriptCode()
File "C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\console\console_editor.py", line 460, in runScriptCode
.format(filename.replace("\\", "/"), sys.getfilesystemencoding()))
File "C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\console\console_sci.py", line 520, in runCommand
more = self.runsource(src)
File "C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\console\console_sci.py", line 552, in runsource
return super(ShellScintilla, self).runsource(source, filename, symbol)
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\code.py", line 74, in runsource
self.runcode(code)
File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "", line 1, in
I have no clue where that comes from - maybe the code is wrong?
Additionally I am trying to figure out how to get the output graphically in QGIS, like the ORS-plugin would do!
If any of you guys could give me just a little hint, that would be more than appreciated!
Best regards!