Geo Package
Functions
Refresh only GpkgTileRevalidation.validatedAt for tile row tpudtId — the 304-Not-Modified path, where the bytes and validators are unchanged but we want the freshness window to restart so the tile isn't re-requested every frame. Read-modify-write preserves the stored ETag / Last-Modified. No-op when the tile has no revalidation row yet.
Refresh GpkgTileRevalidation.validatedAt for many (z, x, y) tiles of content in ONE write-dispatcher hop and ONE transaction — the coalesced restamp path for validator-less stale tiles, where per-tile commits flooded the write lane during panning. Unlike bumpTileValidatedAt, a tile with no revalidation row yet gets one created (null validators): tiles cached before the side table existed could otherwise never be stamped fresh and re-entered the stale path on every read. Uncached (z, x, y) are skipped.
Drop every coverage row tied to content. Called when the content table is cleared.
Drop every revalidation row tied to content. Called when the content table is cleared.
Delete specified content table and its related metadata
Evict from a features cache per policy, driven by ww_feature_coverage:
Evict image/elevation/vector tiles per policy. Capacity-only: CachePolicy.staleAfter never deletes (stale tiles refresh in place via SWR). CachePolicy.maxEntries (row count) drops oldest-inserted rows first (by id, the autoincrement PK), one row per tile so a tile is never split. No-op when read-only or unbounded.
Convert a Geometry into Renderables using the given (optional) feature style. Public so the WFS cache replay path can call it directly; subclasses can still override to specialise rendering.
Direct web-service lookup by table name. Does NOT require a GpkgContent row to exist — capabilities metadata is independent of any tile/feature pyramid being provisioned for the same key, so this query stays cheap and unconditional.
Per-put eviction trigger called after a successful blob upsert in GpkgBlobStore.
Per-put eviction trigger called after writeFeatureTile; insertedRows accounts for multi-row writes. Note: uid-upserts and bbox-replace can net zero new rows, so the in-memory counter may overcount — eviction reads SQLite ground truth and no-ops harmlessly.
Per-put eviction trigger called after writeTileUserData.
Total cached bytes in a 3D Tiles blob-store table. Reads the precomputed size_bytes column instead of LENGTH(tile_data) so the scan stays in the row header and doesn't touch every BLOB page.
Read back features previously cached via replaceCachedFeatures.
Feature coverage row for the tile region (z, x, y) of content's features table, or null when that region has never been fetched.
Read every flat-store feature intersecting the geographic bbox (degrees, EPSG:4326) via the RTree spatial index — the arbitrary-viewport counterpart to readFeatureTile.
Read the cached features in tile (z, x, y)'s region via the RTree bbox query. The flat store has no per-tile rows, so this returns every feature intersecting the tile bounds; ww_feature_coverage is what records whether the tile was actually fetched.
Cache freshness row (ETag, Last-Modified, GpkgTileRevalidation.validatedAt) for the tile at (z, x, y) in content. Returns null when nothing has been stored for this tile.
The tile-user-data row id (tpudt_id) for (z, x, y), or null if not cached. Selects only the id — never loads the tile blob — so the SWR freshness check stays cheap.
Replace every row in one transaction. Used by full-refresh sources (WFS, Shapefile); tile-pyramid sources use writeFeatureTile instead.
Persist sector as the gpkg_contents bounding box of content — the SRS-aware inverse of getBoundingSector. For EPSG:3857 the latitude range is clamped to the Web-Mercator limits before conversion to meters.
Update the user-visible identifier on tableName's registration row.
Set up a 3D Tiles GeoPackage extension blob table for tableName. Idempotent: re-opening an existing 3D Tiles content registers the same row + extension entry.
Create a features cache table with universal schema (id, geom, tile_*, properties). Tile columns are NULL for bulk-refresh sources, populated for tile-pyramid sources; the composite index keeps per-tile reads O(log n). Idempotent.
Create (or open) a gridded-coverage tile pyramid. Idempotent — re-running after a partial setup or a previous successful run is a no-op.
Create (or open) an image-tile pyramid table. Idempotent — a prior partial setup or a previous successful run is detected and the existing content row is returned.
Create a tile pyramid for vector tiles. Mirrors setupTilesContent but for a non-raster data_type (typically "vector-tiles") and an arbitrary encoding extension — the user table schema is identical to raster tiles, only the BLOB payload format differs.
Upsert a GpkgWebService row for tableName with the supplied fields. Single entry point for every web-backed cache content (image / elevation / vector-tile / feature) — the previous per-layer-type setup variants have been collapsed here.
Refresh the GpkgContent identifier + bbox to match the layer's current LevelSet.sector and displayName. The level-set sector is the in-memory source of truth for the layer's data extent; this call persists it back to gpkg so the round-trip is safe — open via tryRecoverLevelSet copies the persisted bbox into the level-set sector; the next reopen writes the same value back. Bulk-download mutates the level-set sector before re-binding the cache, so the new extent lands on disk through the same write.
Upsert the coverage row for the tile region (z, x, y) — validators, validatedAt (epoch- millis just confirmed fresh) and the isEmpty negative-cache flag. Creates / declares the side table on first use.
Replace tile (z, x, y)'s features in the flat store and stamp coverage. Rows that carry a stable GpkgFeatureRow.uid upsert by it (so a feature straddling tile borders dedupes to one row); id-less rows replace everything in the tile's bbox. An empty list clears the region and records the negative cache (is_empty) in ww_feature_coverage — no null-geometry sentinel.
Single-transaction upsert of one cached tile: blob, optional gridded ancillary row (elevation) and optional freshness row, plus the content last-change stamp. One writeDispatcher hop and one SQLite commit instead of one per statement — the per-tile cache write path is commit-bound. Returns the tile-user-data row id.
Upsert the tile blob for (z, x, y) and return its tile-user-data row id (the tpudt_id that writeTileRevalidation keys freshness by). The id is stable across rewrites — the row is reused, not re-inserted.