com.apama.cumulocity
Event GeoFenceContainer


Geofence helper utilities.

The geofence container carries an array of latitude and longitude points and catches the boundary area. This utility checks the location against the defined geofence value to detect whether it is within the geofence or not. The boundary line itself is considered to be outside of the geofence area.
Since:
10.7.1.0

Action summary
 com.apama.cumulocity.GeoFenceContainerstatic createGeoFenceContainer(sequence<any> geoFencePoints)

Creates a GeoFenceContainer object. This parses the provided geofence coordinates and finds the bounding geofence and returns a GeoFenceContainer object. Any coordinates that cannot be parsed will be replaced by an empty optional.
 booleancontainsLocation(com.apama.cumulocity.GeoFencePoint geofencePos)

Determines if this GeoFence contains a given pair of coordinates.
 
Action detail

createGeoFenceContainer

com.apama.cumulocity.GeoFenceContainer static createGeoFenceContainer(sequence<any> geoFencePoints)
Creates a GeoFenceContainer object. This parses the provided geofence coordinates and finds the bounding geofence and returns a GeoFenceContainer object. Any coordinates that cannot be parsed will be replaced by an empty optional.
Parameters:
geoFencePoints - A sequence of coordinate pairs which may be either dictionaries containing the keys "lng" and "lat" or GeoFencePoint events.
Returns:
GeoFenceContainer A GeoFenceContainer object from the provided GeoFencePoint or dictionary sequence.

containsLocation

boolean containsLocation(com.apama.cumulocity.GeoFencePoint geofencePos)
Determines if this GeoFence contains a given pair of coordinates.

Performs a simple ray-casting algorithm, from the coordinates to the west, and counts how many sides cross that ray.

The result is undefined, but will be true or false if longitude, latitude are close to any of the sides of the polygon, or the polygon contains self-crossing sides (that is a complex polygon).
Parameters:
geofencePos - The GeoFencePoint object.
Returns:
True if this GeoFence contains a given pair of coordinates.