GpkgFeatureStore

class GpkgFeatureStore(geoPackage: GeoPackage, content: GpkgContent, val cachePolicy: CachePolicy = CachePolicy.UNBOUNDED) : FeatureStore, CachedSourceInfoProvider

GeoPackage-backed FeatureStore. One instance binds to one data_type='features' table (identified by content).

The features table is a flat, standard GeoPackage features layer (geometry + properties JSON + an optional feature_uid), spatially indexed by RTree. Tile coverage — which (z, x, y) regions were fetched, their freshness, and the empty/negative-cache flag — lives in the separate ww_feature_coverage side table, so this layer reads cleanly in any external GIS. Tile reads resolve through coverage, then serve the tile's bbox of features.

Constructors

Link copied to clipboard
constructor(geoPackage: GeoPackage, content: GpkgContent, cachePolicy: CachePolicy = CachePolicy.UNBOUNDED)

Properties

Link copied to clipboard
open override val cacheInfo: CachedSourceInfo
Link copied to clipboard
open override val cachePolicy: CachePolicy

Functions

Link copied to clipboard
open suspend override fun deleteTile(z: Int, x: Int, y: Int)

Drop a tile entry from the store.

Link copied to clipboard
open suspend override fun evict()

Apply cachePolicy now. Idempotent / unbounded → no-op.

Link copied to clipboard
open suspend override fun readAll(): ERROR CLASS: Symbol not found for Flow<earth/worldwind/layer/source/CachedFeatureRow>

Read every bulk row ((z, x, y) IS NULL) in insertion order.

Link copied to clipboard
open suspend override fun readBySector(sector: Sector): ERROR CLASS: Symbol not found for Flow<earth/worldwind/layer/source/CachedFeatureRow>

Read only the bulk rows whose geometry intersects sector. The default ignores sector and returns readAll — correct but unbounded; a spatially-indexed store (GeoPackage RTree) overrides it to serve viewport reads without loading the whole table.

Link copied to clipboard
open suspend override fun readTile(z: Int, x: Int, y: Int, sector: Sector? = null): ERROR CLASS: Symbol not found for Flow<earth/worldwind/layer/source/CachedFeatureRow>??

Read rows for one tile, or null if the tile is absent (cache miss). An empty flow distinguishes "tile cached with zero rows" from "tile not cached". sector is the tile's true geographic bounds for the spatial query; null → derive Web-Mercator slippy bounds from (z, x, y) (back-compat for slippy-keyed tiles).

Link copied to clipboard
open suspend override fun readTileLastModified(z: Int, x: Int, y: Int): Long?

Epoch-millis the tile at (z, x, y) was last written, for stale-while-revalidate. Default null = freshness isn't tracked (the store opts out of SWR — its tiles are served but never background-refreshed).

Link copied to clipboard
abstract suspend fun replaceAll(rows: kotlinx/coroutines/flow/Flow<earth/worldwind/layer/source/CachedFeatureRow>)

Atomically replace every bulk row with the supplied flow. Existing tile-addressed rows are left untouched.

open suspend override fun replaceAll(rows: ERROR CLASS: Symbol not found for Flow<earth/worldwind/layer/source/CachedFeatureRow>)
Link copied to clipboard
open suspend override fun setBoundingSector(sector: Sector)

Persist sector as the store's content bounding box — the data-availability extent a bulk download records (e.g. gpkg_contents). Default no-op for stores without one.

Link copied to clipboard
open suspend override fun sizeBytes(): Long

Approximate byte size of all rows in the store.

Link copied to clipboard
abstract suspend fun writeTile(z: Int, x: Int, y: Int, rows: kotlinx/coroutines/flow/Flow<earth/worldwind/layer/source/CachedFeatureRow>, sector: Sector? = null)

Atomically replace rows for one tile. Pass an empty flow to record "tile has no features" — that's the negative cache for ocean / empty Overpass responses. sector is the tile's true geographic bounds (null → slippy bounds from (z, x, y)).

open suspend override fun writeTile(z: Int, x: Int, y: Int, rows: ERROR CLASS: Symbol not found for Flow<earth/worldwind/layer/source/CachedFeatureRow>, sector: Sector?)