GetGeofenceCommand

Retrieves the geofence details from a geofence collection.

The returned geometry will always match the geometry format used when the geofence was created.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { LocationClient, GetGeofenceCommand } from "@aws-sdk/client-location"; // ES Modules import
// const { LocationClient, GetGeofenceCommand } = require("@aws-sdk/client-location"); // CommonJS import
const client = new LocationClient(config);
const input = { // GetGeofenceRequest
  CollectionName: "STRING_VALUE", // required
  GeofenceId: "STRING_VALUE", // required
};
const command = new GetGeofenceCommand(input);
const response = await client.send(command);
// { // GetGeofenceResponse
//   GeofenceId: "STRING_VALUE", // required
//   Geometry: { // GeofenceGeometry
//     Polygon: [ // LinearRings
//       [ // LinearRing
//         [ // Position
//           Number("double"),
//         ],
//       ],
//     ],
//     Circle: { // Circle
//       Center: [ // required
//         Number("double"),
//       ],
//       Radius: Number("double"), // required
//     },
//     Geobuf: new Uint8Array(),
//   },
//   Status: "STRING_VALUE", // required
//   CreateTime: new Date("TIMESTAMP"), // required
//   UpdateTime: new Date("TIMESTAMP"), // required
//   GeofenceProperties: { // PropertyMap
//     "<keys>": "STRING_VALUE",
//   },
// };

GetGeofenceCommand Input

See GetGeofenceCommandInput for more details

Parameter
Type
Description
CollectionName
Required
string | undefined

The geofence collection storing the target geofence.

GeofenceId
Required
string | undefined

The geofence you're retrieving details for.

GetGeofenceCommand Output

See GetGeofenceCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
CreateTime
Required
Date | undefined

The timestamp for when the geofence collection was created in ISO 8601  format: YYYY-MM-DDThh:mm:ss.sssZ

GeofenceId
Required
string | undefined

The geofence identifier.

Geometry
Required
GeofenceGeometry | undefined

Contains the geofence geometry details describing a polygon or a circle.

Status
Required
string | undefined

Identifies the state of the geofence. A geofence will hold one of the following states:

  • ACTIVE — The geofence has been indexed by the system.

  • PENDING — The geofence is being processed by the system.

  • FAILED — The geofence failed to be indexed by the system.

  • DELETED — The geofence has been deleted from the system index.

  • DELETING — The geofence is being deleted from the system index.

UpdateTime
Required
Date | undefined

The timestamp for when the geofence collection was last updated in ISO 8601  format: YYYY-MM-DDThh:mm:ss.sssZ

GeofenceProperties
Record<string, string> | undefined

User defined properties of the geofence. A property is a key-value pair stored with the geofence and added to any geofence event triggered with that geofence.

Format: "key" : "value"

Throws

Name
Fault
Details
AccessDeniedException
client

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

InternalServerException
server

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

ResourceNotFoundException
client

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

ThrottlingException
client

The request was denied because of request throttling.

ValidationException
client

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

LocationServiceException
Base exception class for all service exceptions from Location service.