A geofence is a virtual boundary that can detect when an object enters or exits the area. This boundary can be a radius or any search area format, such as a bounding box, GeoJSON object, etc. Tile38 can turn any standard search into a geofence monitor by adding the FENCE keyword to the search.
A simple example:
This command opens a geofence that monitors the
fleet collection. The server will respond with:
And the connection will be kept open. If any object enters or exits the 6 km radius around
33.462,-112.268 the server will respond in realtime with messages such as:
The server will notify the client if the
delnotifies the client that an object has been deleted from the collection that is being fenced.
dropnotifies the client that the entire collection is dropped.
setnotifies the client that an object has been added or updated, and when it’s position is detected by the fence.
insideis when an object is inside the specified area.
outsideis when an object is outside the specified area.
enteris when an object that was not previously in the fence has entered the area.
exitis when an object that was previously in the fence has exited the area.
crossis when an object that was not previously in the fence has entered and exited the area.
By default all detect types and commands are returned.
If you would like to only have a select few then use the
DETECT option, for example:
This command will only tell the fence that you only want inside and outside detection.
It’s also possible to mask which commands are returned by using the
COMMANDS option, for example:
This specifies that you only want the enter detection for the set command.