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-13 (the HTML at geopackage.org/spec140/), 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.
Data types (Table 1)
Columns in a GeoPackage SHALL be declared with only these types (extensions may add more). Writers SHOULD validate values and readers SHOULD allow for unexpected values, since SQLite does not enforce ranges (and cannot for views).
| Type | Stored as |
|---|---|
BOOLEAN | INTEGER 0 or 1. |
TINYINT | 8-bit signed, −128 to 127, as INTEGER. |
SMALLINT | 16-bit signed, −32768 to 32767. |
MEDIUMINT | 32-bit signed, −2147483648 to 2147483647. |
INT, INTEGER | 64-bit signed. |
FLOAT | 32-bit IEEE number, as REAL limited to values a 4-byte float can hold. |
DOUBLE, REAL | 64-bit IEEE number, as REAL. |
TEXT{(maxchar_count)} | UTF-8 or UTF-16 as the database’s PRAGMA encoding says; the optional count is the maximum number of characters. |
BLOB{(max_size)} | Binary data; the optional size is informational. |
| geometry type name | A geometry in the GeoPackage binary encoding; a core type from Annex G (code 0 GEOMETRY, 1 POINT, 2 LINESTRING, …) or an extension type. |
DATE | ISO 8601 YYYY-MM-DD as TEXT. |
DATETIME | ISO 8601 date and time as TEXT (the strftime('%Y-%m-%dT%H:%M:%fZ','now') form used by last_change). |
Table definitions (Annex C)
The normative column lists (spec 1.4, read 2026-11-13). Column order, check constraints and triggers do not matter to conformance, but names, types, nullability, defaults and primary, foreign and unique keys must match.
gpkg_spatial_ref_sys:srs_nameTEXT NOT NULL,srs_idINTEGER PRIMARY KEY,organizationTEXT NOT NULL,organization_coordsys_idINTEGER NOT NULL,definitionTEXT NOT NULL,descriptionTEXT. Informative views:st_spatial_ref_sys(SQL/MM) andspatial_ref_sys(srid,auth_name,auth_srid,srtext).gpkg_contents:table_nameTEXT PRIMARY KEY,data_typeTEXT NOT NULL,identifierTEXT UNIQUE,descriptionTEXT DEFAULT '',last_changeDATETIME NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),min_x,min_y,max_x,max_yDOUBLE,srs_idINTEGER (foreign key togpkg_spatial_ref_sys).gpkg_geometry_columns:table_name,column_name(primary key together;table_namealso unique),geometry_type_nameTEXT NOT NULL,srs_idINTEGER NOT NULL,zandmTINYINT NOT NULL (0 prohibited, 1 mandatory, 2 optional). Informative viewsst_geometry_columnsandgeometry_columns(f_table_name,f_geometry_column,geometry_typevia an implementer’scode4name()function,coord_dimension,srid).gpkg_tile_matrix_set:table_namePRIMARY KEY,srs_idNOT NULL,min_x,min_y,max_x,max_yDOUBLE NOT NULL.gpkg_tile_matrix:table_name,zoom_level(primary key),matrix_width,matrix_height,tile_width,tile_heightINTEGER NOT NULL,pixel_x_size,pixel_y_sizeDOUBLE NOT NULL. Annex D (informative) gives triggers that reject azoom_levelbelow 0 and similar bad values on insert and update.gpkg_extensions:table_nameTEXT,column_nameTEXT,extension_nameTEXT NOT NULL,definitionTEXT NOT NULL,scopeTEXT NOT NULL, unique on (table_name,column_name,extension_name). Anextension_nameis<author>_<extension_name>, characters[a-zA-Z0-9_], unique and case sensitive; the authorgpkgis reserved for names the standard or an OGC document defines.- Sample tables (informative): a feature table with
id INTEGER PRIMARY KEY AUTOINCREMENTand aGEOMETRYcolumn; a tile pyramid table withid,zoom_level,tile_column,tile_row,tile_data BLOB NOT NULL, unique on zoom, column, row; an attributes table.
Registered extensions (Annex F)
| Extension | Name in gpkg_extensions | What it adds |
|---|---|---|
| F.1 Non-linear geometry types | gpkg_geom_<GNAME>, GNAME the uppercase type name, scope read-write | CircularString, CompoundCurve, CurvePolygon, MultiCurve, MultiSurface, Curve and Surface as geometry_type_name values, in the same binary encoding with the type codes of Annex G; one row per geometry column using them. |
| F.2 User-defined geometry types | – | Removed by the GeoPackage SWG on 2016-08-15 for interoperability concerns (the text is in the 1.1.0 spec). |
| F.3 R-tree spatial indexes | gpkg_rtree_index, scope write-only | An SQLite R*Tree rtree_<t>_<c> (CREATE VIRTUAL TABLE rtree_<t>_<c> USING rtree(id, minx, maxx, miny, maxy), 32-bit floats) per indexed geometry column, filled with ST_MinX etc. and kept by triggers rtree_<t>_<c>_insert, _update2, _update4, _update5, _update6, _update7 and _delete; _update1 and _update3 are deprecated (1.4.0 replaced update1 by update6 and update7, and update3 by update5). |
| F.4, F.5 Geometry type and SRS ID triggers | – | Removed on 2016-08-15 (text in the 1.1.0 spec). |
| F.6 Zoom other intervals | gpkg_zoom_other, column tile_data, scope read-write | Pixel sizes in gpkg_tile_matrix may differ by irregular factors or by factors other than 2 between adjacent zoom levels. |
| F.7 Tiles encoding WebP | gpkg_webp, column tile_data, scope read-write | Allows WebP (image/x-webp) tile data besides PNG and JPEG. |
| F.8 Metadata | gpkg_metadata | Tables below. |
| F.9 Schema | name not confirmed in the text read | gpkg_data_columns and gpkg_data_column_constraints, below. |
| F.10 WKT for CRS | name not confirmed in the text read | Adds a definition_12_063 TEXT NOT NULL column to gpkg_spatial_ref_sys holding the OGC 12-063 (later 18-010) WKT. |
| F.11 Tiled gridded coverage data | – | Published separately as OGC 17-066r1. |
| F.12 Related tables | – | Published separately as OGC 18-000. |
Annex F’s overview table lists the extensions by title only (“Metadata”, “Schema”, “WKT for Coordinate Reference Systems”,
“Related Tables” …) with a content type; the registered extension_name strings are given in each extension’s own
clause. For F.8 the text says rows with the name gpkg_metadata must comply; the strings for F.9 and F.10 were not
located in the text read.
Metadata tables (F.8)
gpkg_metadata:idINTEGER PRIMARY KEY AUTOINCREMENT,md_scopeTEXT NOT NULL DEFAULT 'dataset',md_standard_uriTEXT NOT NULL,mime_typeTEXT NOT NULL DEFAULT 'text/xml',metadataTEXT NOT NULL DEFAULT ''. Scopes (code): undefined (NA), fieldSession (012), collectionSession (004), series (006), dataset (005), featureType (010), feature (009), attributeType (002), attribute (001), tile (016), model (015), catalog (NA), schema (NA), taxonomy (NA), software (013), service (014); the list is not exhaustive and new scopes are permitted.gpkg_metadata_reference:reference_scopeTEXT NOT NULL,table_nameTEXT,column_nameTEXT,row_id_valueINTEGER,timestampDATETIME NOT NULL,md_file_idINTEGER NOT NULL (foreign key togpkg_metadata.id),md_parent_idINTEGER (the parent, different frommd_file_id).reference_scopeisgeopackage,table,column,roworrow/col(lowercase);table_nameis NULL forgeopackage;column_nameis NULL forgeopackage,tableandrow;row_id_valueis NULL forgeopackage,tableandcolumn. The validation triggers of 1.2.1 and earlier were removed in 1.3.0.
Schema tables (F.9)
gpkg_data_columns:table_name,column_name(primary key),name,title,description,mime_type,constraint_name(unique ontable_name,name).gpkg_data_column_constraints:constraint_nameTEXT NOT NULL,constraint_typeTEXT NOT NULL (range,enumorglob),valueTEXT,minNUMERIC,min_is_inclusiveBOOLEAN,maxNUMERIC,max_is_inclusiveBOOLEAN,descriptionTEXT; unique on (constraint_name,constraint_type,value).
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