Bug report #20848

Issue exporting raster layer to Geopackage

Added by Yineth Castiblanco almost 6 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:Alessandro Pasotti
Category:Rasters
Affected QGIS version:3.4.5 Regression?:No
Operating System:Any Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:28667

Description

I have a couple of issues when I try to export a Raster Layer into a GeoPackage format through export/Save as...

  • First, the message "The layer HYP already exists ......" (attached "SaveRasterLayer.jpg")
  • Second, I have this messages, the first one as CRITICAL, the second one as SUCCESSFUL (But in the Geopackage, the layer doesn´t exists)

Text of the issue in message console:

2018-12-19T15:06:29 CRITICAL Fuente de datos no admitida : GPKG:C:\Users...\CapasGeopackage.gpkg:HYP no es un origen de datos ráster admitido

Cannot find table 'HYP' in GeoPackage dataset
2018-12-19T15:06:29 SUCCESS Capa exportada : La capa ráster se ha guardado correctamente en C:\Users\...\CapasGeopackage.gpkg

There are one way to export it or store it into a GeoPackage but + without additional options+ (the "save as" dialog has the additional options), the way to do that is just drag the layer and add it into a GeoPackage connection in "Navigator" tab.
But I want to add some additional options.

Externally I tried the next code lines through GDAL console:

gdal_translate -co APPEND_SUBDATASET=YES -of GPKG /home/...../archivo.tif /home/.../geopackageDB.gpkg

And I'd gotten successful export process.

The idea is get the export process thorugh QGIS interface.

My configuration information:

OS: Windows 10
QGIS: QGIS 3.4.1-Madeira
GDAL: GDAL 2.3.2
RAM: 16GB
Language: Spanish

SaveRasterLayer.jpg (10.5 KB) Yineth Castiblanco, 2018-12-19 03:18 PM


Related issues

Related to QGIS Application - Feature request #17926: Append raster layer to an existing Geopackage with a chec... Closed 2018-01-22

Associated revisions

Revision 3fd399dc
Added by Alessandro Pasotti over 5 years ago

Fix export raster as GPKG

Fixes #20848

Test added for internal functions because the main functionality
is in app.

Partially reverts 006b130e8a85dbba9e499642a8493a515cf41aa0
See: https://github.com/qgis/QGIS/commit/006b130e8a85dbba9e499642a8493a515cf41aa0

History

#1 Updated by Frank Sokolic over 5 years ago

I can confirm this issues also exists in QGIS 3.4.5 on Windows.

It can be replicated as follows:
  1. Create a GeoPackage and add a vector layer
  2. Now try add a raster layer and the message reported by Yineth Castiblanco occurs

It seems that one can't add raster data to GeoPackages that already contain vector data. However, it is possible to create the GeoPackage correctly as long as all the raster layers are added first.

#2 Updated by Giovanni Manghi over 5 years ago

  • Affected QGIS version changed from 3.4.1 to 3.4.5

#3 Updated by Ben Hur Pintor over 5 years ago

Frank Sokolic wrote:

I can confirm this issues also exists in QGIS 3.4.5 on Windows.

It can be replicated as follows:
  1. Create a GeoPackage and add a vector layer
  2. Now try add a raster layer and the message reported by Yineth Castiblanco occurs

It seems that one can't add raster data to GeoPackages that already contain vector data. However, it is possible to create the GeoPackage correctly as long as all the raster layers are added first.

The issue also exists in 3.6.1 running on Ubuntu 18.04. Like Frank mentioned, you can't add a raster layer in the GeoPackage if it already contains vector data but the other way around (adding vector data to a GeoPackage with a raster layer) works fine.

#4 Updated by Alessandro Pasotti over 5 years ago

  • Assignee set to Alessandro Pasotti

#5 Updated by Alessandro Pasotti over 5 years ago

  • Related to Feature request #17926: Append raster layer to an existing Geopackage with a checkbox and layer name QLineEdit. added

#6 Updated by Alessandro Pasotti over 5 years ago

  • Status changed from Open to In Progress
  • Resolution set to fixed/implemented
  • Pull Request or Patch supplied changed from No to Yes
  • Operating System changed from Windows to Any

#7 Updated by Alessandro Pasotti over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF