Details
-
Type: Monitor
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
Labels:
-
HD-Chapter:Data
-
HD-Enabler:Orion
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":
,
"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:
Unfortunately, the response is an empty array.
We have also tried a geometrical query using a polygon:
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":
,
"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...
2017-05-22 21:12|UPDATED status: transition Finish| # answers= 1, accepted answer= True