Loading GeoTiff into GeoPackageΒΆ

In this section you will use the GDAL_TRANSLATE utility to create a GeoPackage layer starting from a GeoTiff image.

gdal_translate -of GPKG <input-file>.tif <output-file>.gpkg

Example

  1. Open the gdal shell

  2. Move to the user_data directory:

    (Linux)
    cd ${TRAINING_ROOT}/data/user_data directory
    
    or
    
    (Windows)
    cd %TRAINING_ROOT%\data\user_data directory
    
  3. Run:

    gdal_translate -of GPKG bmreduced.tiff countries.gpkg -co APPEND_SUBDATASET=YES -co RASTER_TABLE=bmreduced -co TILE_FORMAT=JPEG
    
    gdaladdo -r cubic -oo TILE_FORMAT=JPEG countries.gpkg 2 4 8 16 32 64
    
  4. Check the GeoPackage with a GIS client (eg. QGIS):

    1. From the Browser panel right click the GeoPackage section and click “New connection...”

      ../_images/gpkg-qgis-new-connection.png
    2. Browse the filesystem and select the created countries.gpkg database

    3. Add the layer named bmreduced into the Map canvas:

      ../_images/gpkg-qgis-add-ras-layer.png
      ../_images/gpkg-bmreduced-qgis.png