Skip to content

batch_evaluate_geofences

batch_evaluate_geofences(
    collection_name: ResourceName,
    device_position_updates: DevicePositionUpdateList,
    *,
    config_overrides: Optional[LocationClientConfig] = None,
) -> BatchEvaluateGeofencesResponse

Evaluates device positions against the geofence geometries from a given geofence collection.

This operation always returns an empty response because geofences are asynchronously evaluated. The evaluation determines if the device has entered or exited a geofenced area, and then publishes one of the following events to Amazon EventBridge:

  • ENTER if Amazon Location determines that the tracked device has entered a geofenced area.

  • EXIT if Amazon Location determines that the tracked device has exited a geofenced area.

The last geofence that a device was observed within is tracked for 30 days after the most recent device position update.

Geofence evaluation uses the given device position. It does not account for the optional Accuracy of a DevicePositionUpdate.

The DeviceID is used as a string to represent the device. You do not need to have a Tracker associated with the DeviceID.

Parameters:

  • collection_name (ResourceName) –

    The geofence collection used in evaluating the position of devices against its geofences.

  • device_position_updates (DevicePositionUpdateList) –

    Contains device details for each device to be evaluated against the given geofence collection.

Raises:

  • AccessDeniedException –

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

  • InternalServerException –

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

  • ResourceNotFoundException –

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

  • ThrottlingException –

    The request was denied because of request throttling.

  • ValidationException –

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

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_location/_services/location.py
def batch_evaluate_geofences(
    self,
    collection_name: "capo_location.types.resource_name.ResourceName",
    device_position_updates: "capo_location.types.device_position_update_list.DevicePositionUpdateList",
    *,
    config_overrides: Optional[LocationClientConfig] = None,
) -> "capo_location.types.batch_evaluate_geofences_response.BatchEvaluateGeofencesResponse":
    """<p>Evaluates device positions against the geofence geometries from a given geofence collection.</p> <p>This operation always returns an empty response because geofences are asynchronously evaluated. The evaluation determines if the device has entered or exited a geofenced area, and then publishes one of the following events to Amazon EventBridge:</p> <ul> <li> <p> <code>ENTER</code> if Amazon Location determines that the tracked device has entered a geofenced area.</p> </li> <li> <p> <code>EXIT</code> if Amazon Location determines that the tracked device has exited a geofenced area.</p> </li> </ul> <note> <p>The last geofence that a device was observed within is tracked for 30 days after the most recent device position update.</p> </note> <note> <p>Geofence evaluation uses the given device position. It does not account for the optional <code>Accuracy</code> of a <code>DevicePositionUpdate</code>.</p> </note> <note> <p>The <code>DeviceID</code> is used as a string to represent the device. You do not need to have a <code>Tracker</code> associated with the <code>DeviceID</code>.</p> </note>

    Args:
        collection_name: <p>The geofence collection used in evaluating the position of devices against its geofences.</p>
        device_position_updates: <p>Contains device details for each device to be evaluated against the given geofence collection.</p>

    Raises:
        capo_location.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
        capo_location.errors.internal_server_exception.InternalServerException: <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
        capo_location.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource that you've entered was not found in your AWS account.</p>
        capo_location.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
        capo_location.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service. </p>
        capo_location.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_location.types.batch_evaluate_geofences_request.BatchEvaluateGeofencesRequest]",
    ) -> OperationResponse[
        "capo_location.types.batch_evaluate_geofences_response.BatchEvaluateGeofencesResponse"
    ]:
        import capo_location._operations.location_service.batch_evaluate_geofences

        output, http_response = (
            capo_location._operations.location_service.batch_evaluate_geofences.batch_evaluate_geofences(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_location.types.batch_evaluate_geofences_request.BatchEvaluateGeofencesRequest",
    ) -> dict[str, Any]:
        import capo_location.types.batch_evaluate_geofences_request

        return (
            capo_location.types.batch_evaluate_geofences_request.redact_sensitive(
                input_
            )
        )

    def _redact_output(
        output: "capo_location.types.batch_evaluate_geofences_response.BatchEvaluateGeofencesResponse",
    ) -> dict[str, Any]:
        import capo_location.types.batch_evaluate_geofences_response

        return (
            capo_location.types.batch_evaluate_geofences_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "BatchEvaluateGeofences",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_location.types.batch_evaluate_geofences_request.BatchEvaluateGeofencesRequest = {
        "collection_name": collection_name,
        "device_position_updates": device_position_updates,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output