ForecastGeofenceEvents - Amazon Location Service

ForecastGeofenceEvents

Evaluates device positions against geofence geometries from a given geofence collection. The event forecasts 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.

Request Syntax

POST /geofencing/v0/collections/CollectionName/forecast-geofence-events HTTP/1.1 Content-type: application/json { "DeviceState": { "Position": [ number ], "Speed": number }, "DistanceUnit": "string", "MaxResults": number, "NextToken": "string", "SpeedUnit": "string", "TimeHorizonMinutes": number }

URI Request Parameters

The request uses the following URI parameters.

CollectionName

The name of the geofence collection.

Length Constraints: Minimum length of 1. Maximum length of 100.

Pattern: [-._\w]+

Required: Yes

Request Body

The request accepts the following data in JSON format.

DeviceState

The device's state, including current position and speed.

Type: ForecastGeofenceEventsDeviceState object

Required: Yes

DistanceUnit

The distance unit used for the NearestDistance property returned in a forecasted event. The measurement system must match for DistanceUnit and SpeedUnit; if Kilometers is specified for DistanceUnit, then SpeedUnit must be KilometersPerHour.

Default Value: Kilometers

Type: String

Valid Values: Kilometers | Miles

Required: No

MaxResults

An optional limit for the number of resources returned in a single call.

Default value: 20

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 20.

Required: No

NextToken

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 60000.

Required: No

SpeedUnit

The speed unit for the device captured by the device state. The measurement system must match for DistanceUnit and SpeedUnit; if Kilometers is specified for DistanceUnit, then SpeedUnit must be KilometersPerHour.

Default Value: KilometersPerHour.

Type: String

Valid Values: KilometersPerHour | MilesPerHour

Required: No

TimeHorizonMinutes

Specifies the time horizon in minutes for the forecasted events.

Type: Double

Valid Range: Minimum value of 0.

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "DistanceUnit": "string", "ForecastedEvents": [ { "EventId": "string", "EventType": "string", "ForecastedBreachTime": "string", "GeofenceId": "string", "GeofenceProperties": { "string" : "string" }, "IsDeviceInGeofence": boolean, "NearestDistance": number } ], "NextToken": "string", "SpeedUnit": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

DistanceUnit

The distance unit for the forecasted events.

Type: String

Valid Values: Kilometers | Miles

ForecastedEvents

The list of forecasted events.

Type: Array of ForecastedEvent objects

NextToken

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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 60000.

SpeedUnit

The speed unit for the forecasted events.

Type: String

Valid Values: KilometersPerHour | MilesPerHour

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.

HTTP Status Code: 403

InternalServerException

The request has failed to process because of an unknown server error, exception, or failure.

HTTP Status Code: 500

ResourceNotFoundException

The resource that you've entered was not found in your AWS account.

HTTP Status Code: 404

ThrottlingException

The request was denied because of request throttling.

HTTP Status Code: 429

ValidationException

The input failed to meet the constraints specified by the AWS service.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: