-
Notifications
You must be signed in to change notification settings - Fork 20
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
Use the JSON interface to qgis_process when available #44
Comments
Just as an update...this one is really important for implementing an interface to all the algorithms. I think that the LTR (3.16) contains the ability to use JSON here, so we should be clear to use it. I plan to spend my open source time in September/October spiffing up this package (ahead of the FOSS4G talk!). |
specified as a JSON object passed via stdin to qgis_process This provides a mechanism to support complex input parameters for algorithms, and a way for qgis_process to gain support for parameter types which are themselves specified as a dictionary type object. To indicate that parameters will be specified via stdin then the qgis_process command must follow the format qgis_process run algid - (with a trailing - in place of the usual arguments list). The JSON object must contain an "inputs" key, which is a map of the input parameter values. E.g. echo "{"inputs": {\"INPUT\": \"my_shape.shp\", DISTANCE: 5}}" | qgis_process run native:buffer - Specifying input parameters via stdin implies automatically the --json output format for results. One big motivation behind this enhancement is to provide a way for the qgisprocess R libraries to support parameter types such as aggregates. Refs r-spatial/qgisprocess#56 Refs r-spatial/qgisprocess#44 Sponsored by the Research Institute for Nature and Forest, Flemish Govt
Just like #56, this should be possible following qgis/QGIS#46497 |
specified as a JSON object passed via stdin to qgis_process This provides a mechanism to support complex input parameters for algorithms, and a way for qgis_process to gain support for parameter types which are themselves specified as a dictionary type object. To indicate that parameters will be specified via stdin then the qgis_process command must follow the format qgis_process run algid - (with a trailing - in place of the usual arguments list). The JSON object must contain an "inputs" key, which is a map of the input parameter values. E.g. echo "{"inputs": {\"INPUT\": \"my_shape.shp\", DISTANCE: 5}}" | qgis_process run native:buffer - Specifying input parameters via stdin implies automatically the --json output format for results. One big motivation behind this enhancement is to provide a way for the qgisprocess R libraries to support parameter types such as aggregates. Refs r-spatial/qgisprocess#56 Refs r-spatial/qgisprocess#44 Sponsored by the Research Institute for Nature and Forest, Flemish Govt
specified as a JSON object passed via stdin to qgis_process This provides a mechanism to support complex input parameters for algorithms, and a way for qgis_process to gain support for parameter types which are themselves specified as a dictionary type object. To indicate that parameters will be specified via stdin then the qgis_process command must follow the format qgis_process run algid - (with a trailing - in place of the usual arguments list). The JSON object must contain an "inputs" key, which is a map of the input parameter values. E.g. echo "{"inputs": {\"INPUT\": \"my_shape.shp\", DISTANCE: 5}}" | qgis_process run native:buffer - Specifying input parameters via stdin implies automatically the --json output format for results. One big motivation behind this enhancement is to provide a way for the qgisprocess R libraries to support parameter types such as aggregates. Refs r-spatial/qgisprocess#56 Refs r-spatial/qgisprocess#44 Sponsored by the Research Institute for Nature and Forest, Flemish Govt
specified as a JSON object passed via stdin to qgis_process This provides a mechanism to support complex input parameters for algorithms, and a way for qgis_process to gain support for parameter types which are themselves specified as a dictionary type object. To indicate that parameters will be specified via stdin then the qgis_process command must follow the format qgis_process run algid - (with a trailing - in place of the usual arguments list). The JSON object must contain an "inputs" key, which is a map of the input parameter values. E.g. echo "{"inputs": {\"INPUT\": \"my_shape.shp\", DISTANCE: 5}}" | qgis_process run native:buffer - Specifying input parameters via stdin implies automatically the --json output format for results. One big motivation behind this enhancement is to provide a way for the qgisprocess R libraries to support parameter types such as aggregates. Refs r-spatial/qgisprocess#56 Refs r-spatial/qgisprocess#44 Sponsored by the Research Institute for Nature and Forest, Flemish Govt
QGIS 3.24.0 has been released on GitHub three days ago; it came available in at least the ubuntugis repository this weekend. That's great news, it makes that the latest QGIS release now supports the JSON input method for its command line program Moreover, the QGIS GUI now helps in preparing the specification of algorithm arguments, both for the standard approach with separate arguments, and for the JSON input approach:
Thanks @nyalldawson for implementing this in QGIS, thanks @paleolimbot for upgrading Below is a screenshot showing where the copying can be done in a processing tool dialog. Note that it's not needed to actually run the processing in the dialog. Probably this issue can be closed once the new release is officially announced on the QGIS website. |
@paleolimbot it looks to me this issue can be closed. |
Closing with pleasure - thanks for this amazing stuff @paleolimbot! |
Right now
qgis_run_algorithm()
generates command-line arguments in the form--ARG=VALUE
, which can't be used for all input types. The JSON interface should be used when available!The text was updated successfully, but these errors were encountered: