Bug report #21183

shp files in zip files files cannot be used in Processing with 3rd party providers (SAGA, GRASS...)

Added by Victor Olaya about 5 years ago. Updated about 5 years ago.

Status:Open
Priority:Normal
Assignee:Nyall Dawson
Category:Processing/Core
Affected QGIS version:3.5(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29001

Description

If the zip file itself is loaded when adding a layer, it can be used as an input for a SAGA algorithm. This is because the source of the corresponding layer will be ".zip", so it's identified as a non compatible extension, and will be exported to a temporary file.

However, if a shp file in a zip file is directly loaded (for instance, selecting that file in the QGIS browser panel instead of the zip file it belongs to), the algorithm fails. The reason for this is that the source of that layer will be something like "/vsizip//path/to/Archive.zip/points.shp". Having a shp extension, it's believed to be a "real" shapefile, and it is not exported. SAGA wont be able to handle the /vsizip stuff

The issue is in the QgsProcessingUtils::convertToCompatibleFormat method, which is called to ensure that a compatible file is passed to SAGA (and other providers). It just checks the file suffix, but doesnt check if it's a zipped file or not. Checking for the /vsizip prefix should fix it.

History

#1 Updated by Giovanni Manghi about 5 years ago

this seems a regression (I think is ok on 2.18).

#2 Updated by Alister Hood about 5 years ago

If the zip file itself is loaded when adding a layer, it can be used as an input for a SAGA algorithm

Not for a Grass algorithm though.

Also available in: Atom PDF