tidwall / tile38

Real-time Geospatial and Geofencing
https://tile38.com
MIT License
9.15k stars 570 forks source link

NODWELL keyword has no affect on roaming Geofences #594

Open heisGarvit opened 3 years ago

heisGarvit commented 3 years ago

Describe the bug NODWELL keyword has no affect on roaming Geofences

To Reproduce Steps to reproduce the behavior: Move 2 object's points simultaneously and multiple notifications are generated

Expected behavior Only 1 Notification should happen.

Additional context Documentation seams to be unclear. Also how to detect only "enter" not exit

tidwall commented 3 years ago

I'm unable to reproduce this issue.

Without NODWELL

In terminal one, I created a roaming geofence named myfence geofence that monitored the people collection for when points were within 5,000 meters of each other.

tile38> SETCHAN myfence NEARBY people DISTANCE FENCE ROAM people * 5000
tile38> SUBSCRIBE myfence
{"ok":true,"command":"subscribe","channel":"chan1","num":1,"elapsed":"4.569µs"}

In terminal two, I added two points that are +10,000 meters.

tile38> SET people p1 POINT 33.394 -111.908
tile38> SET people p2 POINT 33.516 -111.952

I then moved p2 to be "nearby" p1 (within 5,000 meters).

tile38> SET people p1 POINT 33.414 -111.948

The notification appeared in terminal 1.

{"command":"set","group":"60636c131aa670fa16bb427c","detect":"roam","hook":"myfence","key":"people","time":"2021-03-30T11:21:07.543336-07:00","id":"p2","object":{"type":"Point","coordinates":[-111.948,33.414]},"nearby":{"key":"people","id":"p1","object":{"type":"Point","coordinates":[-111.908,33.394]},"meters":4328.112}}

You can see it has a "nearby" member that indicates that the "p2" is now nearby "p1".

Then, in terminal 2, I moved p2 again, but still kept it within the 5000 meters.

tile38> SET people p2 POINT 33.421 -111.950

And again, in terminal 1, a notification appeared.

{"command":"set","group":"60636c981aa670fa16bb427d","detect":"roam","hook":"myfence","key":"people","time":"2021-03-30T11:23:31.909439-07:00","id":"p2","object":{"type":"Point","coordinates":[-111.95,33.421]},"nearby":{"key":"people","id":"p1","object":{"type":"Point","coordinates":[-111.908,33.394]},"meters":4920.604}}

Finally, I moved p2 to its original position

tile38> SET people p2 POINT 33.516 -111.952

And a new notification happened.

{"command":"set","group":"60636c981aa670fa16bb427d","detect":"roam","hook":"myfence","key":"people","time":"2021-03-30T11:25:51.712169-07:00","id":"p2","object":{"type":"Point","coordinates":[-111.952,33.516]},"faraway":{"key":"people","id":"p1","object":{"type":"Point","coordinates":[-111.908,33.394]},"meters":14166.611}}

You can see there is the "faraway" member that indicates that the "p2" is now further away than 5,000 meters.

With NODWELL

Follow all of the same steps except for the SETCHAN add the NODWELL

tile38> SETCHAN myfence NEARBY people DISTANCE FENCE NODWELL ROAM people * 5000

You will that that the third notification does not happen because the NODWELL tells the geofence that you do not want multiple "nearby" events in a row for the same two object.

Also how to detect only "enter" not exit

For roaming geofences, there's "nearby" and "faraway" instead of "enter" or "exit". There's no way to turn off "faraway" events.