Skip to content

Event data distribution - mapserv.eventdata

Data obtained from sensors and other sources is recorded as event data.

The event data distribution API can obtain event data that matches the specified conditions.

JSON-RPC v2.0 is used as the execution method.

Request Sample

{
  "jsonrpc": "2.0",
  "method": "mapserv.eventdata",
  "params": {
    "type": "Feature",
    "geometry": {
      "type": "Polygon",
      "coordinates": [[
        [139.7, 34.9], [139.7, 36.1], [140.9, 36.1],
        [140.9, 34.9], [139.7, 34.9]
      ]]
    },
    "properties": {
      "table": "riskmap.riskmap_probability",
      "columns": ["start_datetime", "risk"],
      "conds": {
        "and": [
          {
            ">=": ["start_datetime", "2020-05-05 13:00:00"]
          },
          {
            "<": ["end_datetime", "2020-05-05 15:00:00"]
          }
        ]
      }
    }
  },
  "id": "mapserv_eventdata"
}

Parameter

Request parameters are described in GeoJSON Feature format.

Geometry is a spatial region to be searched for. The type can be Polygon, Line, Point, or Collection of these.

For Properties, specify the following parameters:

Parameter Name Data Type Details Default Value
table string Table name of the event data Required
columns [string] List of columns to be retrieved [] (All columns)
conds object Conditions for searching records {} (No condition)

Output Sample

Output\ Sample

Return Values

GeoJSON (FeatureCollection) is returned. Each record of event data is stored as a Feature.

Each feature's geometry is the GeoJSON representation of the geom. In the properties, the table name will be stored in table, and the rest is stored as a set of column names and their values.

Description

The spatial and non-spatial attributes of event data can be obtained by specifying the conditions. Compared to other APIs, complex search conditions can be specified.

  • Event data stored in the table specified by table is targeted.
  • The record whose geom column and the geometry part of the request intersects will be obtained.
  • If columns is specified, only the columns are returned. However, the geom column is always returned as a GeoJSON geometry.
  • If conds is specified, records satisfying all geometry and conds conditions are returned.
  • conds is written in JsonLogic notation.

The available operators of JsonLogic are as follows:

- {"=":[A,B]}  A is equal to B
- {"<>":[A,B]}  A is not equal to B
- {">":[A,B]}  A is larger than B
- {">=":[A,B]}  A is larger than or equal to B
- {"<":[A,B]}  A is smaller than B
- {"<=":[A,B]}  A is smaller than or equal to B
- {"!":[A]}  Not A
- {"and":[A,B,...]}  All A,B,... are satisfied
- {"or":[A,B,...]}  At least one of A,B,... is satisfied
- {"in":[A,[B]]} A is included in [B] 
- {"min":[A]}  The minimum value of [A]
- {"max":[A]}  The maximum value of [A]

Note: A and B are column name or constants. The string constant same as the column names cannot be specified.

Very large GeoJSONs may be returned if there are many records that meet the condition, or if the spatial attributes stored in geom have a complex shape.