Tile38 1.2 introduces a powerful new feature which allows for dynamic geofences. This enables realtime monitoring for when one or more moving objects are nearby each other.
A couple of common use cases are:
Vehicle pickup services: Instantly be notified when a vehicle is nearby somebody waiting to be picked up, or when a person approaches a vehicle, or when a vehicle is nearby other vehicles in the fleet.
Proximity social apps: Very useful for when you need to check if two users are nearby each other without having to constantly query the database.
A simple example:
This will open a roaming fence on the
people collection. The fence watches for when any object is within 5000 meters of any other object in the same collection.
To test, open two terminals:
Connect to the Tile38 server and enter the fence command.
Add two points to the
people collection. The second SET command will trigger a fence event that will appear in the other terminal.
The event will appear in terminal 1 and look like:
Which shows that
alice was updated and that
bob is 1,451 meters away.
Some other examples:
bob for when they are within 100 meters of each other.
And if you are using webhooks you can assign this fence like such:
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
This will ensure that there is repeating nearby or faraway notifications for two connecting objects.