-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
native:savefeatures unable to specify output layer #56517
Comments
Could not reproduce on master.
Have you actually checked output file? It is modified. The LAYER_NAME output is set only when "Create or overwrite file" and "Create or overwrite layer" modes are used, in the append mode layer name is not supposed to change.
That's not true, layer name parameter is an advanced one. You need to expand Advanced parameter group to see it. By default (if layer name is not set explicitly) algorithm will derive layer name from the input filename. |
Yes, the output file was unchanged. At the time of reporting the bug there was no layer name option in the UI, but going in now, I see it has since been added. It's been almost a year since I looked at this so I'm fuzzy on the details, but it looks like I was able to get it to work by using an extra file, as it seems the input and output layer names had to be the same. So instead of copying between layers I copied between different files with the same layer names. I'm not sure if this is the case now, as generating a qgis_process command in the UI seems to allow the input field to have a layer specified, which I couldn't get working before. And I can now specify a LAYER_NAME too which I couldn't before. I'm going to close this bug as it looks like it may have been fixed at some point in the last year. |
That's not true, this option was here since algorithm addition in 2020 and it was always marked as advanced. |
Well one way or another the value wasn't being used when I ran it. It's been almost a year now with no comment so unfortunately I've long forgotten the details, but I wouldn't have logged the bug report if it was as simple as filling out a text field. Thinking hard about it now, I vaguely recall the problem was LAYER_NAME on the advanced tab was being used as the layer name for both the input and output files, so I couldn't set a layer name on the output file that was different to the input. So what I felt was missing at the time, was an option to set the output layer name differently to the input layer name, so both of them didn't have to be the same. When you say it works for you, have you tried exporting from a layer called "A", and appending that to layer called "B"? |
What is the bug or the crash?
There is no way to specify the output layer, so the output is always empty.
Steps to reproduce the issue
When using the Processing Toolbox, the UI does not provide a way to select an output layer. The
qgis_process
command this generates looks like so:(If you run this command,
output.gpkg
must already exist with aphotos
layer for the above command to append to due to the value ofACTION_ON_EXISTING_FILE
.)Observe in the output, the
LAYER_NAME
is empty, so the output file is not modified:According to the source code, you can specify an output layer like this:
--OUTPUT=output.gpkg|layername=photos
however this fails with the errorCould not create layer output.gpkg|layername=photos: OGR driver for '' not found (OGR error: )
.Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Active Python plugins
MetaSearch
0.3.6
grassprovider
2.12.99
db_manager
0.1.20
processing
2.12.99
Supported QGIS version
New profile
Additional context
I notice that qgsalgorithmsavefeatures.cpp:120 is passing the full destination string (including the
|layername=
part) toQgsVectorFileWriter::create()
, which is the function that seems to fail when the output string contains a layer name.Yet it's not until line 164 that the layer name is split off the base filename, so I'm wondering whether this is happening in the wrong order?
I'm not really sure though as it seems to specify the inputs and outputs quite differently to some of the other algorithms.
My use case is that I am writing a shell script to import geotagged photos into a layer, run some SQL on them to make some changes, and finally take that data and append it to an existing layer of geotagged photos. This final step of appending the data onto the existing layer is what's failing here.
The text was updated successfully, but these errors were encountered: