Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-9107

[fiware-stackoverflow] Orion Context Broker - Query By Location

    Details

      Description

      Created question in FIWARE Q/A platform on 21-09-2015 at 14:09
      Please, ANSWER this question AT https://stackoverflow.com/questions/32695828/orion-context-broker-query-by-location

      Question:
      Orion Context Broker - Query By Location

      Description:
      Following with queries in Orion v0.24.

      As pointed out in previous related questions, documentation is ahead to real implementation. Is filter by location with 'geometry' and 'coord' already implemented?
      Can anyone provide a query example. I do not understand what/how to pass coordinates. From docs:

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

      I tried the following unsuccesfully:

      //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"
      }

      I tried similar combinations, filtering special characters with encodeURIComponent, but nothing.

      Entities in orion have following attribute 'coordenadas':

      {
      "id": "Test.1",
      "type": "Test",
      "coordenadas":

      { "type": "geo:point", "value": "43.7723705, -7.6784461" }

      ,
      "fecha": 1440108000000,
      "regiones": [
      "ES"
      ]
      }

      EDIT 03/11/2015

      We have updated Orion to version 0.25 where geometry queries are expected to be implemented using NGSI v2.

      A call to

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

      reports us the update has been done correctly:

      <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>

      Nonetheless, the queries seem to not work properly. Following with the examples used above, a geometrical query like this should return an entity:

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

      Unfortunately, the response is an empty array.

      We have also tried a geometrical query using a polygon:

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

      Again, the response is the empty array.

      It seems like the location property of the entity, "coordenadas", is not being detected. So I tried creating a new entity to see if the problem is all entities were created before the update to v0.25, but it did not work.

      EDIT 04/11/2015

      The request we are building for entity creation is the following:

      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
      }

      As you suggested we tested the entity creation in a new and clean instance of Orion. The creation was done correctly, but location query is still not working...

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 15:18|CREATED monitor | # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 15:18|CREATED monitor | # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 18:12|UPDATED status: transition Answer| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 18:12|UPDATED status: transition Answer| # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 21:12|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 21:12|UPDATED status: transition Finish| # answers= 1, accepted answer= True

          People

          • Assignee:
            backlogmanager Backlog Manager
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: