Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f2c01fd
add configurable collection/tileset extents
PZahnen May 12, 2026
89df02b
add TemporalExtent and include extent in FeatureSchema
PZahnen May 15, 2026
df7a23f
add spatial/temporal extent types and usage
PZahnen May 20, 2026
a3256c1
treat computed=true only; handle date-only bounds
PZahnen May 21, 2026
7ede923
adjustments temporalExtent
PZahnen May 22, 2026
dc1ed9b
Update SpatialExtent.java
PZahnen May 22, 2026
5f9f844
refactoring
PZahnen May 22, 2026
2131c95
tiles: extent of http and mbtiles tilesets is in CRS84
azahnen Oct 31, 2026
647bed5
reuse SpatialExtent.toBoundingBox, drop unused imports
azahnen Oct 31, 2026
c165d5b
temporal extent: accept dates, keep open ends open
azahnen Oct 31, 2026
6443f79
tiles: extent of features tilesets is in CRS84
azahnen Oct 31, 2026
37d6e14
extent: only allow computed: true, document options
azahnen Oct 31, 2026
b466b10
extent: add @since v4.9
azahnen Oct 31, 2026
3e58f05
sql: restrict queries to fixed extents
azahnen Oct 31, 2026
3dd2496
tiles: http tilesets fall back to tile matrix set extent
azahnen Oct 31, 2026
5d8d068
extract extent inheritance and query restriction for testing
azahnen Oct 31, 2026
d8a2763
add extent tests
azahnen Oct 31, 2026
543383d
sql: test encoding of extent filters
azahnen Oct 31, 2026
52b138b
sql: separate options for spatial and temporal extent restriction
azahnen Oct 31, 2026
8cc17e6
fix PMD violations in extent handling
azahnen Oct 31, 2026
776cd1c
fix extents of API collections being read as provider extents
cportele Nov 9, 2026
894fd09
fix feature count ignoring the restriction to a fixed extent
cportele Nov 9, 2026
bcc9cb2
tiles: configure tileset extents with extent.spatial as for feature p…
cportele Nov 9, 2026
9159100
fix missing spatial extents of WFS feature types
cportele Nov 9, 2026
0b89744
features: document that only SQL providers restrict queries to a fixe…
cportele Nov 9, 2026
8d4987a
fix computed temporal extents that ignore open starts and ends
cportele Nov 10, 2026
ea9f0f2
fix missing temporal extent of types with only a start or only an end
cportele Nov 10, 2026
73e9da4
fix extent updates after writes that ignore features or open intervals
cportele Nov 10, 2026
49f6115
features: reject extents that set neither values nor computed
cportele Nov 10, 2026
f70ef8b
fix extent updates after partial updates that only clear the start or…
azahnen Nov 17, 2026
cf73ff9
fix WFS feature types getting the bounding box of another type
azahnen Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ public Optional<BoundingBox> parseExtent(String extent, EpsgCrs crs) {

@Override
public Optional<Interval> parseTemporalExtent(String start, String end, ZoneId timeZone) {
if (Objects.isNull(start)) {
return Optional.empty();
}

DateTimeFormatter parser;
if (Objects.isNull(timeZone)) {
parser =
Expand All @@ -118,18 +114,14 @@ public Optional<Interval> parseTemporalExtent(String start, String end, ZoneId t
// Note: Strictly, INFINITY/-INFINITY and INSTANT.MAX/INSTANT.MIN are not the same! May result
// in undesired behavior.
Instant parsedStart;
switch (start.toUpperCase(Locale.ROOT)) {
switch (Objects.requireNonNullElse(start, "-INFINITY").toUpperCase(Locale.ROOT)) {
case "-INFINITY" -> parsedStart = Instant.MIN;
case "INFINITY" -> parsedStart = Instant.MAX;
default -> parsedStart = parser.parse(start, Instant::from);
}

if (Objects.isNull(end)) {
return Optional.of(Interval.of(parsedStart, Instant.MAX));
}

Instant parsedEnd;
switch (end.toUpperCase(Locale.ROOT)) {
switch (Objects.requireNonNullElse(end, "INFINITY").toUpperCase(Locale.ROOT)) {
case "INFINITY" -> parsedEnd = Instant.MAX;
case "-INFINITY" -> parsedEnd = Instant.MIN;
default -> parsedEnd = parser.parse(end, Instant::from);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,34 @@
*/
package de.ii.xtraplatform.features.gml.app;

import static de.ii.xtraplatform.base.domain.util.LambdaWithException.mayThrow;

import de.ii.xtraplatform.crs.domain.BoundingBox;
import de.ii.xtraplatform.crs.domain.CrsTransformer;
import de.ii.xtraplatform.crs.domain.CrsTransformerFactory;
import de.ii.xtraplatform.crs.domain.EpsgCrs;
import de.ii.xtraplatform.crs.domain.OgcCrs;
import de.ii.xtraplatform.features.domain.AggregateStatsReader;
import de.ii.xtraplatform.features.domain.FeatureMetadata;
import de.ii.xtraplatform.features.domain.FeatureSchema;
import de.ii.xtraplatform.features.domain.Metadata;
import de.ii.xtraplatform.streams.domain.Reactive;
import de.ii.xtraplatform.streams.domain.Reactive.Stream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
import org.threeten.extra.Interval;

public class AggregateStatsReaderWfs implements AggregateStatsReader<FeatureSchema> {

private final FeatureMetadata featureMetadata;
private final Optional<CrsTransformer> crsTransformer;

public AggregateStatsReaderWfs(
FeatureMetadata featureMetadata,
CrsTransformerFactory crsTransformerFactory,
EpsgCrs nativeCrs) {
public AggregateStatsReaderWfs(FeatureMetadata featureMetadata) {
this.featureMetadata = featureMetadata;
this.crsTransformer = crsTransformerFactory.getTransformer(OgcCrs.CRS84, nativeCrs, true);
}

@Override
public Stream<Long> getCount(List<FeatureSchema> sourceSchemas) {
return Reactive.Source.single(-1L).to(Reactive.Sink.head());
}

/** The bounding box from the capabilities, in CRS84. */
@Override
public Stream<Optional<BoundingBox>> getSpatialExtent(
List<FeatureSchema> sourceSchemas, boolean is3d) {
Expand All @@ -52,14 +45,10 @@ public Stream<Optional<BoundingBox>> getSpatialExtent(
.map(Metadata::getFeatureTypesBoundingBox)
.flatMap(
boundingBoxes ->
Optional.ofNullable(
boundingBoxes.get(sourceSchemas.get(0).getSourcePath().get().substring(1))))
.flatMap(
boundingBox1 ->
crsTransformer.map(
mayThrow(
crsTransformer1 ->
crsTransformer1.transformBoundingBox(boundingBox1))));
getTypeIds(sourceSchemas.get(0)).stream()
.map(boundingBoxes::get)
.filter(Objects::nonNull)
.findFirst());

return Reactive.Source.single(boundingBox).to(Reactive.Sink.head());
}
Expand All @@ -68,4 +57,25 @@ public Stream<Optional<BoundingBox>> getSpatialExtent(
public Stream<Optional<Interval>> getTemporalExtent(List<FeatureSchema> sourceSchemas) {
return Reactive.Source.single(Optional.<Interval>empty()).to(Reactive.Sink.head());
}

/**
* The ids under which the capabilities analyzer stores the bounding box of a feature type: the
* prefixed name becomes {@code prefix_localname}, and if unique also {@code localname}, both in
* lower case. The id of the type is the last resort.
*/
static List<String> getTypeIds(FeatureSchema schema) {
String prefixedName =
schema.getSourcePath().map(path -> path.substring(1)).orElse(schema.getName());
int separator = prefixedName.indexOf(':');
String localName = prefixedName.substring(separator + 1).toLowerCase(Locale.ROOT);

// the type id comes last, it may be the local name of another feature type
List<String> ids = new ArrayList<>();
if (separator > 0) {
ids.add(prefixedName.substring(0, separator).toLowerCase(Locale.ROOT) + "_" + localName);
}
ids.add(localName);
ids.add(schema.getName());
return ids;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ protected boolean onStartup() throws InterruptedException {
getData().getNativeCrs().orElse(OgcCrs.CRS84),
crsTransformerFactory,
cql);
this.aggregateStatsReader =
new AggregateStatsReaderWfs(
this, crsTransformerFactory, getData().getNativeCrs().orElse(OgcCrs.CRS84));
this.aggregateStatsReader = new AggregateStatsReaderWfs(this);

return true;
}
Expand Down Expand Up @@ -299,10 +297,15 @@ public FeatureSchema getSortablesSchema(

@Override
public Optional<BoundingBox> getSpatialExtent(String typeName) {
if (getData().getTypes().containsKey(typeName)) {
if (!getData().getTypes().containsKey(typeName)) {
return Optional.empty();
}

Optional<BoundingBox> configured = getConfiguredSpatialExtent(typeName);
if (configured.isPresent()) {
return configured;
}

try {
Stream<Optional<BoundingBox>> extentGraph =
aggregateStatsReader.getSpatialExtent(
Expand All @@ -323,24 +326,32 @@ public Optional<BoundingBox> getSpatialExtent(String typeName) {

@Override
public Optional<BoundingBox> getSpatialExtent(String typeName, EpsgCrs crs) {
// a configured extent is in the native CRS, one from the capabilities in CRS84
return getSpatialExtent(typeName)
.flatMap(
boundingBox ->
crsTransformerFactory
.getTransformer(getNativeCrs(), crs, false)
.flatMap(
crsTransformer -> {
try {
return Optional.of(crsTransformer.transformBoundingBox(boundingBox));
} catch (CrsTransformationException e) {
return Optional.empty();
}
}));
Objects.equals(boundingBox.getEpsgCrs(), crs)
? Optional.of(boundingBox)
: crsTransformerFactory
.getTransformer(boundingBox.getEpsgCrs(), crs, false)
.flatMap(
crsTransformer -> {
try {
return Optional.of(
crsTransformer.transformBoundingBox(boundingBox));
} catch (CrsTransformationException e) {
return Optional.empty();
}
}));
}

@Override
public Optional<Interval> getTemporalExtent(String typeName) {
return Optional.empty();
if (!getData().getTypes().containsKey(typeName)) {
return Optional.empty();
}

return getConfiguredTemporalExtent(typeName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2026 interactive instruments GmbH
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package de.ii.xtraplatform.features.gml.app

import de.ii.xtraplatform.features.domain.ImmutableFeatureSchema
import de.ii.xtraplatform.features.domain.SchemaBase
import spock.lang.Specification

class AggregateStatsReaderWfsSpec extends Specification {

def "the bounding box of a prefixed feature type is found under the ids of the capabilities analyzer"() {

given: 'a type whose source path is the prefixed name of the WFS feature type'
def schema = new ImmutableFeatureSchema.Builder()
.name("rbz")
.sourcePath("/dvg:nw_DVG1_rbz")
.type(SchemaBase.Type.OBJECT)
.build()

expect: 'prefix_localname and localname in lower case, not the prefixed name, and the type id last'
AggregateStatsReaderWfs.getTypeIds(schema) == ["dvg_nw_dvg1_rbz", "nw_dvg1_rbz", "rbz"]
}

def "a feature type without a prefix"() {

given:
def schema = new ImmutableFeatureSchema.Builder()
.name("flurstueck")
.sourcePath("/Flurstueck")
.type(SchemaBase.Type.OBJECT)
.build()

expect:
AggregateStatsReaderWfs.getTypeIds(schema) == ["flurstueck", "flurstueck"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import de.ii.xtraplatform.cql.domain.Cql;
import de.ii.xtraplatform.crs.domain.BoundingBox;
import de.ii.xtraplatform.crs.domain.CrsInfo;
import de.ii.xtraplatform.crs.domain.CrsTransformationException;
import de.ii.xtraplatform.crs.domain.CrsTransformerFactory;
import de.ii.xtraplatform.crs.domain.EpsgCrs;
import de.ii.xtraplatform.crs.domain.OgcCrs;
Expand Down Expand Up @@ -312,7 +311,7 @@ public boolean is3dSupported() {
@Override
@SuppressWarnings("PMD.AvoidCatchingGenericException")
public long getFeatureCount(String typeName) {
if (getData().getTypes().containsKey(typeName)) {
if (!getData().getTypes().containsKey(typeName)) {
return -1;
}

Expand Down Expand Up @@ -358,10 +357,15 @@ public FeatureSchema getSortablesSchema(
@Override
@SuppressWarnings("PMD.AvoidCatchingGenericException")
public Optional<BoundingBox> getSpatialExtent(String typeName) {
if (getData().getTypes().containsKey(typeName)) {
if (!getData().getTypes().containsKey(typeName)) {
return Optional.empty();
}

Optional<BoundingBox> configured = getConfiguredSpatialExtent(typeName);
if (configured.isPresent()) {
return configured;
}

try {
Stream<Optional<BoundingBox>> extentGraph =
aggregateStatsReader.getSpatialExtent(
Expand All @@ -383,23 +387,15 @@ public Optional<BoundingBox> getSpatialExtent(String typeName) {
@Override
public Optional<BoundingBox> getSpatialExtent(String typeName, EpsgCrs crs) {
return getSpatialExtent(typeName)
.flatMap(
boundingBox ->
crsTransformerFactory
.getTransformer(getNativeCrs(), crs, false)
.flatMap(
crsTransformer -> {
try {
return Optional.of(crsTransformer.transformBoundingBox(boundingBox));
} catch (CrsTransformationException e) {
return Optional.empty();
}
}));
.flatMap(boundingBox -> transformSpatialExtent(boundingBox, crs));
}

@Override
public Optional<Interval> getTemporalExtent(String typeName) {
return Optional.empty();
if (!getData().getTypes().containsKey(typeName)) {
return Optional.empty();
}
return getConfiguredTemporalExtent(typeName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,11 @@ public Optional<BoundingBox> parseExtent(String extent, EpsgCrs crs) {

@Override
public Optional<Interval> parseTemporalExtent(String start, String end, ZoneId timeZone) {
if (Objects.isNull(start)) {
return Optional.empty();
}
DateTimeFormatter parser =
DateTimeFormatter.ofPattern("yyyy-MM-dd[['T'][' ']HH:mm:ss][.SSS][X]")
.withZone(ZoneOffset.UTC);
Instant parsedStart = parser.parse(start, Instant::from);
if (Objects.isNull(end)) {
return Optional.of(Interval.of(parsedStart, Instant.MAX));
}
Instant parsedEnd = parser.parse(end, Instant::from);
Instant parsedStart = Objects.isNull(start) ? Instant.MIN : parser.parse(start, Instant::from);
Instant parsedEnd = Objects.isNull(end) ? Instant.MAX : parser.parse(end, Instant::from);
return Optional.of(Interval.of(parsedStart, parsedEnd));
}

Expand Down
Loading
Loading