GeoPackage — Modern SQLite Format for GIS: What It Is and How to Export from OpenStreetMap

2026-04-079 min read
GeoPackageGPKGSQLiteOGCGIS

GeoPackage is a spatial database based on SQLite, packaged into a single file with a .gpkg extension. Unlike Shapefile, which drags along a mandatory mini-zoo of four to six files (.shp, .shx, .dbf, .prj, .cpg), GeoPackage compresses everything into one container: vector layers, raster tiles, ISO 19115 metadata, and even QML or SLD styles. OGC standard 12-128, adopted in February 2014, made GeoPackage the official modern Shapefile replacement. Technically, the file is plain SQLite 3 — you can open it in DB Browser for SQLite or from the command line via sqlite3 file.gpkg and run an SQL query against the gpkg_contents table. No reverse engineering, no proprietary magic.

Map generation of Nizhny Novgorod city center
Moscow center, GeoPackage export from osm2cdr.ru, opened in QGIS 3.36. All 16 OSM layers and QML styles inside one file.

History: from Shapefile to OGC standard

By the early 2010s the GIS industry sat at an uncomfortable fork. On one side, the 1998 Shapefile: universal but ancient, with a 2 GB limit, mandatory short field names, no datetime support, no multiple geometries per file. On the other, proprietary databases like Esri FileGDB requiring a dedicated SDK, or MapInfo TAB tied to a specific vendor.

The Open Geospatial Consortium launched a working group in 2011. Key participants included the US Army Geospatial Center (which needed a format for tactical GPS devices), Luciad, Boundless, and a QGIS community group. The goal: a modern single-file format on an open standard, portable, supporting vector, raster, and tiles. The solution was aesthetically elegant: pack everything into SQLite, add special tables with OGC-schema metadata, and document it as a standard.

GeoPackage 1.0 was adopted by OGC on February 12, 2014. There have been six minor updates since; the current stable version is 1.4 (OGC 23-018r1, 2023), almost fully backward-compatible with 1.0. In 2021 OGC adopted an addition — the Related Tables Extension — letting you model many-to-many relationships between geo-objects and attributes.

The fundamental distinction from predecessors is the absence of vendor lock-in. The specification is fully open, published at geopackage.org, and any program can read and write .gpkg without a license and without reverse engineering.

How the file is structured

Every .gpkg is a SQLite 3 database. Open it in DB Browser for SQLite and you'll see 8–15 tables. The base schema:

gpkg_contents (table_name, data_type, identifier, description,
               last_change, min_x, min_y, max_x, max_y, srs_id)

gpkg_geometry_columns (table_name, column_name, geometry_type_name,
                       srs_id, z, m)

gpkg_spatial_ref_sys (srs_name, srs_id, organization, organization_coordsys_id,
                      definition, description)

gpkg_tile_matrix (table_name, zoom_level, matrix_width, matrix_height,
                  tile_width, tile_height, pixel_x_size, pixel_y_size)

features_buildings (fid INTEGER PRIMARY KEY, geom GEOMETRY, name TEXT, ...)
features_roads     (fid INTEGER PRIMARY KEY, geom GEOMETRY, highway TEXT, ...)

Geometry is stored in the geom column as WKB (Well-Known Binary) — standard OGC encoding of points, lines, polygons. The spatial index is built on R-tree — a SQLite-builtin module giving fast intersection queries. "Find all buildings in a bbox area" works in milliseconds on a file with hundreds of thousands of objects.

An additional plus — QGIS writes QML styles directly into the .gpkg, in the layer_styles table. One file shipped to a colleague, opened in QGIS, layers immediately styled by the author with no need to ship separate .qml files. ArcGIS Pro doesn't read this table, but SLD fallback covers styles there too.

Who needs GeoPackage

GIS analyst in a mixed team. If a project uses both QGIS and ArcGIS Pro, passing data through Shapefile means losing attributes with long names, .dbf Cyrillic issues, no datetime. GeoPackage solves all this: UTF-8 native, unlimited column names, datetime via SQLite, no extension files.

Enterprise consultant syncing PostGIS to desktop. Via ogr2ogr -f GPKG output.gpkg PG:'host=... dbname=...' -t_srs EPSG:3857 you can extract a snapshot of part of a PostGIS database into one .gpkg, send it to a client, and not worry about setting up their server access. The file lives as an email attachment or Dropbox link.

Mobile cartographer. Mergin Maps (formerly Input) and QField — field-work applications for Android/iOS — use GeoPackage as native storage. A surveyor heads into the field with a tablet, opens a .gpkg with the object base, edits on location, then syncs with the server.

Government GIS data archivist. Open OGC standard gives a guarantee: the file will be readable in 30 years. Critical for municipal and cadastral archives where data cannot be locked into a specific vendor's SDK.

GeoPackage-reading software

QGIS. Free, GPL. Native support — the main reference. Open via Layer → Add Vector Layer, or drag-and-drop. Reading and writing layers, tiles, styles. Version 3.36 LTR. qgis.org

ArcGIS Pro. Paid, around 1500 USD/year. Full support from version 2.9 (2021). Via ArcGIS Pro → Add Data → pick .gpkg. SLD styles picked up, QML ignored, but geometry plumbing works perfectly.

GDAL/OGR. Free. ogr2ogr -f GPKG output.gpkg input.shp is the standard conversion. Support for 100+ source formats. For Python users — Fiona or GeoPandas (gpd.read_file('file.gpkg')).

FME, Safe Software. Paid, around 1500 USD/year. Industrial ETL tool. Full GeoPackage support including separate handling of all tables.

Mergin Maps + QField. Free basic, paid sync tiers. Android and iOS. Field data entry, GPS points added directly into .gpkg tables. merginmaps.com, qfield.org

MapServer and GeoServer. Free web servers for WMS/WMTS. Both can publish GeoPackage as data source.

DB Browser for SQLite. Free. Not a GIS tool but excellent for debugging: open .gpkg, browse the table structure, run SQL. sqlitebrowser.org

Pros and cons

Pros. Open OGC standard — compatibility and preservation guarantee. Single-file — one .gpkg replaces a Shapefile zoo of 5+ files. Support for everything: vector layers, raster tiles, metadata, QML/SLD styles. UTF-8 by default, datetime, unlimited column names. SQLite-builtin R-tree spatial index gives fast spatial queries. Size up to 140 TB (SQLite's theoretical limit). Direct SQL access for analytics without specialized GIS.

Cons. Concurrency: SQLite uses file-level locking, so two users can't simultaneously edit one .gpkg. For multi-user scenarios PostGIS is better. The R-tree spatial index can break on improper write termination — periodic VACUUM is needed. ArcGIS Pro ignores QML styles (convert to SLD). Minor version incompatibilities are rare but known (e.g., a JSON extension from 1.3 may not open in a tool reading only 1.0).

GeoPackage vs Shapefile

Parameter GeoPackage Shapefile
Standard OGC 12-128 (2014) Esri 1998
Files 1 (.gpkg) 4–6 (.shp/.shx/.dbf/.prj/.cpg/.sbn)
Size Up to 140 TB Up to 2 GB
Column names Any length Max 10 chars
Datetime Yes No (date only)
Multiple geometry types Yes No (1 per file)
Raster tiles Yes No
Encoding UTF-8 native Depends on .cpg, default latin1
Spatial index R-tree built-in .sbn/.sbx optional
Styles QML/SLD inside External .lyr only

A full comparison is in a separate article. Short rule: for a new 2026 project, pick GeoPackage. Shapefile is needed only when the recipient explicitly requires it — e.g., a Russian cadastral office or an old ArcGIS 9 team.

How to make a GeoPackage from OpenStreetMap

Step 1. On osm2cdr.ru pick GeoPackage from the format dropdown. GIS / Database category.

Step 2. Draw the area. GeoPackage has essentially no area limit — our export handles up to 500 km² in one file, beyond that tiering kicks in. For a city block, 0.5–2 km².

Step 3. Layers. All 16 base OSM layers (buildings, roads, water, green, railways, barriers, POI, labels) on by default. Uncheck what you don't need for a thematic file — e.g., only green for urban planning.

Step 4. CRS. For GIS work, metric (UTM or MSK). Web Mercator (EPSG:3857) for web maps. WGS 84 (EPSG:4326) for global tasks. All 165 CRS available.

Step 5. Cartographic style. standard for classic OSM colors, monochrome for technical basemaps, blueprint for visual presentations. The style saves as a QML record in the layer_styles table.

Step 6. Click Export. Render takes 60–180 seconds for a medium bbox. Download the .gpkg and open in QGIS — all layers come up styled.

Get a GeoPackage of Kremlin in 90 Seconds

Pitfalls

Concurrent writes. SQLite uses an exclusive write lock. Two users editing the same .gpkg over a network share is a recipe for a corrupted database. For multi-user, use PostGIS, or Mergin Maps as sync middleware.

Vacuum after big edits. After deleting thousands of records, file size doesn't shrink automatically. Run VACUUM via DB Browser or ogrinfo -sql 'VACUUM' file.gpkg to reclaim space. On large files vacuum can take minutes — don't panic.

Minor versions. GeoPackage 1.3+ added a JSON column type and the Related Tables Extension. If your consumer uses old QGIS 3.16 LTR, they may not understand these extensions. We write core 1.0 without extensions for maximum compatibility.

Tiles inside .gpkg. Raster tiles can be packed in the same file as vector layers. Convenient for self-contained maps but inflates file size. For separate tile hosting, PMTiles or MBTiles are better.

FAQ

How is GeoPackage different from Shapefile? GeoPackage is a modern OGC standard from 2014 based on SQLite, one file, support for UTF-8, datetime, tiles, and styles. Shapefile is the Esri standard from 1998, 4–6 files per layer, 2 GB limit, short column names.

Can I open .gpkg without a GIS program? Yes — any SQLite tool (DB Browser, sqlite3 CLI). Geometry is stored as WKB and parsed separately, but you'll see the structure and attributes.

Does GeoPackage support raster? Yes, via the gpkg_tile_matrix table for tiles. In practice for standalone raster hosting GeoTIFF or COG is more common.

What is the layer_styles table? A QGIS extension on top of the OGC standard, holding QML styles inside the .gpkg. QGIS picks them up automatically. ArcGIS doesn't read them, but SLD fallback works.

Is there a size limit? SQLite's theoretical limit is 140 TB. In practice files over 50 GB become awkward to operate on. For very large datasets, PostGIS or GeoParquet.

Sources

← All articles