[gdal-dev] Gdal python - gpkg driver creation options

Even Rouault even.rouault at spatialys.com
Thu May 14 07:43:02 PDT 2020


> Issues I found:
> 1) I'm using the option "Tile format = PNG" because I found this option to
> be more effective to compress the final output files, I'm working with
> about 6000 outputs / Is that actual right, or there is another way to have
> tiff files compressed effectively with output data format as Float32?

This is probably the most effective option indeed. But not a lossless one, as when using PNG 
for Float32, data will be encoded on 16 bit with offset/scale

> 2) As I said I am working with more than 6000 simulation outputs.. I found
> that my final gpkg created file has a limit of 1000 layers... Is that a
> default creation option?? How can I make sure my final gpkg file store all
> the layers?

All layers should be stored, but this was a hardcoded limitation in the driver to avoid 
potential denial of service attacks. I've raised the limit to 10 000, consistently with vector 
layers, and also for consistency with them, make it configurable with the OGR_TABLE_LIMIT 
configuration option.

Fixed per

> 3) What is the best way to access a certain via gdal python api the gpkg
> layers? Or is best to access the individual layer using sqlite3 lib? I use
> the following script to view list the raster tables, but I want to access a
> certain layer individually
> ds = gdal.OpenEx('my.gpkg')
> x = ds.GetMetadata_List('SUBDATASETS')

Use the value of the SUBDATASET_x_NAME metadate items as the connection string to get a 

The syntax is GPKG:the.gpkg:raster_table_name

This will overcome the limitation of 2) (even if layers you want to get accessed aren't 
currently listed)


Spatialys - Geospatial professional services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200514/cfb45b1e/attachment.html>

More information about the gdal-dev mailing list