Skip to main content
GeoPackage JS is a full implementation of the OGC GeoPackage specification, published by the National Geospatial-Intelligence Agency (NGA). It runs in both Node.js (12+) and modern browsers, giving you a single library for all your geospatial data access needs.

Quick Start

Get a GeoPackage open and querying features in under 5 minutes.

Installation

Install via npm, yarn, or use the browser bundle directly.

Core Concepts

Understand the GeoPackage format — features, tiles, attributes, and extensions.

API Reference

Explore the full TypeScript API with type signatures and examples.

What is GeoPackage?

GeoPackage is an open, standards-based, platform-independent, portable, self-describing, compact format for transferring geospatial information. A .gpkg file is a single SQLite database that stores:
  • Feature data — vector geometries (points, lines, polygons) with attributes
  • Tile data — raster map tiles at multiple zoom levels
  • Attribute data — non-spatial tabular data
  • Extensions — optional capabilities like spatial indexes, related tables, and feature styles

Key capabilities

Read & write GeoPackages

Open existing .gpkg files or create new ones from scratch — in Node.js or the browser.

Feature queries

Query feature tables with spatial bounding box filters, GeoJSON output, and paginated results.

Tile rendering

Retrieve and render map tiles from tile tables, with reprojection and web mercator support.

Spatial indexing

Use the RTree extension for fast bounding-box queries across large feature datasets.

GeoJSON support

Import and export feature data as GeoJSON with full geometry type support.

TypeScript first

Full TypeScript type definitions included — no separate @types package needed.

Getting started

1

Install the package

npm install @ngageoint/geopackage
2

Open a GeoPackage

import { GeoPackageManager } from '@ngageoint/geopackage';

const geoPackage = await GeoPackageManager.open('/path/to/file.gpkg');
3

Query features

const featureTables = geoPackage.getFeatureTables();
const geoJSONResultSet = geoPackage.queryForGeoJSONFeatures(featureTables[0]);

for (const feature of geoJSONResultSet) {
  console.log(feature);
}
geoJSONResultSet.close();
4

Clean up

geoPackage.close();
GeoPackage JS is an OGC-listed GeoPackage implementation. The library follows the OGC GeoPackage spec closely and is designed to interoperate with other compliant tools.

Build docs developers (and LLMs) love