Skip to main content
The GeoPackage specification is designed to be extensible. Extensions allow implementors to add capabilities — new table types, spatial indexes, styling, metadata, and more — while still producing valid GeoPackage files. Each extension is declared in the gpkg_extensions system table so that any conformant reader knows which extensions are in use.

How Extensions Are Registered

Every extension registers one or more rows in the gpkg_extensions table. A row captures:
  • table_name – the table the extension applies to (or NULL for a file-level extension)
  • column_name – the specific column affected (or NULL)
  • extension_name – a namespaced identifier in the form author_name (e.g. gpkg_rtree_index, nga_feature_style)
  • definition – a URL pointing to the extension specification
  • scope – either read-write or write-only
Readers that encounter an unknown read-write extension should treat the file as potentially invalid for their use case. write-only extensions can be safely ignored by read-only consumers.

Managing Extensions

ExtensionManager

ExtensionManager is the central coordinator for all GeoPackage extensions. It delegates to registered ExtensionManagement implementations and handles bulk operations like deleting or copying all extensions for a table.
import { GeoPackageAPI } from '@ngageoint/geopackage';

const geoPackage = await GeoPackageAPI.open('my.gpkg');
const extensionManager = geoPackage.getExtensionManager();

// Delete all extensions associated with a table
extensionManager.deleteTableExtensions('my_features');

// Copy all extensions from one table to another
extensionManager.copyTableExtensions('my_features', 'my_features_copy');

NGAExtensions

NGAExtensions manages the suite of community extensions developed by the National Geospatial-Intelligence Agency (NGA). It is automatically registered with ExtensionManager and handles the geometry index, tile scaling, feature styles, contents ID, and feature-tile link extensions.
import { NGAExtensions } from '@ngageoint/geopackage';

const nga = new NGAExtensions(geoPackage);

// Delete all NGA extensions for a specific table
nga.deleteTableExtensions('my_features');

// Delete all NGA extensions from the entire GeoPackage
nga.deleteExtensions();
NGA extensions are community extensions and use the author prefix nga_. They are not part of the core OGC GeoPackage specification but are widely supported.

Available Extensions

RTree Spatial Index

OGC extension (gpkg_rtree_index). Stores a SQLite R*Tree virtual table for fast bounding-box spatial queries on feature geometry columns.

Related Tables

OGC community extension (gpkg_related_tables). Defines many-to-many relationships between any two GeoPackage tables using mapping tables and an gpkgext_relations catalog.

Feature Style

NGA extension (nga_feature_style). Associates visual style rules (color, width, fill, icons) with feature tables and individual feature rows for rendering.

Metadata

OGC extension (gpkg_metadata). Attaches structured metadata documents (ISO 19115, Dublin Core, etc.) to the GeoPackage, individual tables, columns, or specific rows.

Additional NGA Extensions

ExtensionAuthorDescription
Geometry IndexngaAlternative geometry index stored in GeoPackage extension tables (nga_geometry_index). Useful when SQLite RTree is unavailable.
Contents IDngaAssigns stable integer IDs to GeoPackage contents entries for use by other extensions.
Tile ScalingngaConfigures zoom-level scaling strategies for tile layers.
Feature-Tile LinkngaLinks feature tables to corresponding tile tables for coordinated rendering.
PropertiesngaStores key-value property metadata about the GeoPackage itself.
SchemagpkgDocuments column-level metadata including data types, constraints, and human-readable names via gpkg_data_columns.
CRS WKTgpkgAdds Well-Known Text (WKT) representations for coordinate reference systems beyond those built into the core spec.

Build docs developers (and LLMs) love