top of page

What is a GeoPackage (.gpkg)? Everything You Need to Know

  • Writer: Anvita Shrivastava
    Anvita Shrivastava
  • 28 minutes ago
  • 5 min read

At the center of the mapping process, geospatial data are necessary in GIS application development, ecologic study, city planning, navigation, etc. As GIS projects grow more complex, it becomes harder to select one data format.


For many years, Shapefile has been the industry standard in terms of vector data, but its drawbacks (its complicated structure, multiple files, and some limitations) made people search for a better solution.


Among the state-of-the-art alternatives is the GeoPackage (.gpkg) format that allows users to merge various properties into one document created by the Open Geospatial Consortium (OGC).


GeoPackage (.gpkg)
GeoPackage (.gpkg)

What Is a GeoPackage?


The GeoPackage, or .gpkg, is a geographical database that is independent of any platform and saved in a single SQLite file. The GeoPackage format primarily changes the method of storing geographical data. Instead of maintaining data in many different files like the Shapefile, all data, including the vector layer, raster tile, attributes, metadata, spatial indexes, and style, are now stored in a single database.


Every file with the .gpkg extension belongs to the OGC GeoPackage Specification, which means it is interoperable across different GIS applications.


The greatest benefit of the GeoPackage format is that it uses SQLite technology, making it light yet easy to distribute in the form of one file.


Why Was GeoPackage Created?


The GeoPackage format was created to solve a variety of issues related to older existing GIS data formats. Among these issues are:


  • Avoiding multiple companion files

  • Ignoring attribute length limitations

  • Using large datasets

  • Combining both vector and raster data

  • Facilitating portability

  • Creating an open and vendor-neutral standard

  • Making mobile GIS workflows easier


How GeoPackage Works


From the inside, GeoPackage works as an SQLite database.


The database consists of the following tables:



In contrast to the flat file concept, GeoPackage thus allows GIS software to fetch information through SQL commands, improving data processing speed for large datasets.


What Can GeoPackage Store?


One of the best things about GeoPackage is that it can do many things.


GeoPackage can keep:


  1. Vector Data


  • Points

  • Lines

  • Polygons

  • MultiPoints

  • MultiLines

  • MultiPolygons

  • Geometry collection


Examples:


  • Roads

  • Rivers

  • Buildings

  • Administrative divisions

  • Utility systems


  1. Raster Data


GeoPackage enables raster tile keeping, such as:



Tiles are in the tile matrix that works like web maps.


  1. Attribute Tables


GeoPackage, like relational databases, supports not spatial tables.


Examples of tables:


  • Lookup

  • Survey data

  • Population

  • Asset inventory


  1. Metadata


GeoPackage has lots of metadata items like:


  • Reference system

  • Description of dataset

  • Date of creation

  • Date of ownership

  • Date of licensing


  1. Several Layers


Unlike a Shapefile, one GeoPackage can have many (even hundreds) layers.


For example


city_data.gpkg


├── Roads

├── Rivers

├── Buildings

├── Schools

├── Hospitals

├── Elevation

├── Land Use

├── Administrative Boundaries

└── Metadata


Everything is in one file with the .gpkg extension.


Benefits of GeoPackage


GeoPackage has many advantages over conventional GIS file formats.


Single File Storage


Shapefiles are composed of multiple files,


  • .shp

  • .shx

  • .dbf

  • .prj

  • .cpg

  • .sbn

  • .sbx


The loss of any single file makes the dataset unusable.


GeoPackage stores everything in a single file.


No Limits on Attribute Length


Shapefiles restrict names of fields to a maximum of 10 characters.


GeoPackage allows:


  • Long field names

  • Use of Unicode characters

  • Increased size of text fields

  • Multiple data types

  • Support of Larger Files


GeoPackage supports databases with sizes reaching multiple terabytes, making it suitable for enterprise-level GIS projects.


Higher Speed


The use of SQLite indexing allows for faster:


  • Spatial queries

  • Selection of features

  • Filtering

  • Attribute searches


Performance improvements are especially evident when dealing with datasets with millions of features.


Open Standard


GeoPackage is:


  • Vendor-independent

  • Open source

  • Internationally standardized

  • Future-proof


The format is free from licensing limitations.


Cross-Platform Capability


GeoPackage can run on:


  • Windows

  • macOS

  • Linux

  • Android

  • iOS


This makes it a great solution for collecting field data and for mobile GIS applications.


Ability to Use Both Raster and Vector Files


GeoPackage, unlike many other formats, stores:


  • Vector layers

  • Raster tiles

  • Attribute tables


in one database.


Feature

GeoPackage

Shapefile

File Structure

Single file

Multiple files

Maximum Field Name Length

Unlimited (practical limits)

10 characters

Unicode Support

Yes

Limited

Raster Support

Yes

No

Multiple Layers

Yes

No

SQL Queries

Yes

No

Spatial Index

Yes

Yes

Metadata

Extensive

Limited

Open Standard

Yes

Partial

Large Dataset Support

Excellent

Limited


Working with GeoPackage in Python


Python developers frequently use GeoPackage with GeoPandas.

Example:

import geopandas as gpd

gdf = gpd.read_file("roads.gpkg")

print(gdf.head())

Saving data:

gdf.to_file(
    "roads.gpkg",
    driver="GPKG"
)

Reading a specific layer:

gdf = gpd.read_file(
    "city_data.gpkg",
    layer="Buildings"
)

GeoPackage Limitations


Despite the versatility of GeoPackage, it still has some restrictions:


  • It is not created for concurrent usage by several individuals at the same time.

  • With a lot of large corporate databases, PostgreSQL/PostGIS is much preferred.

  • Proprietary database types may have certain advanced GIS software features.

  • Efficiency of performance lowers in case spatial indexes are not properly organized.


In case of desktop and project workflows, GeoPackage could be one of the best possible choices.


GeoPackage Best Practices


To get the most from GeoPackage usage:


  • Ensure that related layers are stored in one file.

  • Make sure to use descriptive layer names.

  • Spatial indexes should be made for all datasets that are large in terms of size.

  • Keep the metadata as fresh as possible.

  • Conduct validation of CRS.

  • Always create proper backups of the important GeoPackage files.

  • Avoid the duplication of layers, if possible.

  • Try to compress rasters if possible.


When Should You Use GeoPackage?


Though it could be considered a very suitable option when it comes to situations such as:


  • Transfer of GIS information between different environments.

  • Saving different vector layers into one single file.

  • Working with both vector and raster datasets.

  • Creating offline map applications for mobile devices.

  • Working with open source GIS software.

  • Handling large volumes of geo-information smoothly.

  • Substituting the traditional format of Shapefiles with a more modern one.


GeoPackage is regarded as the top technology for geospatial data formats today. GeoPackage is capable of combining the features of SQLite database technology and the OGC openness, thereby avoiding the disadvantages associated with all other old file formats such as Shapefile.


Regardless of whether GeoPackage is used in the form of vector or raster data or attribute tables, it is capable of organizing the data in one file. This technology's impact includes usage on all major GIS technologies, compatibility with Python libraries, and availability for all variations of technology, such as desktop and mobile.


For more information or any questions regarding GeoPackage, please don't hesitate to contact us at:


Email:


USA (HQ): (720) 702–4849




Comments


bottom of page