Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
daca1fd
Implement Temporal Primitive Geometry for MovingFeatures
KrausMatthias May 12, 2025
4f7d540
Implement CRS and TRS for Moving Features
KrausMatthias May 17, 2025
00ecbf5
Use serde(try_from ...) instead of custom deserialization for tempora…
KrausMatthias May 18, 2025
4a0c5de
Inline AnglesType and ScaleType in Orientation
KrausMatthias May 18, 2025
9719dd4
Used adjacent tags for Trs and Crs
KrausMatthias May 19, 2025
33a09b2
Implement TemporalGeometry and TemporalComplexGeometry
KrausMatthias May 19, 2025
61a1b48
Add moving features property types
KrausMatthias May 23, 2025
99072bf
Refactor and comment temporal properties
KrausMatthias May 24, 2025
2b3e9d2
Some doc comment fixes
KrausMatthias May 25, 2025
98064b0
Add test to temporal properties and fix some bugs
KrausMatthias May 25, 2025
d5200aa
Integrate with moving features with collection, feature collection an…
KrausMatthias May 25, 2025
83f77ec
Add traits for moving features transactions to drivers
KrausMatthias May 25, 2025
c4a7978
Add a blanket implementation of moving feature geometry transactions …
KrausMatthias May 25, 2025
a32f31c
Drop unnecessary complexity on ItemType for MovingFeatures
KrausMatthias May 29, 2025
06b2067
Add convenience method to SameLengthDateTimeCoordinatesVec
KrausMatthias May 29, 2025
4b94480
Somehow serde(rename = camelCase) does not work here, resort to serde…
KrausMatthias May 29, 2025
ad6aaca
Add accessors to SameLengthCoordinatesVec
KrausMatthias May 31, 2025
ed998a5
Add into_inner to Prisms
KrausMatthias May 31, 2025
d60220c
Drop enforcment of Prisms having >= 1 geometry
KrausMatthias Jun 22, 2025
5b11edd
Implement same length checks at ser/de for datetime aligned types
KrausMatthias Jun 22, 2025
93d6eb0
Drop foreign members for temporal primitive geometry as it can't be f…
KrausMatthias Sep 1, 2025
7c5938c
Enforce Same Length DateTimeCoords and add convenience functions
KrausMatthias Sep 1, 2025
53c1f80
Fix time type in feature
KrausMatthias Sep 1, 2025
14b4f0c
Add utoipa support
KrausMatthias Sep 1, 2025
7e70a76
Move moving features driver to separate PR #27
KrausMatthias Sep 1, 2025
ad4edea
Add movingfeatures to changelog
KrausMatthias Sep 1, 2025
49f3c10
Add serde(default)
KrausMatthias Sep 2, 2025
940321e
When CRS or TRS are missing use the default spatial or temporal CRS
KrausMatthias Sep 5, 2025
2b9ca5e
Address some todos and propositions
b4l Nov 29, 2025
b4e6a1f
Merge `main`
b4l Nov 29, 2025
774456c
Fix typo
KrausMatthias Nov 30, 2025
980dc25
Merge branch 'main' into feature/movingfeatures
b4l Nov 30, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Dynamic OpenAPI definition extraction.
- Types for `OGCAPI - Moving Features`
- Async OGC API - Processes execution (jobs).
- Multipart/related response support for raw OGC API - Processes results with multiple outputs.
- Echo process for testing.
Expand Down
3 changes: 2 additions & 1 deletion ogcapi-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords.workspace = true
include = ["/src", "/assets"]

[features]
default = ["common", "edr", "features", "processes", "tiles"]
default = ["common", "edr", "features", "movingfeatures", "processes", "tiles"]

# standards
common = []
Expand All @@ -22,6 +22,7 @@ stac = ["features"]
styles = []
tiles = ["common"]
coverages = []
movingfeatures = ["common", "features"]

[dependencies]
chrono = { version = "0.4.42", features = ["serde"] }
Expand Down
10 changes: 10 additions & 0 deletions ogcapi-types/src/common/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ pub struct Collection {
#[cfg(feature = "stac")]
#[serde(default, skip_serializing_if = "std::collections::HashMap::is_empty")]
pub assets: std::collections::HashMap<String, crate::stac::Asset>,
#[cfg(feature = "movingfeatures")]
#[serde(
default,
rename = "updateFrequency",
skip_serializing_if = "Option::is_none"
)]
/// A time interval of sampling location. The time unit of this property is millisecond.
pub update_frequency: Option<i64>,
#[serde(flatten, default, skip_serializing_if = "Map::is_empty")]
pub additional_properties: Map<String, Value>,
}
Expand Down Expand Up @@ -131,6 +139,8 @@ impl Default for Collection {
summaries: Default::default(),
#[cfg(feature = "stac")]
assets: Default::default(),
#[cfg(feature = "movingfeatures")]
update_frequency: Default::default(),
additional_properties: Default::default(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion ogcapi-types/src/common/extent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Default for TemporalExtent {
}
}

fn serialize_interval<S>(
pub(crate) fn serialize_interval<S>(
interval: &Vec<[Option<DateTime<Utc>>; 2]>,
serializer: S,
) -> Result<S::Ok, S::Error>
Expand Down
31 changes: 31 additions & 0 deletions ogcapi-types/src/features/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ use std::fmt::Display;

#[cfg(feature = "stac")]
use crate::common::Bbox;

#[cfg(feature = "movingfeatures")]
use crate::movingfeatures::{
crs::Crs, temporal_geometry::TemporalGeometry, temporal_properties::TemporalProperties,
trs::Trs,
};

#[cfg(feature = "movingfeatures")]
use chrono::{DateTime, Utc};

use geojson::Geometry;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
Expand Down Expand Up @@ -69,6 +79,27 @@ pub struct Feature {
#[cfg(feature = "stac")]
#[serde(default)]
pub assets: HashMap<String, crate::stac::Asset>,
#[cfg(feature = "movingfeatures")]
#[serde(
default,
serialize_with = "crate::common::serialize_interval",
skip_serializing_if = "Vec::is_empty"
)]
/// Life span information for the moving feature.
/// See [MF-Json 7.2.3 LifeSpan](https://docs.ogc.org/is/19-045r3/19-045r3.html#time)
pub time: Vec<[Option<DateTime<Utc>>; 2]>,
#[cfg(feature = "movingfeatures")]
#[serde(default)]
pub crs: Crs,
#[cfg(feature = "movingfeatures")]
#[serde(default)]
pub trs: Trs,
#[cfg(feature = "movingfeatures")]
#[serde(default, rename = "temporalGeometry")]
pub temporal_geometry: Option<TemporalGeometry>,
#[cfg(feature = "movingfeatures")]
#[serde(default, rename = "temporalProperties")]
pub temporal_properties: Option<TemporalProperties>,
}

impl Feature {
Expand Down
12 changes: 12 additions & 0 deletions ogcapi-types/src/features/feature_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ use utoipa::ToSchema;

use crate::common::Link;

#[cfg(feature = "movingfeatures")]
use crate::common::Bbox;

use super::Feature;

#[derive(Serialize, Deserialize, ToSchema, Default, Debug, Clone, Copy, PartialEq, Eq)]
Expand All @@ -26,6 +29,15 @@ pub struct FeatureCollection {
pub time_stamp: Option<String>,
pub number_matched: Option<u64>,
pub number_returned: Option<u64>,
#[cfg(feature = "movingfeatures")]
#[serde(default)]
pub crs: crate::movingfeatures::crs::Crs,
#[cfg(feature = "movingfeatures")]
#[serde(default)]
pub trs: crate::movingfeatures::trs::Trs,
#[cfg(feature = "movingfeatures")]
#[serde(default)]
pub bbox: Option<Bbox>,
}

impl FeatureCollection {
Expand Down
3 changes: 3 additions & 0 deletions ogcapi-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ pub mod edr;
/// Types specified in the `OGC API - Features` standard.
#[cfg(feature = "features")]
pub mod features;
/// Types specified in the `OGC API - Moving Features` standard.
#[cfg(feature = "movingfeatures")]
pub mod movingfeatures;
/// Types specified in the `OGC API - Processes` standard.
#[cfg(feature = "processes")]
pub mod processes;
Expand Down
93 changes: 93 additions & 0 deletions ogcapi-types/src/movingfeatures/crs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
use std::str::FromStr;

use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

use crate::common;

/// MF-JSON uses a CRS as described in in (GeoJSON:2008)[https://geojson.org/geojson-spec#coordinate-reference-system-objects]
/// See (7.2.3 CoordinateReferenceSystem Object)[https://docs.ogc.org/is/19-045r3/19-045r3.html#crs]
/// See (6. Overview of Moving features JSON Encodings)[https://docs.ogc.org/is/19-045r3/19-045r3.html#_overview_of_moving_features_json_encodings_informative]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, ToSchema)]
#[serde(tag = "type", content = "properties")]
pub enum Crs {
/// A Named CRS object indicates a coordinate reference system by name. In this case, the value of its "type" member
/// is the string "Name". The value of its "properties" member is a JSON object containing a "name" member whose
/// value is a string identifying a coordinate reference system (not JSON null value). The value of "href" and "type"
/// is a JSON null value. This standard recommends an EPSG[3] code as the value of "name", such as "EPSG::4326."
///
/// See (7.2.3.1 Named CRS)[https://docs.ogc.org/is/19-045r3/19-045r3.html#_7_2_3_1_named_crs]
Name { name: String },
/// A linked CRS object has one required member "href" and one optional member "type". The value of the required "href"
/// member is a dereferenceable URI. The value of the optional "type" member is a string that hints at the format used
/// to represent CRS parameters at the provided URI. Suggested values are: "Proj4", "OGCWKT", "ESRIWKT", but others can
/// be used.
///
/// See (7.2.3.2. Linked CRS)[https://docs.ogc.org/is/19-045r3/19-045r3.html#_7_2_3_2_linked_crs]
Link {
r#type: Option<String>,
href: String,
},
}

impl Default for Crs {
fn default() -> Self {
Self::Name {
name: common::Crs::default().to_urn(),
}
}
}

impl TryFrom<Crs> for common::Crs {
type Error = String;

fn try_from(value: Crs) -> Result<Self, Self::Error> {
match value {
// TODO this might not work for names like "EPSG:4326"
Crs::Name { name } => Self::from_str(name.as_str()),
Crs::Link { href, .. } => Self::from_str(href.as_str()),
}
}
}

impl From<common::Crs> for Crs {
fn from(value: common::Crs) -> Self {
Self::Name {
name: value.to_urn(),
}
}
}

#[cfg(test)]
mod tests {

use super::*;

#[test]
fn serde_json() {
// TODO this contradicts example from https://developer.ogc.org/api/movingfeatures/index.html#tag/MovingFeatures/operation/retrieveMovingFeatures
// Example from https://docs.ogc.org/is/19-045r3/19-045r3.html#_7_2_3_1_named_crs
let trs: Crs = serde_json::from_str(
r#"
{
"type": "Name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
}
"#,
)
.expect("Failed to parse Crs");
let expected_trs = Crs::default();
assert_eq!(trs, expected_trs);
}

#[test]
fn into_common_crs() {
// assert_eq!(common::Crs::try_from(Crs::default()).unwrap(), common::Crs::default());
assert_eq!(common::Crs::default(), Crs::default().try_into().unwrap());

// assert_eq!(Crs::from(common::Crs::default()), Crs::default());
assert_eq!(Crs::default(), common::Crs::default().into());
}
}
Loading
Loading