Skip to content

Made ORSTools ready for qgis_process #325

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

jannefleischer
Copy link
Contributor

@jannefleischer jannefleischer commented May 22, 2025

Because I need to run our plugin OS-WALK-EU (which depends on isocrone calculations from ORStools) from within a qgis_process setup headless I needed some upstream changes:

  1. moved the initiation of the processing toolbox to initProcessing, so qgis_process can skip everything with a GUI involved
  2. Added some recasting of parameters to int, because qgis_process interprets numbers as strings...
  3. Added an configuration-processing-algorithm (so my headless machine can have a custom provider). Added a test to that, but never done tests before (just a urban planner doing some programming...)

Now I can run something like this from the command line:

qgis_process plugins enable "ORStools" && qgis_process run "ORS Tools:set_provider_config_to_ors_via_algorithm" -- distance_units=meters area_units=m2 ellipsoid=EPSG:7019 ors_provider_name=ors.onmyserver.de ors_provider_api_key= ors_provider_url=https://ors.onmyserver.de ors_provider_timeout=240 ors_provider_overwrite=true

followed by:

echo '{                                                                                                            
        "distance_units": "meters", 
        "area_units": "m2",
        "ellipsoid": "EPSG:7019",
        "inputs": {
                "INPUT_PROVIDER": 1,
                "INPUT_PROFILE": 0,
                "INPUT_POINT_LAYER": "/home/fleischer/srv-fs1/u/02_Code_Working_Trees/os-walk-eu/SampleData/SampleGrid_centroids.shp",
                "INPUT_FIELD": "GRD_ID",
                "INPUT_METRIC": 1,
                "INPUT_RANGES": "250,500,750,1000",
                "LOCATION_TYPE": 0,
                "INPUT_SMOOTHING": 0,
                "INPUT_AVOID_FEATURES": [],
                "INPUT_AVOID_COUNTRIES": null,
                "INPUT_AVOID_BORDERS": null,
                "OUTPUT": "/home/fleischer/srv-fs1/u/02_Code_Working_Trees/os-walk-eu/SampleData/SampleGrid_centroid_isochrones_orstools.shp"
    }
}' | qgis_process run "ORS Tools:isochrones_from_layer" -

Due to None/null-Values and [] as parameters, only the json-piping is working.

Copy link
Collaborator

@koebi koebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey,
thanks a lot for the contribution!

I had a quick look at everything but the new processing algorithm - will have to look at that one in detail :)

@jannefleischer
Copy link
Contributor Author

Thanks for the feedback, removed old stuff.

@jannefleischer
Copy link
Contributor Author

Sorry for the reverts. Merged into wrong branch...sillyme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants