GDAL
Using GDAL to load a GeoPackage into a database
Last updated
Was this helpful?
Using GDAL to load a GeoPackage into a database
Last updated
Was this helpful?
is a translator library for raster and vector geospatial data formats that is released under an X/MIT style Open Source by the . It comes with a variety of useful command line utilities for data translation and processing. The following section covers the loading of GeoPackage datasets into a database using the ETL tool GDAL. The process will be similar for other databases such as Oracle and SQL Server, as well as converting to other data formats.
A database with extension enabled
GDAL version 1.11.0 or above (with access to a command line interface to use it)
A GeoPackage dataset
-so
) and ‘List all features of all layers’ (-al
) arguments to view summary information about the layers within the GeoPackageogrinfo
<PATH_TO_GEOPACKAGE>
-so -al
Combined, these arguments will provide summary information about all the layers within the GeoPackage, including projection, schema, feature count and extents.
The arguments below will load all layers from the source GeoPackage into the specified target schema in the database:
ogr2ogr -f PostgreSQL "PG:user=
<USERNAME>
password=
<PASSWORD>
dbname=
<DATABASENAME>
host=
<HOST>
port=
<PORTNUMBER>
active_schema=
<TARGETSCHEMA>
"
<PATHTOGEOPACKAGE>
This will create twp tables in the example_schema
schema:
Different loading options (including renaming tables, reprojecting the data, etc.) can be found on the page.