Skip to content

Commit

Permalink
Merge pull request #118 from PDOK/PDOK/reference_date_patch
Browse files Browse the repository at this point in the history
Assert temporal columns are included in the spatial index if configured
  • Loading branch information
kad-korpem authored Feb 23, 2024
2 parents 84c8534 + 5798bd7 commit 5cc62fb
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ collectionMetadata: &collectionMetadata
- Keyword2
thumbnail: 3d.png
lastUpdated: "2023-05-10T12:00:00Z"
temporalProperties:
startDate: validfrom
endDate: validto
extent:
srs: EPSG:3857
bbox: ["-74.391538", "40.435655", "-73.430235", "41.030882"]
interval: [ "\"1970-01-01T00:00:00Z\"", "null" ]

version: 1.0.0
title: New York
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
]
],
"crs": "http://www.opengis.net/def/crs/EPSG/0/3857"
},
"temporal": {
"interval": [
[
"1970-01-01T00:00:00Z",
null
]
],
"trs": "http://www.opengis.net/def/uom/ISO-8601/0/Gregorian"
}
},
"crs": [
Expand Down
Binary file modified examples/resources/addresses-crs84.gpkg
Binary file not shown.
Binary file modified examples/resources/addresses-etrs89.gpkg
Binary file not shown.
Binary file modified examples/resources/addresses-rd.gpkg
Binary file not shown.
12 changes: 7 additions & 5 deletions ogc/features/datasources/geopackage/asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ func assertIndexesExist(
}
for _, coll := range configuredCollections {
if coll.ID == collID && coll.Features != nil {
// assert spatial b-tree index exists, this index substitutes the r-tree when querying large bounding boxes
if err := assertIndexExists(table.TableName, db, spatialBtreeColumns); err != nil {
return err
}

// assert temporal columns are indexed if configured
if coll.Metadata != nil && coll.Metadata.TemporalProperties != nil {
temporalBtreeColumns := strings.Join([]string{coll.Metadata.TemporalProperties.StartDate, coll.Metadata.TemporalProperties.EndDate}, ",")
spatialBtreeColumns = strings.Join([]string{spatialBtreeColumns, coll.Metadata.TemporalProperties.StartDate, coll.Metadata.TemporalProperties.EndDate}, ",")
if err := assertIndexExists(table.TableName, db, temporalBtreeColumns); err != nil {
return err
}
}

// assert spatial b-tree index exists, this index substitutes the r-tree when querying large bounding boxes
// if temporal columns are configured, they must be included in this index as well
if err := assertIndexExists(table.TableName, db, spatialBtreeColumns); err != nil {
return err
}

// assert the column for each property filter is indexed.
for _, propertyFilter := range coll.Features.Filters.Properties {
if err := assertIndexExists(table.TableName, db, propertyFilter.Name); err != nil {
Expand Down
10 changes: 9 additions & 1 deletion ogc/features/testdata/config_benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ ogcApi:
file: ./examples/resources/addresses-etrs89.gpkg
collections:
- id: dutch-addresses
tableName: addresses # name of the feature table (optional), when omitted collection ID is used.
tableName: addresses # name of the feature table (optional), when omitted collection ID is used.
metadata:
description: addresses
temporalProperties:
startDate: validfrom
endDate: validto
extent:
srs: EPSG:4326
interval: [ "\"1970-01-01T00:00:00Z\"", "null" ]
10 changes: 9 additions & 1 deletion ogc/features/testdata/config_features_multiple_gpkgs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ ogcApi:
file: ./examples/resources/addresses-etrs89.gpkg
collections:
- id: dutch-addresses
tableName: addresses # name of the feature table (optional), when omitted collection ID is used.
tableName: addresses # name of the feature table (optional), when omitted collection ID is used.
metadata:
description: addresses
temporalProperties:
startDate: validfrom
endDate: validto
extent:
srs: EPSG:4326
interval: [ "\"1970-01-01T00:00:00Z\"", "null" ]

0 comments on commit 5cc62fb

Please sign in to comment.