Forrest logo
back to the ogr2ogr tool

ogr2ogr:tldr:eb106

ogr2ogr: Convert a Shapefile into a GeoPackage.
$ ogr2ogr -f GPKG ${path-to-output}.gpkg ${path-to-input}.shp
try on your machine

This command is using the ogr2ogr tool to convert a shapefile (.shp) to a GeoPackage file (.gpkg).

Let's break down the command components:

  • ogr2ogr: This is the command-line utility used for converting between different geospatial formats. It is part of the GDAL library.
  • -f GPKG: This option specifies the output format, in this case, GeoPackage. -f stands for "format".
  • ${path-to-output}.gpkg: This is the path to the output file. ${path-to-output} should be replaced with the desired directory and file name for the GeoPackage file. .gpkg is the file extension for GeoPackage.
  • ${path-to-input}.shp: This is the path to the input shapefile. ${path-to-input} should be replaced with the directory and file name of the input shapefile. .shp is the file extension for shapefiles.

In summary, the command is using ogr2ogr to convert the shapefile specified by ${path-to-input}.shp to a GeoPackage file with the name and location specified by ${path-to-output}.gpkg.

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