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.
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).
- geofencePos - The GeoFencePoint object.
- True if this GeoFence contains a given pair of coordinates.
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.
- geoFencePoints - A sequence of coordinate pairs which may be either dictionaries containing the keys "lng" and "lat" or GeoFencePoint events.
- GeoFenceContainer A GeoFenceContainer object from the provided GeoFencePoint or dictionary sequence.