Skip to content

Add client-side GeoPackage map source type - #175

Open
JakeGimenes wants to merge 5 commits into
tethysplatform:mainfrom
JakeGimenes:feature/geopackage-upstream
Open

Add client-side GeoPackage map source type#175
JakeGimenes wants to merge 5 commits into
tethysplatform:mainfrom
JakeGimenes:feature/geopackage-upstream

Conversation

@JakeGimenes

Copy link
Copy Markdown

Summary

Adds a GeoPackage map source type rendered entirely in the browser — no backend conversion endpoint and no server-side GIS dependencies. A GeoPackage (.gpkg) is an OGC SQLite database; this reads it client-side with ol-load-geopackage + sql.js (WebAssembly SQLite) and reprojects with proj4, then hands the features to the existing client-vector path so styling, click-query, and snapping work unchanged. One map layer maps to one feature table (url + layer name).

Changes

  • ModuleLoader.jsloadGeoPackage() with s3://→https translation, WGS84 UTM proj4 registration, lazy lib/wasm init, and a parse-once cache keyed by url+projection (one file often backs several layers).
  • utilities.js — registers GeoPackage as a client vector source + its config (url + table name).
  • webpack.config.js — emits sql-wasm.wasm; stubs node-core modules (fs/path/crypto) so sql.js builds for the browser.
  • package.json — adds ol-load-geopackage, proj4, sql.js (frontend only — no Python deps).
  • Tests — URL translation, CRS registration, table selection, caching, and error paths.
  • Docs — new GeoPackage section in the map source docs.

Testing

  • eslint + prettier clean on changed files.
  • Full Jest suite: 2531 passed / 132 suites (includes 16 new GeoPackage tests).
  • Production webpack build: 0 errors, sql-wasm.wasm emitted.
  • Manual: loaded a real 36 MB GeoPackage (EPSG:32615 / UTM 15N); all feature tables render correctly reprojected.

Notes

  • Frontend-only; no pyproject.toml / backend changes.
  • Known perf caveat: a very dense table (e.g. 100k+ polygons) taxes OpenLayers' canvas vector renderer when zoomed out. Recommended mitigation is a min-zoom threshold on dense layers (documented); GPU/WebGL rendering is a possible future enhancement.

🤖 Generated with Claude Code

Render GeoPackage (.gpkg) vector tables entirely in the browser via
ol-load-geopackage + sql.js (WebAssembly SQLite), reprojected with proj4,
with no backend conversion endpoint. GeoPackage joins the existing
client-vector source path so styling, click-query, and snapping work
unchanged; one map layer maps to one feature table (url + layer name).

- ModuleLoader.js: loadGeoPackage() with s3://->https translation, WGS84
  UTM proj4 registration, lazy lib/wasm init, and parse-once cache keyed
  by url+projection (one file often backs several layers).
- utilities.js: register GeoPackage as a client vector source + config.
- webpack.config.js: emit sql-wasm.wasm; stub node-core modules for browser.
- Tests for URL translation, CRS registration, table select, caching,
  and error paths; docs section for the source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants