Closed Evanfeenstra closed 5 years ago
I'm glad you're enjoying Tile38!
For FENCE ROAM there's no concept of enter
or exit
detection. Instead, there are nearby
and faraway
objects.
For example, open the fence on a terminal:
tile38-cli> NEARBY people FENCE ROAM people * 5000
Then add two points in a second terminal:
tile38-cli> SET people alice POINT 33.02 -115.02
tile38-cli> SET people bob POINT 33.01 -115.01
This will fire off the notifcation:
{
"command": "set",
"group": "5c96cfc90970e43f3e56a699",
"detect": "roam",
"key": "people",
"time": "2019-03-23T17:31:05.26178-07:00",
"id": "bob",
"object": {"type":"Point","coordinates":[-115.01,33.01]},
"nearby": {"key":"people","id":"alice","object":{"type":"Point","coordinates":[-115.02,33.02]},"meters":1451.138},
}
which indicates that bob
is nearby alice
.
Now if we update bob to be far away from alice:
tile38-cli> SET people bob POINT 33.01 -116.01
causes the notification:
{
"command":"set",
"group":"5c96cfc90970e43f3e56a699",
"detect":"roam","key":"people",
"time":"2019-03-23T17:34:02.911938-07:00",
"id":"bob",
"object":{"type":"Point","coordinates":[-116.01,33.01]},
"faraway":{"key":"people","id":"alice","object":{"type":"Point","coordinates":[-115.02,33.02]},"meters":92314.009}}
You'll notice the there's a faraway
object.
One side effect is that you may get a lot of nearby
notifications when two objects continue to be nearby each other. If this is a problem then use the NODWELL
keyword.
tile38-cli> NEARBY people FENCE NODWELL ROAM people * 5000
This will ensure that there is repeating nearby or faraway notifications for two connecting objects.
I hope this answers your question.
Hello @tidwall ,
I just found out about tile38 and it's look greats but I have a question about geofencing and precisions, to avoid to open a new thread I prefer to comment here as it's more or less related.
1 ) how close/precise can I get with the radius using "within" for the geofencing ? does ~20meter radius is reasonable ? It's not mention in the documention of INTERSECT
or WITHIN
for the minimum distance radius.
2 ) What's the best way to manage big set of data ? Meaning if I have 10000 trucks and each of them hold 3000 coordinates
**, should I use SET
with OBJECT
? And if I need to modify or add a coordinates I would use JSET
with RAW
? ( like here
**this could be happen for example if the truck device is not able to send his coordinates becausethe area is not covered ( gsm/3,4G, Sigfox or other...). It keep the coordinates in cache and send them once reconnected.
3 ) If I have predeterminate itinerary
(set of coordinates ) from A
to B
, with a marker every 50 meters ( coordinate ). Is it possible to use WITHIN
with multiple coordinates as arguments ? for instance the itinerary
from A
to B
against the SET
define in point 2)
and the precision of point 1)
(~20meters) ?
The expected output would be to have all the trucks
that did the following itinerate
within a radius of ~20meters ( Lower it is, the best it would be..)
I guess I could do a loop but there is maybe better and more efficient way to achieve that.
Sorry for all the questions.
Thanks by advance.
Br, Fas3r.
Hi @tidwall, thanks a lot for your answer! NODWELL is exactly what I was looking for
Amazing job with this library, I love working with Tile38!
Is it possible to detect "enter" and "exit" while using FENCE ROAM? Currently it seems like the webhook is triggered with each location update, but I do not see a way to send a hook when the device is no longer nearby the roaming fence.