POST radiation monitoring data into SensorThings

This tutorial was based on an old version of SensorThings API service (2014-09). The data model and encoding (request/response) are not compliant to the existing version (v.1.0).

 

This is a step-by-step tutorial regarding creating a THING instance and related entities with SensorThings API. 

Note: This is based on a SensorThings API implementation in 2014-09.  (URL: http://tania.geocens.ca:8080/SensorThings_V1.2/)

Step-by-step guide

Step 1: CREATE a Thing entity instance. 

Header: Content Type: application/json

CREATE a Thing
{
      "Description": "This is a monitoring station for background radiation."
}

Step 2: If no existing ObservedProperty, CREATE a ObservedProperty entity instance.

Create a Datastream instance
{
  "Name": "Background Radiation",
  "Description": "Background radiation is the ubiquitous ionizing radiation that people on the planet Earth are exposed to, including natural and artificial sources. Both natural and artificial background radiation varies depending on location and altitude.",
  "Definition": "http://dbpedia.org/page/Category:Background_radiation"
}

Step 3: If no existing Sensor, CREATE a new Sensor. 

Create a Sensor entity instance
{
  "EncodingType": "http://example.com/encoding-types#description",
  "Metadata": "This is a radiation monitoring station."
}

Step 4: CREATE a new Datastream by linking to the newly created (or existing) Sensor and ObservedProperty

Create a Sensor entity instance
{
  "UnitOfMeasurement": {
    "Name": "milliSievert per hour",
    "Symbol": "mSv/h",
    "Definition": "http://en.wikipedia.org/wiki/Sievert"
  },
  "Thing": {
    "ID": 34
  },
  "Description": "This is a datastream for measuring the background radiation.",
  "Sensor": {
    "ID": 117
  },
  "ObservedProperty": {
    "ID": 20
  },
  "ObservationType": "http://www.opengis.net/def/observationType/OGCOM/2.0/OM_Measurement"
}

Step 5: If there is no existing FeatureOfInterest, CREATE a new FeatureOfInterest. 

Create a FeatureOfInterest entity instance
{
    "Description": "This is the location where the background radiation observation was performed.",
    "Geometry": {
      "Type": "Point",
      "Coordinates": [
        140.391471,
        37.4044746
      ]
    }
}

Step 6: CREATE new Observations

Create a Sensor entity instance
{
  "Result": "0.049",
  "FeatureOfInterest": {
    "ID": 12
  },
  "ResultTime": "2015-07-02T07:31:45+0900",
  "PhenomenonTime": "2015-07-02T07:31:45+0900",
  "Datastream": {
    "ID": 118
  }
}

Step 7: Query for Observations based on $filter

http://tania.geocens.ca:8080/SensorThings_V1.2/Observations?$filter=ResultTime%20le%20%222015-01-20T10:00:00%22%20AND%20ResultTime%20gt%20%222014-08-19T08:00:00%22

http://tania.geocens.ca:8080/SensorThings_V1.2/Observations?$filter=PhenomenonTime%20ge%20%222012-03-19t12:19:25%22%20and%20PhenomenonTime%20le%20%222012-12-20t12:19:26%22