Loading Shapefile into GeoPackageΒΆ

In this section you will use the OGR2OGR utility to create a GeoPackage layer starting from a shapefile.

ogr2ogr \
-s_srs EPSG:4326 \
-t_srs EPSG:3857 \
-f GPKG <output-file>.gpkg \


  1. on Windows, open the TRAINING_ROOT folder and launch the ``OSGeo4W.bat` to open the GDAL shell

  2. Move to the user_data directory:

    cd ${TRAINING_ROOT}/data/user_data directory
    cd %TRAINING_ROOT%\data\user_data directory
  3. Run:

    ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3857 -nlt MULTIPOLYGON -f GPKG countries.gpkg ne_50m_admin_0_countries.shp


    • -s_srs: SRS of the source (shapefile)
    • -t_srs: SRS of the target (geopackage)
    • -nlt: define the geometry type for the layer. In this case we used MULTIPOLYGON because the shapefile contains bot POLYGONs and MULTIPOLYGONs geometry types.
    • -f: define the output format (GPKG)
    • <output>.gpkg: output path for the geopakage
    • <input>.shp: input path for the shapefile
  4. Check the GeoPackage with a GIS client (eg. QGIS):

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

    2. Browse the filesystem and select the created countries.gpkg database

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