get_zones_by_point
The get_zones_by_point function is used to check if a point is inside certain geofences or to find the nearest geofence.
svc=resource/get_zones_by_point¶ms={"spec": {
"lat":<double>,
"lon":<double>,
"radius":<double>,
"zoneId":{
"<long>":[<uint>,
...
],
...
},
}
}
Parameters
Name | Description |
---|---|
zoneId | The list of geofences: {“resource ID”:[geofence ID,…], …}. |
lat | Latitude. |
lon | Longitude. |
radius | The geofences search radius, m. Optional field. |
If the array of geofence IDs for the indicated “resource ID” is empty, all the resource geofences are taken.
Returned result
If the point is inside the geofence, the returned result is:
[
{
"<text>": { /* resource ID */
"<text>": 0, /* geofence ID, the distance to the geofence, m (always 0 in this case) */
...
},
...
}
]
If the point is outside the geofence, the returned result is:
[
{
"<text>":{ /* resource ID */
"<text>": <double>, /* geofence ID, distance to geofence, m */
}
}
]
If there is no radius field, the returned result is:
[
{
"<text>": [ /* resource ID */
<long>, /* geofence IDs */
...
],
...
}
]
Possible error codes:
Code | Description |
---|---|
6 | General error. |
4 | Wrong input parameters. |