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

Changes in qgis_process that might be useful #21

Closed
paleolimbot opened this issue Oct 11, 2020 · 3 comments
Closed

Changes in qgis_process that might be useful #21

paleolimbot opened this issue Oct 11, 2020 · 3 comments

Comments

@paleolimbot
Copy link
Collaborator

@nyalldawson You said to flag you if there's anything from the QGIS end that could make this better! I've spent a bit of time on this and have some ideas...it works fantastically and consistently (as far as I can tell) on multiple platforms!

The only three things I can think of:

  • The ability for providers to work out-of-the-box in a headless state would be helpful for testing! There's an open issue with a workaround ( qgis_process: processing plugin not loaded / reduced list of algorithms on freshly installed systems and headless servers qgis/QGIS#37989 ), but locating the QGIS3.ini file on multiple platforms/distros is hard and probably better left to QGIS, if that's at all possible.
  • JSON IO would be useful (JSON args through stdin and JSON output on stdout)...there's a few things like commas in fillenames that will break e.g., multilayer input/output, and my current approach for getting argument metadata is basically regex matching on the helpfile (which will eventually break if it isn't wrong already!). I also worry about encoding issues but I do seem to be able to get back an é from INPUT -> OUTPUT, so maybe that's not an issue. Again, maybe this is really hard, but eventually my regexes are going to break.
  • Documentation of how string values are parsed would be really top-notch ( New standalone console tool for running processing algorithms (Request in QGIS) qgis/QGIS-Documentation#5803 ). I can help with this one since I've spent a lot of time guessing but I don't know where to begin (what do I fork? what file do I create!?)

Thanks for PRing a great tool into QGIS and let me know what I can do to help!

@nyalldawson
Copy link

Documentation of how string values are parsed would be really top-notch ( qgis/QGIS-Documentation#5803 ). I can help with this one since I've spent a lot of time guessing but I don't know where to begin (what do I fork? what file do I create!?)

The new json output includes this type of information

    "DISTANCE": {
      "default_value": 10,
      "description": "Distance",
      "is_advanced": false,
      "is_destination": false,
      "name": "DISTANCE",
      "optional": false,
      "raw_definition": {
        "data_type": 1,
        "default": 10,
        "default_unit": 9,
        "description": "Distance",
        "flags": 0,
        "help": null,
        "max": 1.7976931348623157e+308,
        "metadata": {},
        "min": -1.7976931348623157e+308,
        "name": "DISTANCE",
        "parameter_type": "distance",
        "parent": "INPUT"
      },
      "type": {
        "acceptable_values": [
          "A numeric value"
        ],
        "description": "A numeric parameter representing a distance measure.",
        "id": "distance",
        "metadata": {},
        "name": "Distance"
      }
    },

Specifically, the acceptable_values list here gives a breakdown of the different string inputs which are acceptable for each parameter.

Does that help?

@paleolimbot
Copy link
Collaborator Author

That's brilliant! Thank you! After I've finished the type handling here I'll take a stab at forking the QGIS docs and adding any bits that are missing.

nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Oct 13, 2020
This allows external tools to more easily use the standalong qgis_process
tool without resorting to fragile string parsing of the outputs from
that tool.

Refs r-spatial/qgisprocess#21, and means
that we play nice with other tools who want to use QGIS algorithms!
@nyalldawson
Copy link

nyalldawson commented Oct 13, 2020

The ability for providers to work out-of-the-box in a headless state would be helpful for testing! There's an open issue with a workaround ( qgis/QGIS#37989 ), but locating the QGIS3.ini file on multiple platforms/distros is hard and probably better left to QGIS, if that's at all possible.

Fixed in qgis/QGIS#39324

nyalldawson added a commit to qgis/QGIS that referenced this issue Oct 13, 2020
This allows external tools to more easily use the standalong qgis_process
tool without resorting to fragile string parsing of the outputs from
that tool.

Refs r-spatial/qgisprocess#21, and means
that we play nice with other tools who want to use QGIS algorithms!
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

No branches or pull requests

2 participants