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

qgis_process errors with 'native:dissolve' if SEPARATE_DISJOINT=true and if OUTPUT is an explicit file #55587

Closed
1 of 2 tasks
florisvdh opened this issue Dec 12, 2023 · 2 comments · Fixed by #55966
Closed
1 of 2 tasks
Assignees
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?

When running native:dissolve, qgis_process will error while writing to an explicit output file if SEPARATE_DISJOINT=true. An output file is written nevertheless.

With OUTPUT=TEMPORARY_OUTPUT this does not happen, but then no output file is available (= #51503).

The command succeeds if SEPARATE_DISJOINT=false, but setting as 'false' was not the purpose.

This issue may overlap with the needs to solve #53392.

Steps to reproduce the issue

Use the input.gpkg file inside input.gpkg.zip and save it in the working directory to reproduce below code.

$ ls output.gpkg
ls: cannot access 'output.gpkg': No such file or directory
$ 
$ qgis_process run 'native:dissolve' --INPUT=input.gpkg --FIELD=box --SEPARATE_DISJOINT=true --OUTPUT=output.gpkg

----------------
Inputs
----------------

FIELD:	box
INPUT:	input.gpkg
OUTPUT:	output.gpkg
SEPARATE_DISJOINT:	true


ERROR 1: failed to execute insert : UNIQUE constraint failed: output.fid
Could not write feature into OUTPUT
ERROR:	Could not write feature into OUTPUT
Could not write feature into OUTPUT
$ 
$ ls output.gpkg
output.gpkg
$ 
$ rm output.gpkg 
$ 
$ qgis_process run 'native:dissolve' --INPUT=input.gpkg --FIELD=box --SEPARATE_DISJOINT=true --OUTPUT=TEMPORARY_OUTPUT

----------------
Inputs
----------------

FIELD:	box
INPUT:	input.gpkg
OUTPUT:	TEMPORARY_OUTPUT
SEPARATE_DISJOINT:	true


0...10...20...30...40...50
----------------
Results
----------------

OUTPUT:	Dissolved_6d6932d5_59f8_443b_b40e_835747629ebb
$ 
$ ls Dissolved*
ls: cannot access 'Dissolved*': No such file or directory
$ 
$ qgis_process run 'native:dissolve' --INPUT=input.gpkg --FIELD=box --SEPARATE_DISJOINT=false --OUTPUT=output.gpkg

----------------
Inputs
----------------

FIELD:	box
INPUT:	input.gpkg
OUTPUT:	output.gpkg
SEPARATE_DISJOINT:	false


0...10...20...30...40...50
----------------
Results
----------------

OUTPUT:	output.gpkg
$ 
$ ls output.gpkg
output.gpkg

Versions

$ qgis_process --version
QGIS 3.34.1-Prizren 'Prizren' (133927424d9)
QGIS code revision 133927424d9
Qt version 5.15.3
Python version 3.10.12
GDAL/OGR version 3.6.4
PROJ version 9.1.1
EPSG Registry database version v10.076 (2022-08-31)
GEOS version 3.11.1-CAPI-1.17.1
SQLite version 3.37.2
OS Linux Mint 21.2

Supported QGIS version

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

New profile

Additional context

The input layer and the challenge are based on https://stackoverflow.com/q/77614772/15137041.

@florisvdh florisvdh added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Dec 12, 2023
@agiudiceandrea agiudiceandrea added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Dec 12, 2023
@nirvn nirvn self-assigned this Jan 24, 2024
nirvn added a commit to nirvn/QGIS that referenced this issue Jan 24, 2024
@florisvdh
Copy link
Contributor Author

Confirmed that it works! 🎉 Thanks!!

$ ~/git_repositories2/QGIS/build-0aed505/output/bin/qgis_process run 'native:dissolve' --INPUT=input.gpkg --FIELD=box --SEPARATE_DISJOINT=true --OUTPUT=output.gpkg

----------------
Inputs
----------------

FIELD:	box
INPUT:	input.gpkg
OUTPUT:	output.gpkg
SEPARATE_DISJOINT:	true


0...10...20...30...40...50
----------------
Results
----------------

OUTPUT:	output.gpkg
$ 
$ ~/git_repositories2/QGIS/build-0aed505/output/bin/qgis_process --version | head -1
QGIS 3.35.0-Master 'Master' (0aed5058)

@dawgermany
Copy link

this is also true for the buffer algorithm when choosing separate_disjoint=true

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.

4 participants