Forrest logo
back to the ogr2ogr tool

ogr2ogr:tldr:f6382

ogr2ogr: Load a GeoPackage into a PostGIS database.
$ ogr2ogr -f PostgreSQL PG:dbname="${database_name}" ${path-to-input}.gpkg
try on your machine

The command ogr2ogr is used to convert data between different spatial formats. In this case, it is being used to convert a GeoPackage file (.gpkg) to a PostgreSQL database.

The -f flag specifies the output format, in this case PostgreSQL.

The PG:dbname="${database_name}" part of the command specifies the connection details for the PostgreSQL database. ${database_name} is a placeholder that should be replaced with the actual name of the database you want to connect to. It is typically provided as an environment variable or as a parameter when running the command.

${path-to-input}.gpkg specifies the path to the input GeoPackage file that you want to convert. The ${path-to-input} portion is also a placeholder that should be replaced with the actual file path.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ogr2ogr tool