This guide helps you to get started using GeoPackage – a lightweight format that can contain large amounts of complex data in a single, easy to distribute and ready to use file.
This guide explains what GeoPackage is, lists the key features and benefits of the format, and details the applications that support GeoPackage features. Accessing GeoPackage data via GIS software provides step-by-step instructions on accessing GeoPackage data via ArcMap, QGIS, MapInfo Professional, ArcGIS Pro and CadCorp. Loading GeoPackage into a database details the use of PostgreSQL while the final page covers reading GeoPackage data via FME.
In response to customer feedback on preferred data formats, a growing number of OS products have been made available in GeoPackage format, including AddressBase Core, Boundary-Line, OS Open Zoomstack and OS Open Roads, to name a few.
GeoPackage (.gpkg) is an open, non-proprietary, platform-independent and standards-based data format for geographic information systems (GIS), as defined by the Open Geospatial Consortium (OGC). It is designed to be a lightweight format that can contain large amounts of varied and complex data in a single, easy to distribute and ready to use file. GeoPackage is natively supported by numerous software applications.
GeoPackage offers users the following key features and benefits:
The single file is easy to transfer and offers the end-user a rich experience.
Attribute names are not limited in length, making the format user-friendly.
The file size limit is very large at 140 TB*, so lots of data can be easily accommodated – great for GB national coverage.
It supports raster, vector and database formats, making it a highly versatile solution.
It is an OGC standard.
In most cases, it is a Plug and Play format.
Data will be supplied in British National Grid (ESPG:27700).
* A file size limit might be imposed by the file system to which the file is written.
This getting started guide is broken down into the following sub-pages:
The following page provides instructions on how to load GeoPackage datasets into PostgreSQL.
Requirements:
A development platform for PostgreSQL (for example, pgAdmin or dBeaver)
A PostgreSQL database
PostGIS extension
GDAL
Access to a Command Prompt or similar
A GeoPackage dataset
There are various ways of loading a GeoPackage into PostgreSQL. The following step-by-step instructions run through using GDAL / Command Prompt to do this.
Open your chosen development platform, for example, dBeaver (this can be found by going to Windows Start Menu > PostGreSQL).
Either connect to an existing database or create a new database. It is recommended that the encoding is set to UTF-8. We will return to the PostgreSQL development platform later.
Open the Command Prompt by clicking the Start button in the bottom left-hand side of the screen and typing cmd into the search bar.
The Command Prompt will appear.
Change the directory of the Command Prompt app if necessary. The directory needs to point to the folder where the GeoPackage is stored. For this example, the GeoPackage to be loaded into PostgreSQL is stored in a C:\Temp folder.
In the Command Prompt, type cd followed by the directory of the location of the GeoPackage. Press Enter on the keyboard. This will change the directory.
Enter the command:
username, password, database and host can all be found within the subsequent database.
coordinate_system is the EPSG of the data to be loaded, for example, to load into British National Grid, the EPSG is 27700.
data_name is the name of the GeoPackage to be loaded. Example:
Open your chosen development platform (for example, dBeaver) by going to Start > dBeaver.
Under Database Navigator, move to the database you loaded data into and expand the schema. Using the code above, the GeoPackage should be in your default schema (shown in bold).
The GeoPackage will now appear as new tables / a new table in the schema nominated as default. Nominate a schema by adding the following text to the command noted in step 7: active schema=<schema>
schema can be found within the subsequent database.
Once loaded, you may want to add Primary and Foreign Keys to the data. These can only be added on columns where the data values are unique. Where there are no unique data values, an index may be added, which will aid searching.
Requirements:
An FME license
A GeoPackage dataset
GeoPackages can also be read into and used in FME workbenches.
Start up FME. In the top ribbon, click the Add Reader button, which will look similar to the following image:
A dialog box will appear. Here, the format (GeoPackage in this instance) can be specified using the drop-down list. Select the three dots button next to Dataset to specify which GeoPackage you want to read. The Coordinate System should also be set appropriately.
Click Parameters…
Another dialog box will appear. Here, specific layers within the GeoPackage can be selected, rather than importing the entire file. Additionally, the Search Envelope can be used to clip the GeoPackage to an extent.
Click the three dots button next to the Tables drop-down menu.
The next dialog box to appear allows for the selection of specific layers. Here, it is possible to select which themes / layers should be added into the workbench.
Click OK.
An orange reader will appear which will display the name of the GeoPackage table that has been ‘read in’.
The following page provides step-by-step instructions on how to access GeoPackage data via ArcMap, QGIS, MapInfo Professional, ArcGIS Pro and CadCorp.