A GeoPackage is an SQLite 3 database laid out as the OGC GeoPackage Encoding Standard says. This page follows version 1.4 of the standard, read 2026-11-12, and notes where earlier versions differ.
Application ID and version
| SQLite header field | Value |
|---|---|
| Application ID (offset 68) | 47 50 4B 47, GPKG, from version 1.2. Version 1.0 wrote GP10 and 1.1 GP11. |
| User version (offset 60) | The version as a five-digit number: major, two-digit minor, two-digit bug fix; 1.3.0 is 10300 (0x0000283C). |
Required tables
gpkg_spatial_ref_sys
Columns: srs_name, srs_id (primary key),
organization (such as EPSG),
organization_coordsys_id, definition (WKT) and
description. The CRS WKT extension adds
definition_12_063 (WKT 2). Three rows are required: 4326
(WGS 84), -1 (undefined Cartesian) and 0 (undefined
geographic).
gpkg_contents
| Column | Meaning |
|---|---|
table_name | The layer’s table. |
data_type | features, tiles or attributes (a table with no geometry); extensions add others, such as 2d-gridded-coverage. |
identifier, description | Human-readable name and text. |
last_change | When the table’s content last changed: ISO 8601, in the standard’s DATETIME format. |
min_x, min_y, max_x, max_y | Extent. |
srs_id | Coordinate system. |
Features
gpkg_geometry_columns has one row per feature table:
table_name, column_name, geometry_type_name
(GEOMETRY, POINT, LINESTRING,
POLYGON, MULTIPOINT, MULTILINESTRING,
MULTIPOLYGON, GEOMETRYCOLLECTION, and through an extension
the curve types), srs_id, and z and m
(0 prohibited, 1 mandatory, 2 optional).
A feature table has an integer primary key and one geometry column holding
geometry blobs. The R-tree extension adds an SQLite R*Tree
virtual table rtree_<table>_<column> kept in step by
triggers.
Tiles
gpkg_tile_matrix_set:table_name,srs_id, and the tile grid’s extentmin_xtomax_y.gpkg_tile_matrix: per table and zoom level,matrix_widthandmatrix_height(tiles),tile_widthandtile_height(pixels), andpixel_x_sizeandpixel_y_size(map units).- The tile table:
id,zoom_level,tile_column,tile_row,tile_data(PNG or JPEG; WebP through an extension). Rows count from the top, unlike MBTiles.
Optional tables
gpkg_extensions:table_name,column_name,extension_name(such asgpkg_rtree_index),definition,scope(read-writeorwrite-only).gpkg_data_columnsandgpkg_data_column_constraints(schema extension): titles, descriptions and allowed values for columns.gpkg_metadataandgpkg_metadata_reference(metadata extension): metadata documents attached to the package, tables, columns or rows.
Geometry blobs
| Offset | Size | Field |
|---|---|---|
0 | 2 | Magic 47 50, GP. |
2 | 1 | Version: 0 means version 1. |
3 | 1 | Flags, below. |
4 | 4 | srs_id, in the byte order the flags give. |
8 | 0 to 64 | Envelope: doubles, in the order minx, maxx, miny, maxy, then minz, maxz and/or minm, maxm. |
| … | … | The geometry in ISO well-known binary, with its own byte-order mark. |
| Flag bits | Meaning |
|---|---|
| 7 and 6 | Reserved, 0. |
| 5 | X: 1 for an extended GeoPackage binary (geometry types from an extension). |
| 4 | Y: 1 for an empty geometry. |
| 3 to 1 | Envelope: 0 none; 1 X and Y (32 bytes); 2 X, Y and Z (48); 3 X, Y and M (48); 4 X, Y, Z and M (64); 5 to 7 invalid. |
| 0 | Byte order of the header numbers: 0 big-endian, 1 little-endian. |
Well-known binary geometry types: 1 Point, 2 LineString, 3 Polygon, 4 MultiPoint, 5 MultiLineString, 6 MultiPolygon, 7 GeometryCollection; add 1000 for Z, 2000 for M, 3000 for Z and M.
47 50 00 03 E6 10 00 00 "GP", version 1, flags: little-endian, XY envelope; srs_id 4326
…32 bytes of envelope… minx, maxx, miny, maxy
01 01 00 00 00 … WKB: little-endian Point, then X and Y