软件 – 猎户座上下文代理 – 按位置查询

跟随Orion v0.24中的查询.

>正如之前的相关问题所指出的,文档是真正实现的.是否已经实现了’几何’和’坐标’的位置过滤?
>任何人都可以提供查询示例.我不明白什么/如何传递坐标.来自docs:

List of coordinates (separated by 😉 are interpreted depending on the geometry

我尝试了以下不成功的方法:

//Call 1
http://<some-ip>:<some-ip>/v2/entities/?type=Test&geometry=polygon&coords=35.46064,-9.93164;35.46066,3.07617;44.33956,3.07617;44.33955,-9.93164
//Result
{
  "error": "BadRequest",
  "description": "invalid character in URI parameter"
}

我尝试了类似的组合,使用encodeURIComponent过滤特殊字符,但没有.

猎户座中的实体具有以下属性’coordenadas’:

{
    "id": "Test.1",
    "type": "Test",
    "coordenadas": {
        "type": "geo:point",
        "value": "43.7723705, -7.6784461"
     },
     "fecha": 14401
   
  

List of coordinates (separated by ;) are interpreted depending on the geometry

000, "regiones": [ "ES" ] }

编辑03/11/2015

我们已将Orion更新为版本0.25,其中几何查询预计将使用NGSI v2实现.

打电话给

http://<some-ip>:<some-ip>/version

报告我们更新已正确完成:

<orion>
    <version>0.25.0</version>
    <uptime>0 d, 2 h, 23 m, 17 s</uptime>
    <git_hash>a8cf800d4e9fdd7b4293a886490c40309a5bb58c</git_hash>
    <compile_time>Mon Nov 2 09:13:05 CET 2015</compile_time>
    <compiled_by>fermin</compiled_by>
    <compiled_in>centollo</compiled_in>
</orion>

尽管如此,查询似乎无法正常工作.按照上面使用的示例,像这样的几何查询应该返回一个实体:

http://<some-ip>:<some-ip>/v2/entities?type=Test&geometry=circle;radius:6000&coords=43.7723705,-7.6784461

不幸的是,响应是一个空数组.

我们还尝试使用多边形进行几何查询:

http://<some-ip>:<some-ip>/v2/entities?type=Test&geometry=polygon&coords=40.199854,-4.045715;40.643135,-4.045715;40.643135,-3.350830;40.199854,-3.350830

同样,响应是空数组.

看起来实体的位置属性“coordenadas”没有被检测到.所以我尝试创建一个新实体来查看问题是否是在更新到v0.25之前创建的所有实体,但它不起作用.

编辑04/11/2015

我们为实体创建而构建的请求如下:

POST /v2/entities/ HTTP/1.1
Accept: application/json, application/*+json
Content-Type: application/json;charset=UTF-8
User-Agent: Java/1.7.0_71
Host: 127.0.0.1:1026
Connection: keep-alive
Content-Length: 379

 {
    "id":"Test.1",
    "type":"Test",
    "nombreEspecie":"especietest",
    "coordenadas":{
        "type":"geo:point",
        "value":"3.21456, 41.2136"
    },
    "fecha":1446624226632,
    "gradoSeguridad":1,
    "palabrasClave":"test, test, test",
    "comentarios":"comentarios, comentarios",
    "nombreImagen":"ImagenTest",
    "alertas":[],
    "regiones":[],
    "validacionesPositivas":0,
    "validacionesNegativas":0,
    "validacionesDenunciadas":0
}

正如您所建议的那样,我们在一个新的,干净的Orion实例中测试了实体创建.创建正确完成,但位置查询仍然无法正常工作…

最佳答案 示例是正确的,但在Orion 0.24.0或任何先前版本中尚未提供该功能.它已经在开发分支中实现(见
corresponding issue at github.com repository,现已关闭).它将在2015年9月底之前的0.24.0版本中提供,版本为0.24.1或0.25.0(编号时尚未确定).

编辑:Orion 0.25.0实现了几何和坐标URL参数,但位置定义仍然基于in NGSIv1 mechanism.因此,不使用geo:point而是使用名为location的元数据来标记关联属性是位置:

"coordenadas": {
     "location": {
        "type": "string",
        "value": "WGS84"
    },
    "type": "geo:point",
    "value": "3.21456, 41.2136"
}

当我们在NGSIv2实施中取得进展时,这种“不对称”(即用于定义位置但NGSIv2地理查询支持的NGSIv1)将消失(考虑到在Orion 0.25.0中,NGSIv2仍处于测试状态).

点赞