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

Fix running algs with virtual layers #59465

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NyakudyaA
Copy link
Contributor

Description

Fixes #59364

This allows the following

Screenshot 2024-11-17 at 18 28 18

@github-actions github-actions bot added this to the 3.42.0 milestone Nov 17, 2024
@NyakudyaA
Copy link
Contributor Author

@agiudiceandrea Can you take a look at this, If this is the correct approach I can fix other gdal algs as well

Copy link

github-actions bot commented Nov 17, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit 68b61df)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit 68b61df)

Comment on lines +103 to +108
source_details = self.getOgrCompatibleSource(self.INPUT, parameters, context, feedback, executing=True)
# QgsVectorFileWriter defaults to geometry column called geom when exporting virtual, memory and grass layer
if source_details.layer_name == 'INPUT' and 'INPUT.gpkg' in source_details.connection_string:
geometry = parameters[self.GEOMETRY] = 'geom'
else:
geometry = self.parameterAsString(parameters, self.GEOMETRY, context)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of handling this here, I'd rather see:

  1. An optional "geometry_column_name" field added to the GdalConnectionDetails class. (defaulting to None)
  2. GdalAlgorithm.getOgrCompatibleSource updated so that the geometry_column_name field is set to "geom" when the source provider is the virtual provider
  3. All the GDAL algorithms which have a geometry column name updated to ignore this value and use the geometry_column_name from the GdalConnectionDetails object if it's set

How's that sound to you?

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.

Using virtual layer gives error in GDAL processing algorithms
2 participants