GDAL – Troubleshooting Spurious Tables Loaded by ogr2ogr from GeoPackage

gdalgeopackageogr2ogr

I am loading a GeoPackage file into PostgreSQL using the following command:-

ogo2org -f PostgreSQL -oo LIST_ALL_TABLES=NO \
                      -lco OVERWRITE=YES \
                      -lco PG_USE_COPY=YES \
                      -lco OGR_TRUNCATE=YES \
                      -t_srs EPSG:4326 \
                      -skipfailures \
                      <DB connection string>
                      namedplaces.geopackage

This works but it also creates a set of spurious tables that I do not want as follows:

gpkg_contents
gpkg_extensions
gpkg_geometry_columns
gpkg_ogr_contents
gpkg_spatial_ref_sys
gpkg_tile_matrix
gpkg_tile_matrix_set
rtree_namedplace_geom

Please note these are Geopackage META-DATA tables not additional layers

I thought the LIST_ALL_TABLES=NO flag would suppress this. What am I doing wrong here?

The objective is for the command to work with any gpkg file and only load the geometry table as would happen if opened in QGIS

Best Answer

I have tracked this behaviour down to what may be a bug/feature in the gdal geopackage driver or ogr2ogr

If the file is named with the .gpkg extension it works as expected

If the file is named with another extension (eg: .geopackage) the spurious tables are created.

Related Question