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

Processing dialogs don't export data-defined overrides in qgis_process and JSON syntax #50482

Closed
1 of 2 tasks
florisvdh opened this issue Oct 7, 2022 · 0 comments · Fixed by #51412
Closed
1 of 2 tasks
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@florisvdh
Copy link
Contributor

What is the bug or the crash?

Several processing algorithms provide a data-defined override button next to a parameter, so that an attribute field or an expression can be inserted instead of a fixed value. Examples are the numerical DISTANCE parameter of native:buffer, and the boolean ALL_PARTS parameter of native:centroids.

The processing dialogs (tool dialog and history dialog) provide a means to export the chosen parameters as qgis_process command syntax or as a JSON string ('Advanced' button, or right clicking a history item). Both options are used in geospatial scripting outside of QGIS and Python, e.g. in bash or R.

However, the value of a data-overridden parameter is currently not captured in the exported string; instead it is empty (null in the case of JSON). E.g. we get below result – look at the DISTANCE value:

qgis_process run native:buffer --ellipsoid=EPSG:7030 --INPUT='/usr/share/qgis/resources/data/world_map.gpkg|layername=countries' --DISTANCE= --SEGMENTS=5 --END_CAP_STYLE=0 --JOIN_STYLE=0 --MITER_LIMIT=2 --DISSOLVE=false --OUTPUT=TEMPORARY_OUTPUT

and

{
  "ellipsoid": "EPSG:7030",
  "inputs": {
    "DISSOLVE": false,
    "DISTANCE": null,
    "END_CAP_STYLE": 0,
    "INPUT": "/usr/share/qgis/resources/data/world_map.gpkg|layername=countries",
    "JOIN_STYLE": 0,
    "MITER_LIMIT": 2.0,
    "OUTPUT": "TEMPORARY_OUTPUT",
    "SEGMENTS": 5
  }
}

Steps to reproduce the issue

  1. Make a QGIS project with at least 1 layer. E.g. a polygon layer.
  2. From the toolbox, choose an algorithm that provides a parameter with the data-defined override widget, e.g. native:buffer (to control a numerical value) or native:centroids (to control a boolean value).
  3. Apply a data-defined override by clicking the corresponding button next to the parameter and select an appropriate attribute field or provide an appropriate expression – that expression may even just be a fixed value.
  4. In the processing dialog, click 'Advanced' and choose either 'Copy as qgis_process command' or 'Copy as JSON'.
  5. Inspect the content of your clipboard: the value of the parameter is empty (null in the case of JSON).

Versions

QGIS version 3.26.3-Buenos Aires QGIS code revision 65e4edf
Qt version 5.12.8
Python version 3.8.10
GDAL/OGR version 3.4.3
PROJ version 8.2.0
EPSG Registry database version v10.038 (2021-10-21)
GEOS version 3.10.2-CAPI-1.16.0
SQLite version 3.31.1
PDAL version 2.2.0
PostgreSQL client version 12.12 (Ubuntu 12.12-0ubuntu0.20.04.1)
SpatiaLite version 5.0.1
QWT version 6.1.4
QScintilla2 version 2.11.2
OS version Linux Mint 20
       
Active Python plugins
geopunt4Qgis 2.2.4
ViewshedAnalysis 1.7
cartography_tools 1.2.1
quick_map_services 0.19.27
grassprovider 2.12.99
processing 2.12.99
sagaprovider 2.12.99
db_manager 0.1.20
MetaSearch 0.3.6
otbprovider 2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

No response

@florisvdh florisvdh added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Oct 7, 2022
@agiudiceandrea agiudiceandrea added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Oct 10, 2022
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Jan 10, 2023
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Jan 10, 2023
handle data defined field/expression based properties

Refs qgis#50482
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Jan 10, 2023
using --PARAM=field:FIELD_NAME  or --PARAM=expression:SOME EXPRESSION
when using qgis_process utility

Fixes qgis#50482
nyalldawson added a commit that referenced this issue Jan 16, 2023
handle data defined field/expression based properties

Refs #50482
nyalldawson added a commit that referenced this issue Jan 16, 2023
using --PARAM=field:FIELD_NAME  or --PARAM=expression:SOME EXPRESSION
when using qgis_process utility

Fixes #50482
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants