LocationService / Client / forecast_geofence_events
forecast_geofence_events¶
- LocationService.Client.forecast_geofence_events(**kwargs)¶
This action forecasts future geofence events that are likely to occur within a specified time horizon if a device continues moving at its current speed. Each forecasted event is associated with a geofence from a provided geofence collection. A forecast event can have one of the following states:
ENTER
: The device position is outside the referenced geofence, but the device may cross into the geofence during the forecasting time horizon if it maintains its current speed.EXIT
: The device position is inside the referenced geofence, but the device may leave the geofence during the forecasted time horizon if the device maintains it’s current speed.IDLE
:The device is inside the geofence, and it will remain inside the geofence through the end of the time horizon if the device maintains it’s current speed.Note
Heading direction is not considered in the current version. The API takes a conservative approach and includes events that can occur for any heading.
See also: AWS API Documentation
Request Syntax
response = client.forecast_geofence_events( CollectionName='string', DeviceState={ 'Position': [ 123.0, ], 'Speed': 123.0 }, TimeHorizonMinutes=123.0, DistanceUnit='Kilometers'|'Miles', SpeedUnit='KilometersPerHour'|'MilesPerHour', NextToken='string', MaxResults=123 )
- Parameters:
CollectionName (string) –
[REQUIRED]
The name of the geofence collection.
DeviceState (dict) –
[REQUIRED]
Represents the device’s state, including its current position and speed. When speed is omitted, this API performs a containment check. The containment check operation returns
IDLE
events for geofences where the device is currently inside of, but no other events.Position (list) – [REQUIRED]
The device’s position.
(float) –
Speed (float) –
The device’s speed.
TimeHorizonMinutes (float) – The forward-looking time window for forecasting, specified in minutes. The API only returns events that are predicted to occur within this time horizon. When no value is specified, this API performs a containment check. The containment check operation returns
IDLE
events for geofences where the device is currently inside of, but no other events.DistanceUnit (string) –
The distance unit used for the
NearestDistance
property returned in a forecasted event. The measurement system must match forDistanceUnit
andSpeedUnit
; ifKilometers
is specified forDistanceUnit
, thenSpeedUnit
must beKilometersPerHour
.Default Value:
Kilometers
SpeedUnit (string) –
The speed unit for the device captured by the device state. The measurement system must match for
DistanceUnit
andSpeedUnit
; ifKilometers
is specified forDistanceUnit
, thenSpeedUnit
must beKilometersPerHour
.Default Value:
KilometersPerHour
.NextToken (string) –
The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.
Default value:
null
MaxResults (integer) –
An optional limit for the number of resources returned in a single call.
Default value:
20
- Return type:
dict
- Returns:
Response Syntax
{ 'ForecastedEvents': [ { 'EventId': 'string', 'GeofenceId': 'string', 'IsDeviceInGeofence': True|False, 'NearestDistance': 123.0, 'EventType': 'ENTER'|'EXIT'|'IDLE', 'ForecastedBreachTime': datetime(2015, 1, 1), 'GeofenceProperties': { 'string': 'string' } }, ], 'NextToken': 'string', 'DistanceUnit': 'Kilometers'|'Miles', 'SpeedUnit': 'KilometersPerHour'|'MilesPerHour' }
Response Structure
(dict) –
ForecastedEvents (list) –
The list of forecasted events.
(dict) –
A forecasted event represents a geofence event in relation to the requested device state, that may occur given the provided device state and time horizon.
EventId (string) –
The forecasted event identifier.
GeofenceId (string) –
The geofence identifier pertaining to the forecasted event.
IsDeviceInGeofence (boolean) –
Indicates if the device is located within the geofence.
NearestDistance (float) –
The closest distance from the device’s position to the geofence.
EventType (string) –
The event type, forecasting three states for which a device can be in relative to a geofence:
ENTER
: If a device is outside of a geofence, but would breach the fence if the device is moving at its current speed within time horizon window.EXIT
: If a device is inside of a geofence, but would breach the fence if the device is moving at its current speed within time horizon window.IDLE
: If a device is inside of a geofence, and the device is not moving.ForecastedBreachTime (datetime) –
The forecasted time the device will breach the geofence in ISO 8601 format:
YYYY-MM-DDThh:mm:ss.sssZ
GeofenceProperties (dict) –
The geofence properties.
(string) –
(string) –
NextToken (string) –
The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.
DistanceUnit (string) –
The distance unit for the forecasted events.
SpeedUnit (string) –
The speed unit for the forecasted events.
Exceptions
LocationService.Client.exceptions.InternalServerException
LocationService.Client.exceptions.ResourceNotFoundException
LocationService.Client.exceptions.AccessDeniedException
LocationService.Client.exceptions.ValidationException
LocationService.Client.exceptions.ThrottlingException