Skip to content

STA OData style OMS JSON example

Hylke van der Schaaf edited this page May 13, 2022 · 13 revisions

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

OData / SensorThings can nest entities

Plain Observation

GET …/vx.y/Observations(1)

{
  "@ID": 1,
  "identifier": "obs001",
  "name": "A measurement of waterflow in the Rhine river",
  "description": "",
  "observationType": "http://www.opengis.net/def/observation-type/OGC/0/by-result-type/measurement",
  "parameters": {},
  "phenomenonTime": "2017-08-17T12:00:00Z/2017-08-17T12:00:00Z",
  "resultTime": "2017-08-17T12:05:00Z",
  "resultQuality": "raw sensor measurement",
  "result": 2.73,
  "unit": "L/s",
  "metadata": "Some Data that is very meta",
  "Host@navigationLink": "Observations(1)/Host",
  "ObservableProperty@navigationLink": "Observations(1)/ObservableProperty",
  "Observer@navigationLink": "Observations(1)/Observer",
  "ObservingProcedure@navigationLink": "Observations(1)/ObservingProcedure",
  "ProximateFeatureOfInterest@navigationLink": "Observations(1)/ProximateFeatureOfInterest",
  "Sample@navigationLink": "Observations(1)/Sample",
  "UltimateFeatureOfInterest@navigationLink": "Observations(1)/UltimateFeatureOfInterest"
}

Expanded Observation

Navigationlinks are by default hidden for expanded entities, but they can be expanded further.

GET …/vx.y/Observations(1)?$expand=
	ProximateFeatureOfInterest,
	UltimateFeatureOfInterest,
	ObservingProcedure,
	ObservableProperty,
	Observer,
	Host
{
	"@ID": 1,
	"identifier": "obs001",
	"name": "A measurement of waterflow in the Rhine river",
	"description": "",
	"observationType": "http://www.opengis.net/def/observation-type/OGC/0/by-result-type/measurement",
	"parameters": {},
	"phenomenonTime": "2017-08-17T12:00:00Z/2017-08-17T12:00:00Z",
	"resultTime": "2017-08-17T12:05:00Z",
	"resultQuality": "raw sensor measurement",
	"result": 2.73,
	"unit": "L/s",
	"metadata": "Some Data that is very meta",
	"Host": {
		"@ID": 5,
		"identifier": "https://iddata.eaufrance.fr/id/HydroStation/A060005050",
		"name": "Le Rhin en Allemagne [Kehl Kronenhof]",
		"description": "The station located on the Bridge between Strasbourg and Kehl",
		"link": "https://city.country/environment/hosts/host001.html",
		"location": {
			"GeoJSON": "here"
		}
	},
	"ObservableProperty": {
		"@ID": 55,
		"identifier": "obsProp1",
		"name": "river flow",
		"description": "water flow in the river",
		"link": "https://foo.net/id/obsProp"
	},
	"ObservingProcedure": {
		"@ID": 55,
		"identifier": "obsProc1",
		"name": "stream gage",
		"description": "automated stream gage",
		"link": "https://foo.net/id/Proc/1"
	},
	"Observer": {
		"@ID": 55,
		"identifier": "observer001",
		"name": "ACME River flow Sensor 001",
		"description": "A really smooth sensor",
		"link": "https://acme.example/acme_no2_001.html",
		"location": {
			"GeoJSON": "here"
		}
	},
	"ProximateFeatureOfInterest": null,
	"Sample": {
		"@ID": 55,
		"identifier": "sample001",
		"name": "",
		"description": "",
		"sampleType": "http://www.opengis.net/def/sample-type/OGC/0/by-geometry-type/point",
		"parameters": {},
		"shape": {
			"GeoJSON": "here"
		},
		"metadata": ""
	},
	"UltimateFeatureOfInterest": {
		"@ID": 55,
		"identifier": "https://iddata.eaufrance.fr/id/Watercourse/A---0000",
		"name": "the Rhine in France",
		"description": "https://iddata.eaufrance.fr/id/Watercourse/A---0000?f=application%2Fgeo%2Bjson"
	}
}

With ObservationCollection

Most likely the Observations would be in a Collection (Datastream) with common properties. Units are likely to have more than just a name.

GET …/vx.y/Observations(1)?$expand=
	ObservationCollection($expand=
		ProximateFeatureOfInterest,
		UltimateFeatureOfInterest,
		ObservingProcedure,
		ObservableProperty,
		Observer,
		Host
	)
{
	"@ID": 1,
	"parameters": {},
	"phenomenonTime": "2017-08-17T12:00:00Z/2017-08-17T12:00:00Z",
	"resultTime": "2017-08-17T12:05:00Z",
	"resultQuality": "raw sensor measurement",
	"result": 2.73,
	"ObservationCollection": {
		"@ID": 1,
		"identifier": "obs001",
		"name": "A measurement of waterflow in the Rhine river",
		"description": "",
		"observationType": "http://www.opengis.net/def/observation-type/OGC/0/by-result-type/measurement",
		"unit": {
			"name": "liter per second",
			"symbol": "L/s",
			"link": "http://qudt.org/vocab/unit/L-PER-SEC"
		},
		"metadata": "Some Data that is very meta",
		"Host": {
			"@ID": 5,
			"identifier": "https://iddata.eaufrance.fr/id/HydroStation/A060005050",
			"name": "Le Rhin en Allemagne [Kehl Kronenhof]",
			"description": "The station located on the Bridge between Strasbourg and Kehl",
			"link": "https://city.country/environment/hosts/host001.html",
			"location": {
				"GeoJSON": "here"
			}
		},
		"ObservableProperty": {
			"@ID": 55,
			"identifier": "obsProp1",
			"name": "river flow",
			"description": "water flow in the river",
			"link": "https://foo.net/id/obsProp"
		},
		"ObservingProcedure": {
			"@ID": 55,
			"identifier": "obsProc1",
			"name": "stream gage",
			"description": "automated stream gage",
			"link": "https://foo.net/id/Proc/1"
		},
		"Observer": {
			"@ID": 55,
			"identifier": "observer001",
			"name": "ACME River flow Sensor 001",
			"description": "A really smooth sensor",
			"link": "https://acme.example/acme_no2_001.html",
			"location": {
				"GeoJSON": "here"
			}
		},
		"ProximateFeatureOfInterest": null,
		"Sample": {
			"@ID": 55,
			"identifier": "sample001",
			"name": "",
			"description": "",
			"sampleType": "http://www.opengis.net/def/sample-type/OGC/0/by-geometry-type/point",
			"parameters": {},
			"shape": {
				"GeoJSON": "here"
			},
			"metadata": ""
		},
		"UltimateFeatureOfInterest": {
			"@ID": 55,
			"identifier": "https://iddata.eaufrance.fr/id/Watercourse/A---0000",
			"name": "the Rhine in France",
			"description": "https://iddata.eaufrance.fr/id/Watercourse/A---0000?f=application%2Fgeo%2Bjson"
		}
	}
}

By ObservationCollection

A more likely request is one for an ObservationCollection, with its Observations

GET …/vx.y/ObservationCollection(1)?$expand=
	Observations,
	ProximateFeatureOfInterest,
	UltimateFeatureOfInterest,
	ObservingProcedure,
	ObservableProperty,
	Observer,
	Host
{
	"@ID": 1,
	"identifier": "obs001",
	"name": "A measurement of waterflow in the Rhine river",
	"description": "",
	"observationType": "http://www.opengis.net/def/observation-type/OGC/0/by-result-type/measurement",
	"unit": {
		"name": "Litre per second",
		"symbol": "L/s",
		"link": "http://qudt.org/vocab/unit/L-PER-SEC"
	},
	"metadata": "Some Data that is very meta",
	"Host": {
		"@ID": 5,
		"identifier": "https://iddata.eaufrance.fr/id/HydroStation/A060005050",
		"name": "Le Rhin en Allemagne [Kehl Kronenhof]",
		"description": "The station located on the Bridge between Strasbourg and Kehl",
		"link": "https://city.country/environment/hosts/host001.html",
		"location": {
			"GeoJSON": "here"
		}
	},
	"Observations": [
		{
			"@ID": 1,
			"parameters": {},
			"phenomenonTime": "2017-08-17T12:00:00Z/2017-08-17T12:00:00Z",
			"resultTime": "2017-08-17T12:05:00Z",
			"resultQuality": "raw sensor measurement",
			"result": 2.73
		}
	],
	"ObservableProperty": {
		"@ID": 55,
		"identifier": "obsProp1",
		"name": "river flow",
		"description": "water flow in the river",
		"link": "https://foo.net/id/obsProp"
	},
	"ObservingProcedure": {
		"@ID": 55,
		"identifier": "obsProc1",
		"name": "stream gage",
		"description": "automated stream gage",
		"link": "https://foo.net/id/Proc/1"
	},
	"Observer": {
		"@ID": 55,
		"identifier": "observer001",
		"name": "ACME River flow Sensor 001",
		"description": "A really smooth sensor",
		"link": "https://acme.example/acme_no2_001.html",
		"location": {
			"GeoJSON": "here"
		}
	},
	"ProximateFeatureOfInterest": null,
	"Sample": {
		"@ID": 55,
		"identifier": "sample001",
		"name": "",
		"description": "",
		"sampleType": "http://www.opengis.net/def/sample-type/OGC/0/by-geometry-type/point",
		"parameters": {},
		"shape": {
			"GeoJSON": "here"
		},
		"metadata": ""
	},
	"UltimateFeatureOfInterest": {
		"@ID": 55,
		"identifier": "https://iddata.eaufrance.fr/id/Watercourse/A---0000",
		"name": "the Rhine in France",
		"description": "https://iddata.eaufrance.fr/id/Watercourse/A---0000?f=application%2Fgeo%2Bjson"
	}
}