OM JSON Ideas - opengeospatial/om-swg GitHub Wiki

Core JSON Schema

Brainstorming from June 2021 TC

https://miro.com/app/board/o9J_l_YiKZY=/

Standalone observation with references

In the core schema, associations with other classes can be implemented using xlink properties.

{
    "observer": {
        "title": "Water Gage",
        "href": "http://myapi.org/observers/47889225"
    },
    "proximateFeatureOfInterest": {
        "title": "USGS Site #02339455",
        "href": "http://myapi.org/samplingFeatures/558965"
    },
    "observedProperty": {
        "title": "Discharge",
        "href": "http://usgs.gov/def/parameters/Discharge"
    },
    "phenomenonTime": "2014-03-01T13:00:00Z",
    "resultTime": "2014-03-01T13:00:00Z",
    "result": {
        "uom": "m3/s",
        "value": 10.3
    }
}

A complete example of a Measure Observation with FG-JSON SWG proposals adapted

This example is a meteorological air temperature measure. Also featuring "@context" links to JSON-LD contexts at various levels: some are based on a spec (FG-JSON Feature or OMS-JSON Observation or OMS-JSON result of type Measure), some specific to the application domain or data provider (parameters, result quality). The actual JSON-LD contexts not yet drafted, the links point to nothing.

Note 1: The parameter property is created as a "hash" by the NamedValue name rather than an array of name and value pairs, as the names are required to be unique by the spec.

Note 2: The temporal values are consistently encoded in the style proposed by FG-JSON at Encoding a temporal extent. The phenomenonTime is chosen as the value of the when property here

Note 3: The geometry of the ultimateFeatureOfInterest (only referred here) as the Observation feature geometry. As this is a valid GeoJSON geometry in this case, the property where has value null as proposed in FG-JSON at Encoding a temporal geometry

{
    "type": "Feature",
    "id": "f-1",
    "geometry": {
        "type": "Point",
        "coordinates": [
            24.96131,
            60.20307
        ]
    },
    "where": null,
    "when": {
        "interval": [ "2017-08-17T12:00:00Z", "2017-08-17T12:00:00Z" ] 
    },
    "@context": "http://schemas.opengis.net/fg-json/ld-context/feature.json",
    "properties": {
        "@context": "http://schemas.opengis.net/oms/ld-context/observation.json",
        "featureType": "Observation",
        "observationType": [
            {
                "title": "Measurement",
                "href": "http://www.opengis.net/def/observation-type/OGC/0/by-result-type/measurement"
            }
        ],
        "parameter": {
            "@context": "https://foo.bar.org/observationapi/parameter/ld-context/met-surface-observations.json",
            "slidingAveragingTimeSeconds": 10,
            "sampleRatePerMinute": 60
        },
        "phenomenonTime": {
            "interval": [ "2017-08-17T12:00:00Z", "2017-08-17T12:00:00Z" ]
        },
        "resultTime": {
            "instant": "2017-08-17T12:01:25Z"
        },
        "resultQuality": {
            "@context": "https://foo.bar.org/observationapi/qc/ld-context/met-surface-observations.json",
            "what-ever-QC-flag": "pass"
        },
        "validTime": {
            "interval": [ "2017-08-17T12:00:00Z", "2017-08-17T15:00:00Z" ]
        },
        "observingProcedure": {
            "href": "https://foo.bar.org/observationapi/procedures/met-surface-observations",
            "title": "Meteorological surface observations"
        },
        "observedProperty": {
            "href": "http://vocab.nerc.ac.uk/collection/P07/current/CFSN0023/",
            "title": "Air temperature"
        },
        "observer": {
            "href": "https://foo.bar.org/observationapi/sensors/aws310",
            "title" :"Vaisala AWS310"
        },
        "host": {
            "href": "https://foo.bar.org/observationapi/features/collections/stations/item/123345",
            "title": "Helsinki Kumpula weather observation station"
        },
        "ultimateFeatureOfInterest": {
            "href": "http://sws.geonames.org/843429/about.rdf",
            "title": "Helsinki Kumpula"
        },
        "proximateFeatureOfInterest": {
            "href": "https://foo.bar.org/observationapi/features/collections/samples/item/123345",
            "title": "SpatialSample of air bubble with diameter of 10m around the Helsinki Kumpula weather observation station centered at 10m height above the ground"
        },
        "result": {
            "@context": "http://schemas.opengis.net/oms/ld-context/result/measure.json",
            "unitOfMeasure": {
                "href": "http://www.opengis.net/def/uom/UCUM/degC",
                "title": "Degree Celsius"
            },
            "value": 10.1
        }
    }
}

Standalone observations with inline content

In this example, the proximate feature of interest is a sampling point provided as inline GeoJSON, which itself references the sampled feature.

Note that the sampled feature property can reference a feature in another service (here an OGC feature API endpoint). This is one of the strength of using xlink rather than relying strictly on an API specific linking mechanism.

{
    "observer": {
        "title": "Water Gage",
        "href": "http://myapi.org/observers/47889225"
    },
    "proximateFeatureOfInterest": {
        "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": [43.15892, 2.51478]
        },
        "properties": {
            "name": "USGS Site #02339455",
            "sampledFeature": {
                "title": "Allen Creek",
                "href": "http://myfeatureapi.org/collections/45/items/4788"
            }
        }
    },
    ...
}

Observation attached to a parent collection

Below is an example of an observation collection that defines common observation characteristics.

{
    "name": "Observations at Site 02339455",
    "description": "Water observations collected at USGS site #02339455",
    "observer": {
        "type": "Feature",
        "properties": {
            "name": "Water Gage",
            "href": "http://myapi.org/observers/47889225"
        }
    },
    "proximateFeatureOfInterest": {
        "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": [1.5, 1.5]
        },
        "properties": {
            "name": "USGS Site #02339455",
            "sampledFeature": {
                "title": "Allen Creek",
                "href": "http://myfeatureapi.org/collections/45/items/4788"
            }
        }
    },
    "ultimateFeatureOfInterest": {
        "title": "Allen Creek",
        "href": "http://myfeatureapi.org/collections/45/items/4788"
    },
    "observedProperties": [
        {
            "title": "GageHeight",
            "href": "http://usgs.gov/def/parameters/GageHeight"
        },
        {
            "title": "Discharge",
            "href": "http://usgs.gov/def/parameters/Discharge"
        }
    ]
}

An observation instance attached to the above collection would be encoded as shown below:

{
    "collection": {
        "title": "Observations at Site 02339455",
        "href": "http://myapi.org/obsCollections/425"
    },
    "phenomenonTime": "2014-03-01T13:00:00Z",
    "resultTime": "2014-03-01T13:00:00Z",
    "result": {
        "uom": "m3/s",
        "value": 10.3
    }
}

SensorThings Profile

Associations to resources stored by SensorThings API can be provided using navigationLinks. Can it also be used to point to a separate SensorThings server?

Associations to external resources can be provided using xlink properties.

The following examples assume SensorThings Datastream resource will be replaced by the ObservationCollection resource in v2:

The collection:

{

}

And the associated observation instance:

{
    "[email protected]": "http://example.org/sta/v1.0/ObservationCollections(18)",
        
    "proximateFeatureOfInterest": {
        "title": "USGS Site #02339455",
        "href": "http://example.org/sta/v1.0/FeaturesOfInterest(558965)"
    },
    "[email protected]": "http://example.org/sta/v1.0/FeaturesOfInterest(558965)",

    "phenomenonTime": "2014-03-01T13:00:00Z",
    "resultTime": "2014-03-01T13:00:00Z",
    "result": 10.3
}