Skip to content

ldproxy extent handling - #511

Merged
azahnen merged 31 commits into
masterfrom
ldp-94-ldproxy-extent-handling
Nov 17, 2026
Merged

azahnen merged 31 commits into
masterfrom
ldp-94-ldproxy-extent-handling

Conversation

@PZahnen

@PZahnen PZahnen commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

Implements the xtraplatform-spatial part of ldproxy/ldproxy#1171: spatial and temporal extents can be configured in the providers instead of only at the API level.

Configuration

Feature providers

  • extent.spatial and extent.temporal on the provider and on each type. A configured extent is never computed. Each part of a type extent replaces the same part of the provider extent.
  • Spatial coordinates are in the native CRS of the provider. Temporal bounds are dates (yyyy-MM-dd, UTC, end inclusive) or date-times with offset; a missing bound is open.
  • computed: true on a type discards an inherited fixed extent. computed: false is rejected, and computed must not be combined with coordinates or bounds.

Tile providers (tilesetDefaults and tilesets, coordinates always in CRS84)

  • Features: if not set, the extent of the feature provider (fixed or computed) is used, as before.
  • HTTP: if not set, the union of the extents of the tile matrix sets is used.
  • MBTiles: if not set, bounds from the MBTiles metadata is used.

Query restriction (SQL providers only, queryGeneration)

  • restrictToSpatialExtent and restrictToTemporalExtent (both default true) add S_INTERSECTS/T_INTERSECTS predicates for fixed extents to all queries for multiple features. Queries for a single feature by id are not restricted.

Behavior changes

  • Fixed extents are returned before the stats cache, so feature changes no longer affect them. Computed extents, including tileset bounds, are still recomputed on changes.
  • WFS and GraphQL providers: an inverted containsKey check made getSpatialExtent (and getFeatureCount for GraphQL) always return nothing; they now return computed values.

Notes

  • FeatureTypeConfiguration.getExtent() conflicts with getExtent() in ldproxy's FeatureTypeConfigurationOgcApi; this is resolved in the related ldproxy PR.
  • All new options are @since v4.9.
  • Tests: SpatialExtentSpec, TemporalExtentSpec, FeatureTypeExtentSpec, ExtentFiltersSpec, TileProviderHttpExtentSpec and extent cases in FilterEncoderSqlSpec (SQL text for PostGIS only).

@PZahnen
PZahnen requested a review from azahnen May 21, 2026 16:54
@PZahnen PZahnen mentioned this pull request May 21, 2026
3 tasks done

@azahnen azahnen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • TemporalExtent
    • should be UTC ISO datetime (YYYY-MM-DDTHH:mm:ss.sssZ)
    • use DateTimeFormatter.ISO_INSTANT.parse to validate
    • add methods for start and end (@Value.Derived, @JsonIgnore) that return Instant (Instant.from(DateTimeFormatter.ISO_INSTANT.parse))
  • SpatialExtent
    • toBoundingBox should be moved here with nativeCrs as parameter
  • FeatureProvider*
    • it seems there is a lot of duplicated code, move to AbstractFeatureProvider where appropiate

@PZahnen

PZahnen commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, should be taken care of now.

@PZahnen
PZahnen requested a review from azahnen May 26, 2026 08:05
@azahnen
azahnen force-pushed the ldp-94-ldproxy-extent-handling branch 3 times, most recently from 219a7ce to deab143 Compare October 31, 2026 19:20
cportele
cportele previously approved these changes Nov 10, 2026

@cportele cportele left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See review in the ldproxy PR for details

azahnen and others added 12 commits November 17, 2026 18:58
FeatureTypeConfiguration is implemented by the collection configuration of
OGC APIs, so the type extent added to it replaced the type of the existing
collection option `extent`. Collection extents of earlier versions were then
read as provider extents: the CRS was ignored and temporal values in
milliseconds failed to load. The type extent stays in FeatureSchema, where
the provider types declare it.
Queries for multiple features are restricted to a fixed extent of the type,
but the feature count was computed for all features. The count query now
applies the same extent filters, so the number of features of a collection
matches numberMatched.
…roviders

Tileset extents in tilesetDefaults and tilesets of the FEATURES, HTTP and
MBTILES tile providers now have the same form as the extent of feature
providers and their types: `extent.spatial`, in CRS84. A temporal extent is
rejected for tiles. Before, a flat `extent` was expected and `extent.spatial`
was ignored without an error.

The extent type is renamed from FeatureTypeExtent to Extent, since it is used
for providers, types and tilesets alike.
The bounding boxes from the capabilities are stored under the ids derived from
the prefixed feature type name (prefix_localname, localname), but were looked
up with the prefixed name, so no type got an extent. With a native CRS84, the
bounding box was also dropped for lack of a transformer.

The bounding box is now returned in CRS84 as given in the capabilities; it was
transformed to the native CRS and back before, which enlarged it.
For data with a start and an end, the computed temporal extent used the
earliest start and the latest end that are set, so a collection with
features that have no end, e.g. current versions, got the end of the
latest closed interval. A missing start or end now makes that side of
the extent unbounded. An empty table still has no temporal extent.

Temporal extents cached by an earlier version are used until the
features of the type or the provider configuration change; clear the
cache to recompute them.
A type with only PRIMARY_INTERVAL_START or only PRIMARY_INTERVAL_END had
no computed temporal extent, so its collection always showed an open
interval. The extent is now computed from the bound that is there, with
the other side unbounded.
When several features were written in one call (e.g. a wfs:Insert with
many features), the spatial and temporal extent of the result only
covered the last one. The extents now cover all written features.

For data with a start and an end, a feature without a start or end now
makes that side of the extent unbounded, also next to features that have
one. Values that the write sets itself, such as the start and the open
end of a new version, are taken into account. A partial update that does
not change the start or the end leaves that side as it is.
An empty `spatial` or `temporal` object stopped the inheritance of a
fixed extent from the parent level, exactly like `computed: true`, but
read as if nothing was set. It is now rejected; to compute the extent
instead of inheriting a fixed one, set `computed: true`.
… end

A partial update that cleared the end without touching the start, or the
start without touching the end, gave no temporal extent, so the extent
did not become unbounded on that side. The unknown side now gets a value
that never widens an extent. An unparsable value no longer makes a side
unbounded either.
The id of a type was tried first and may be the local name of another
WFS feature type. It is now tried after prefix_localname and localname.
@azahnen
azahnen force-pushed the ldp-94-ldproxy-extent-handling branch from cd37970 to cf73ff9 Compare November 17, 2026 17:58
@azahnen
azahnen merged commit 926cbe3 into master Nov 17, 2026
3 checks passed
@azahnen
azahnen deleted the ldp-94-ldproxy-extent-handling branch November 17, 2026 20:49
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.

3 participants