Fiware Orion:订阅的地理定位过滤器

Fiware Orion: Geolocation Filters for Subscriptions

我知道您可以 queryContext Orion 使用地理定位过滤器。

是否可以在订阅场景中进行类似的过滤?换句话说,当possition属性在预定义区域内时,我是否可以收到有关上下文实体属性更改的通知,

例如:

谢谢。

NGSI 协议考虑了指定订阅限制的可能性。所以subscribeContext操作支持订阅的FIWARE::Location限制。

所以答案是:是的。

例子

使用 POST queryContext 创建一个实体:

{
  "contextElements": [
  {
    "type": "City",
    "isPattern": "false",
    "id": "Madrid",
    "attributes": [
    {
      "name": "position",
      "type": "coords",
      "value": "1, 1",
      "metadatas": [
      {
        "name": "location",
        "type": "string",
        "value": "WGS84"
      }
      ]
    },
    {
      "name": "a1",
      "type": "string",
      "value": "v1"
    }
    ]
  }
  ],
  "updateAction": "APPEND"
}

使用 POST subscribeContext:

订阅区域中的更改
{
  "entities": [
      {
          "type": "City",
          "isPattern": "true",
          "id": ".*"
      }
  ],
  "attributes": [
      "a1"
  ],
  "reference": "http://<host>:<port>/notify",
  "duration": "P1M",
  "notifyConditions": [
      {
          "type": "ONCHANGE",
          "condValues": [
              "a1"
          ]
      }
  ],
   "restriction": {
      "scopes": [
      {
        "type" : "FIWARE::Location",
        "value" : {
          "polygon": {
            "vertices": [
            {
              "latitude": "0",
              "longitude": "0"
            },
            {
              "latitude": "0",
              "longitude": "6"
            },
            {
              "latitude": "6",
              "longitude": "6"
            },
            {
              "latitude": "6",
              "longitude": "0"
            }
            ]
          }
        }
      }
      ]
    }
}

然后只需更新实体的 a1 的值,看看会发生什么。