Bug report #19637

temporary layers with a name get dropped into bin-directory

Added by Tobias Wendorff almost 2 years ago. Updated almost 2 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Processing/Core
Affected QGIS version:3.2.1 Regression?:Yes
Operating System:Microsoft Windows 7, 64-bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:27464

Description

When entering a name without a path or extension into the "[Create temporary layer]" field, a GPKG file with this name gets dropped into QGIS' binary directory. The name in layer tree is still the temporary name, like "Reprojected" for tool "Reproject layer". This confuses the user; sure, there's no icon for a temporary layer, but I don't default saving as GPKG in the binary directory is expected.

This behavior is expected:
  • Warn that no target file + directory has been selected or
  • don't create a GPKG, but a named temporary layer with the name just entered (highly recommended!)

A named temporary layer would have the big benefit to create clear names instead of having three layers named "Reprojected" when running the function in (manual) batch.

All QGIS3 versions are affected.

Associated revisions

Revision 5241ff3c
Added by Nyall Dawson almost 2 years ago

[processing] Fix creation of new layers doesn't default output folder

Fixes #19637

Revision 632bc8dc
Added by Nyall Dawson almost 2 years ago

[processing] Fix creation of new layers doesn't default output folder

Fixes #19637

(cherry-picked from 5241ff3c)

History

#1 Updated by Giovanni Manghi almost 2 years ago

  • Category changed from Virtual Layers to Processing/Core
  • Priority changed from Normal to High

The behaviour of temp file names can be changed in processing general options > "use file name as layer name", not enabled by default.

#2 Updated by Tobias Wendorff almost 2 years ago

Giovanni Manghi wrote:

The behaviour of temp file names can be changed in processing general options > "use file name as layer name", not enabled by default.

I've set this switch and restarted QGIS, but it didn't work. Still a GPKG file at the same location gets stored and it even gets worse: When give two layers the same name (in this example it's "demo"), QGIS tries to write to the same GPKG on the second run, which results into a error:

Could not create layer demo.gpkg: Creation of data source failed (OGR error: A file system object called 'demo.gpkg' already exists.)
Execution failed after 0.05 seconds

So it seems like the functions seems to be disabled for a reason :-(

Did you ever think of going the ArcGIS way? One GPKG per session to store all the temporary (non memory) files in it? When a layer already exists, an incremented number gets added to it. Another benefit: on a crash, all the data can be recovered from this file and the workspace portable...

#3 Updated by Giovanni Manghi almost 2 years ago

Tobias Wendorff wrote:

Giovanni Manghi wrote:

The behaviour of temp file names can be changed in processing general options > "use file name as layer name", not enabled by default.

I've set this switch and restarted QGIS, but it didn't work.

my tip was about the temp outputs names, not the location. The tip allows you to get temp outputs with the name you have choosen, rather than with the operation name.

Still a GPKG file at the same location gets stored and it even gets worse: When give two layers the same name (in this example it's "demo"), QGIS tries to write to the same GPKG on the second run, which results into a error:

this should not happen, all the temp outputs should have a different name (of the file on disk).
What is the output folder configured in your Processing general options?

#4 Updated by Tobias Wendorff almost 2 years ago

Giovanni Manghi wrote:

my tip was about the temp outputs names, not the location. The tip allows you to get temp outputs with the name you have choosen, rather than with the operation name.

Wait, let's be more exact. There are:
  • temporary file on disk (GPKG)
  • temporary file in memory (memory storage)

As soon as you enter any name into the field with the grey "[Create temporary layer]", it gets stored into QGIS' bin-directory as GPKG. When not entering a name, it gets stored in memory storage.

this should not happen, all the temp outputs should have a different name (of the file on disk).

When entering a name WITH AND WITHOUT the setting you've told me, the file gets written as GPKG in the bin-directory! The setting is ignored.

What is the output folder configured in your Processing general options?

I never touched it (OSGeo4W, 64-bit). Output directory is (Windows 10, 64-bit): C:\Users\t.wendorff\AppData\Roaming\QGIS\QGIS3\profiles\default\processing\outputs

#5 Updated by Nyall Dawson almost 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

#6 Updated by Giovanni Manghi almost 2 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF