.gpkg file, inspect its contents, and extract features and tiles.
Open the GeoPackage
GeoPackageManager.open() works in both Node.js (file path) and the browser (byte array).- Node.js
- Browser
In Node.js, pass a file-system path as a string. In the browser, pass a
Uint8Array of the file bytes.
The library validates the .gpkg extension before opening; passing an invalid path throws a GeoPackageException.List tables
A GeoPackage contains feature tables (vector data) and tile tables (raster data). Retrieve their names before working with them.
Inspect table metadata
getInfoForTable() accepts either a TileDao or a FeatureDao and returns a plain object with table name, row count, column definitions, SRS, and—for feature tables—geometry column details.Query features as GeoJSON
queryForGeoJSONFeatures() returns a GeoJSONResultSet that yields standard GeoJSON Feature objects. This is the easiest way to get features into a mapping library.BoundingBox to limit results to a spatial extent:Read tiles
Use
TileDao.queryForTile() to fetch the raw bytes stored in the GeoPackage, or use GeoPackageTileRetriever to retrieve a web-mercator tile reprojected on the fly.