Re: Writing raster to GeoPackage layer

Sean Gillies


Can you tell us how you installed rasterio? If you installed one of the binary wheels from PyPI (which I built), you may be out of luck. I haven't paid any attention to making sure that they have support for geopackage rasters. I hope someone else can report whether they do or do not.

Also note that when you open an existing dataset in r+ mode, all of the keyword arguments you provide will be ignored, so the properties dict you've made in your code is unnecessary.

On Thu, Jun 20, 2019 at 12:48 PM Ryan <code@...> wrote:
I'm trying to add a raster layer to an existing GPKG with rasterio:

properties = {
with'testing.gpkg', 'r+', **properties) as dst_dataset:

However I get the following error:

Traceback (most recent call last):
  File "rasterio/_base.pyx", line 76, in rasterio._base.get_dataset_driver
  File "rasterio/_err.pyx", line 205, in rasterio._err.exc_wrap_pointer
rasterio._err.CPLE_OpenFailedError: 'testing.gpkg' not recognized as a supported file format.

I can do this with "gdal_translate" so I at least know the GPKG and rasters are all properly formatted:

gdal_translate -of GPKG raster.tiff testing.gpkg -co APPEND_SUBDATASET=YES -co RASTER_TABLE=rasterlayer

Side Question: Is there a way to format code in I can't seem to find anything on the edit toolbar :-/

Sean Gillies

Join to automatically receive all group messages.