diff --git a/config/collections.go b/config/collections.go index 904dd387..72ec798c 100644 --- a/config/collections.go +++ b/config/collections.go @@ -66,6 +66,11 @@ func (c *GeoSpatialCollection) UnmarshalJSON(b []byte) error { return yaml.Unmarshal(b, c) } +// HasDateTime true when collection has temporal support, false otherwise +func (c *GeoSpatialCollection) HasDateTime() bool { + return c.Metadata != nil && c.Metadata.TemporalProperties != nil +} + // +kubebuilder:object:generate=true type GeoSpatialCollectionMetadata struct { // Human friendly title of this collection. When no title is specified the collection ID is used. diff --git a/internal/ogc/features/main.go b/internal/ogc/features/main.go index 73c5ccfb..24b9747a 100644 --- a/internal/ogc/features/main.go +++ b/internal/ogc/features/main.go @@ -94,7 +94,7 @@ func (f *Features) Features() http.HandlerFunc { return } url := featureCollectionURL{*cfg.BaseURL.URL, r.URL.Query(), cfg.OgcAPI.Features.Limit, - f.configuredPropertyFilters[collectionID], hasDateTime(collection)} + f.configuredPropertyFilters[collectionID], collection.HasDateTime()} encodedCursor, limit, inputSRID, outputSRID, contentCrs, bbox, referenceDate, propertyFilters, err := url.parse() if err != nil { engine.RenderProblem(engine.ProblemBadRequest, w, err.Error()) @@ -402,7 +402,7 @@ func querySingleDatasource(input domain.SRID, output domain.SRID, bbox *geom.Ext func getTemporalCriteria(collection config.GeoSpatialCollection, referenceDate time.Time) ds.TemporalCriteria { var temporalCriteria ds.TemporalCriteria - if hasDateTime(collection) { + if collection.HasDateTime() { temporalCriteria = ds.TemporalCriteria{ ReferenceDate: referenceDate, StartDateProperty: collection.Metadata.TemporalProperties.StartDate, @@ -410,7 +410,3 @@ func getTemporalCriteria(collection config.GeoSpatialCollection, referenceDate t } return temporalCriteria } - -func hasDateTime(collection config.GeoSpatialCollection) bool { - return collection.Metadata != nil && collection.Metadata.TemporalProperties != nil -}