'Spatial Search in Here Data Hub not working
I have created a space in Here DataHub and multiple features in it. The format of feature is -
{
"type": "Feature",
"id": "5mmUm99MMRp7TSfO",
"geometry": {
"type": "Point",
"bbox": null,
"coordinates": [
-2.960847,
53.430828,
0.0
]
},
"properties": {
"@ns:com:here:xyz": {
"space": "4XICUXLX",
"createdAt": 1648724559819,
"updatedAt": 1648724559819,
"uuid": null,
"puuid": null,
"muuid": null,
"tags": [
"car",
"sedan"
]
},
"featureName": "4b44eab9-d030-44b5-9330-66132766666b",
"lon": 53.430828,
"geometry": {
"type": "Point",
"coordinates": {
"lat": -2.960847,
"lon": 53.430828
}
},
"lat": -2.960847
}
}
There are multiple features with these coordinates of lat and lon.
I want to search for features in the spatial in a radius of x m.
After executing spatial search APi result is empty, it contains no features -
curl -X GET "https://xyz.api.here.com/hub/spaces/4XICUXLX/spatial?lat=-2.960847&lon=53.430828&radius=0&limit=100&p.lat=-2.960847&p.lon=53.430828" -H "accept: application/geo+json"
Result - { "type": "FeatureCollection", "etag": "\"b4ce422e09aaae1bb21bd51e8e3029bf\"", "features": [] }
When I search for features in general by property by calling search API -
https://xyz.api.here.com/hub/spaces/4XICUXLX/search?p.lat=-2.960847&p.lon=53.430828
Response is list of features having that coordinate -
{
"type": "FeatureCollection",
"etag": "\"ce76cc9fbba2305d0f6c182237a6d316\"",
"features": [
{
"id": "5mmUm99MMRp7TSfO",
"type": "Feature",
"properties": {
"lat": -2.960847,
"lon": 53.430828,
"geometry": {
"type": "Point",
"coordinates": {
"lat": -2.960847,
"lon": 53.430828
}
},
"featureName": "4b44eab9-d030-44b5-9330-66132766666b",
"@ns:com:here:xyz": {
"tags": [
"car",
"sedan"
],
"space": "4XICUXLX",
"createdAt": 1648724559819,
"updatedAt": 1648724559819
}
},
"geometry": {
"type": "Point",
"coordinates": [
-2.960847,
53.430828,
0
]
}
},
{
"id": "asojLXk2T8h1A0uR",
"type": "Feature",
"properties": {
"lat": -2.960847,
"lon": 53.430828,
"geometry": {
"type": "Point",
"coordinates": {
"lat": -2.960847,
"lon": 53.430828
}
},
"featureName": "e251e750-fcd0-484d-9c75-eda54601784d",
"@ns:com:here:xyz": {
"tags": [
"car",
"sedan"
],
"space": "4XICUXLX",
"createdAt": 1648722389306,
"updatedAt": 1648722389306
}
},
"geometry": {
"type": "Point",
"coordinates": [
-2.960847,
53.430828,
0
]
}
}
]
}
Can anyone please help me with what is wrong in the spatial API call/query? Why results are not coming in it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
