

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 管理您的地理围栏集合资源
<a name="managing-geofence-collections"></a>

使用 Amazon Location 控制台 AWS CLI、或 Amazon 位置管理您的地理围栏收藏。 APIs

## 列出您的地理围栏集合资源
<a name="viewing-geofence-collections"></a>

您可以使用 Amazon Location 控制台、或 Amazon Location 来查看您的地理围栏收藏列表： AWS CLI APIs

------
#### [ Console ]

**使用 Amazon Location 控制台查看地理围栏集合列表**

1. 打开 Amazon Location 控制台，网址为[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home)。

1. 从左侧导航窗格中选择**地理围栏集合**。

1. 在**我的地理围栏集合**下查看您的地理围栏集合列表。

------
#### [ API ]

使用 Amazon 定位地理围 APIs栏中的`[ListGeofenceCollections](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_ListGeofenceCollections.html)`操作。

以下示例是获取账户中地理围栏集合列表的 API 请求。 AWS 

```
POST /geofencing/v0/list-collections
```

以下为 `ListGeofenceCollections` 响应示例：

```
{
    "Entries": [ 
    { 
        "CollectionName": "ExampleCollection",
        "CreateTime": 2020-09-30T22:59:34.142Z,
        "Description": "string",
        "UpdateTime": 2020-09-30T23:59:34.142Z
    },
    "NextToken": "1234-5678-9012"
}
```

------
#### [ CLI ]

使用 `[list-geofence-collections](https://docs.aws.amazon.com/cli/latest/reference/location/list-geofence-collections.html)` 命令。

以下示例是 AWS CLI 获取账户中地理围栏集合列表的示例。 AWS 

```
aws location list-geofence-collections
```

------

## 获取地理围栏集合的详细信息
<a name="get-geofence-collection-details"></a>

您可以使用 Amazon Location 控制台、或 Amazon L AWS ocation 获取有关您账户中任何地理围栏收集资源的详细信息： AWS CLI APIs

------
#### [ Console ]

**使用 Amazon Location 控制台查看地理围栏集合的详细信息**

1. 打开 Amazon Location 控制台，网址为[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home)。

1. 从左侧导航窗格中选择**地理围栏集合**。

1. 在**我的地理围栏集合**下，选择目标地理围栏集合的名称链接。

------
#### [ API ]

使用 Amazon 定位地理围 APIs栏中的`[DescribeGeofenceCollection](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_DescribeGeofenceCollection.html)`操作。

以下示例是获取地理围栏收集详细信息的 API 请求。*ExampleCollection*

```
GET /geofencing/v0/collections/ExampleCollection
```

以下为 `DescribeGeofenceCollection` 响应示例：

```
{
    "CollectionArn": "arn:aws:geo:us-west-2:123456789012:geofence-collection/GeofenceCollection",
    "CollectionName": "ExampleCollection",
    "CreateTime": 2020-09-30T22:59:34.142Z,
    "Description": "string",
    "KmsKeyId": "1234abcd-12ab-34cd-56ef-1234567890ab",
    "Tags": { 
        "Tag1" : "Value1"
    },
    "UpdateTime": 2020-09-30T23:59:34.142Z
}
```

------
#### [ CLI ]

使用 `[describe-geofence-collection](https://docs.aws.amazon.com/cli/latest/reference/location/describe-geofence-collection.html)` 命令。

以下示例是 AWS CLI 获取地理围栏集合详细信息的示例。*ExampleCollection*

```
aws location describe-geofence-collection \
    --collection-name "ExampleCollection"
```

------

## 删除地理围栏集合
<a name="delete-geofence-collection"></a>

您可以使用 Amazon Location 控制台、或 Amazon Location 从您的 AWS 账户中 AWS CLI删除地理围栏集合。 APIs

------
#### [ Console ]

**使用 Amazon Location 控制台删除地理围栏集合**

**警告**  
此操作将永久删除资源。

 

1. 打开 Amazon Location 控制台，网址为[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home)。

1. 从左侧导航窗格中选择**地理围栏集合**。

1. 在**我的地理围栏集合**下，选择目标地理围栏集合。

1. 选择**删除地理围栏集合**。

------
#### [ API ]

使用 Amazon 营业地点的`[DeleteGeofenceCollection](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_DeleteGeofenceCollection.html)`操作 APIs。

以下示例是删除地理围栏集合的 API 请求。*ExampleCollection*

```
DELETE /geofencing/v0/collections/ExampleCollection
```

以下为 `DeleteGeofenceCollection` 响应示例：

```
HTTP/1.1 200
```

------
#### [ CLI ]

使用 `[delete-geofence-collection](https://docs.aws.amazon.com/cli/latest/reference/location/delete-geofence-collection.html)` 命令。

以下示例是删除 geofence 集合的 AWS CLI 命令。*ExampleCollection*

```
aws location delete-geofence-collection \
    --collection-name "ExampleCollection"
```

------

## 列出存储的地理围栏
<a name="viewing-geofences"></a>

您可以使用亚马逊定位控制台、 AWS CLI或亚马逊位置列出存储在指定地理围栏集合中的地理围栏。 APIs

------
#### [ Console ]

**使用 Amazon Location 控制台查看地理围栏列表**

1. 打开 Amazon Location 控制台，网址为[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home)。

1. 从左侧导航窗格中选择**地理围栏集合**。

1. 在**我的地理围栏集合**下，选择目标地理围栏集合的名称链接。

1. 在**地理围栏**下查看地理围栏集合中的地理围栏。

------
#### [ API ]

使用 Amazon 定位地理围 APIs栏中的`[ListGeofences](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_ListGeofences.html)`操作。

以下示例是一个 API 请求，用于获取存储在 geofence 集合中的地理围栏列表。*ExampleCollection*

```
POST /geofencing/v0/collections/ExampleCollection/list-geofences
```

以下为 `ListGeofences` 响应示例：

```
{
   "Entries": [ 
      { 
         "CreateTime": 2020-09-30T22:59:34.142Z,
         "GeofenceId": "geofence-1",
         "Geometry": { 
             "Polygon": [            
                 [-5.716667, -15.933333,
                 [-14.416667, -7.933333],
                 [-12.316667, -37.066667],
                 [-5.716667, -15.933333]
             ]
         },
         "Status": "ACTIVE",
         "UpdateTime": 2020-09-30T23:59:34.142Z
      }
   ],
   "NextToken": "1234-5678-9012"
}
```

------
#### [ CLI ]

使用 `[list-geofences](https://docs.aws.amazon.com/cli/latest/reference/location/list-geofences.html)` 命令。

以下示例是获取存储在 geofence 集合中的地理围栏列表的示例。 AWS CLI *ExampleCollection*

```
aws location list-geofences \
    --collection-name "ExampleCollection"
```

------

## 获取地理围栏详细信息
<a name="get-geofence-details"></a>

您可以使用 Amazon Location 控制台 AWS CLI或亚马逊位置从地理围栏集合中获取特定地理围栏的详细信息，例如创建时间、更新时间、几何图形和状态。 APIs

------
#### [ Console ]

**使用 Amazon Location 控制台查看地理围栏的状态**

1. 打开 Amazon Location 控制台，网址为[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home)。

1. 从左侧导航窗格中选择**地理围栏集合**。

1. 在**我的地理围栏集合**下，选择目标地理围栏集合的名称链接。

1. 在**地理围栏** ，你可以查看地理围栏的状态。

------
#### [ API ]

使用 Amazon 定位地理围 APIs栏中的`[GetGeofence](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_GetGeofence.html)`操作。

以下示例是从地理围栏集合中获取地理围栏详细信息的 API 请求。*ExampleCollection*

```
GET /geofencing/v0/collections/ExampleCollection/geofences/ExampleGeofence1
```

以下为 `GetGeofence` 响应示例：

```
{
   "CreateTime": 2020-09-30T22:59:34.142Z,
   "GeofenceId": "ExampleGeofence1",
   "Geometry": { 
      "Polygon": [            
          [-1,-1],
          [1,-1],
          [0,1],
          [-1,-1] 
      ]
   },
   "Status": "ACTIVE",
   "UpdateTime": 2020-09-30T23:59:34.142Z
}
```

------
#### [ CLI ]

使用 `[get-geofence](https://docs.aws.amazon.com/cli/latest/reference/location/get-geofence.html)` 命令。

以下示例是 AWS CLI 获取地理围栏集合详细信息的示例。*ExampleCollection*

```
aws location get-geofence \
    --collection-name "ExampleCollection" \
    --geofence-id "ExampleGeofence1"
```

------

## 删除地理围栏
<a name="delete-geofence"></a>

您可以使用 Amazon Location 控制台、 AWS CLI或 Amazon 位置从地理围栏集合中删除地理围栏。 APIs

------
#### [ Console ]

**使用 Amazon Location 控制台删除地理围栏**

**警告**  
此操作将永久删除资源。

 

1. 打开 Amazon Location 控制台，网址为[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home)。

1. 从左侧导航窗格中选择**地理围栏集合**。

1. 在**我的地理围栏集合**下，选择目标地理围栏集合的名称链接。

1. 在**地理围栏**下，选择目标地理围栏。

1. 选择**删除地理围栏**。

------
#### [ API ]

使用 Amazon 定位地理围 APIs栏中的`[BatchDeleteGeofence](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_BatchDeleteGeofence.html)`操作。

以下示例是从地理围栏集合中删除地理围栏的 API 请求。*ExampleCollection*

```
POST /geofencing/v0/collections/ExampleCollection/delete-geofences
Content-type: application/json

{
   "GeofenceIds": [ "ExampleGeofence11" ]
}
```

以下是 `[BatchDeleteGeofence](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_BatchDeleteGeofence.html)` 成功响应的示例。

```
HTTP/1.1 200
```

------
#### [ CLI ]

使用 `[batch-delete-geofence](https://docs.aws.amazon.com/cli/latest/reference/location/batch-delete-geofence.html)` 命令。

以下示例是从 geofence 集合中删除 geofence 的 AWS CLI 命令。*ExampleCollection*

```
aws location batch-delete-geofence \
    --collection-name "ExampleCollection" \
    --geofence-ids "ExampleGeofence11"
```

------