

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 管理您的地理圍欄集合資源
<a name="managing-geofence-collections"></a>

使用 Amazon Location 主控台、 AWS CLI或 Amazon Location APIs 管理您的地理圍欄集合。

## 列出您的地理圍欄集合資源
<a name="viewing-geofence-collections"></a>

您可以使用 Amazon Location 主控台、 AWS CLI或 Amazon Location APIs 來檢視地理圍欄集合清單：

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

**使用 Amazon Location 主控台檢視地理圍欄集合的清單**

1. 開啟位於 https：//[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home) 的 Amazon Location 主控台。

1. 從左側導覽窗格中選擇 **Geofence 集合**。

1. 在我的地理圍欄集合下**檢視地理圍欄集合的**清單。

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

從 Amazon Location Geofences APIs使用 `[ListGeofenceCollections](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_ListGeofenceCollections.html)`操作。

下列範例是取得 AWS 帳戶中地理圍欄集合清單的 API 請求。

```
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 主控台 AWS CLI、 或 Amazon Location APIs，取得 AWS 帳戶中任何地理圍欄集合資源的詳細資訊：

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

**使用 Amazon Location 主控台檢視地理圍欄集合的詳細資訊**

1. 開啟位於 https：//[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home) 的 Amazon Location 主控台。

1. 從左側導覽窗格中選擇 **Geofence 集合**。

1. 在**我的地理圍欄集合**下，選取目標地理圍欄集合的名稱連結。

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

從 Amazon Location Geofences 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 APIs AWS CLI，從 AWS 您的帳戶刪除地理圍欄集合。

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

**使用 Amazon Location 主控台刪除地理圍欄集合**

**警告**  
此操作會永久刪除資源。

 

1. 開啟位於 https：//[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home) 的 Amazon Location 主控台。

1. 從左側導覽窗格中選擇 **Geofence 集合**。

1. 在**我的地理圍欄集合**下，選取目標地理圍欄集合。

1. 選擇**刪除地理圍欄集合**。

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

從 Amazon Location APIs使用 `[DeleteGeofenceCollection](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_DeleteGeofenceCollection.html)`操作。

下列範例是刪除地理圍欄集合 *ExampleCollection* 的 API 請求。

```
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)` 命令。

下列範例是刪除地理圍欄集合 *ExampleCollection* 的 AWS CLI 命令。

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

------

## 列出儲存的地理圍欄
<a name="viewing-geofences"></a>

您可以使用 Amazon Location 主控台、 AWS CLI或 Amazon Location APIs，列出存放在指定地理圍欄集合中的地理圍欄。

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

**使用 Amazon Location 主控台檢視地理圍欄清單**

1. 開啟位於 https：//[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home) 的 Amazon Location 主控台。

1. 從左側導覽窗格中選擇 **Geofence 集合**。

1. 在**我的地理圍欄集合**下，選取目標地理圍欄集合的名稱連結。

1. 在地理圍欄下的地理圍欄集合中檢視**地理圍欄**

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

從 Amazon Location Geofences APIs 使用 `[ListGeofences](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_ListGeofences.html)`操作。

下列範例是 API 請求，以取得存放在地理圍欄集合 *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)` 命令。

下列範例是 AWS CLI ，以取得儲存在地理圍欄集合 *ExampleCollection* 中的地理圍欄清單。

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

------

## 取得地理詳細資訊
<a name="get-geofence-details"></a>

您可以使用 Amazon Location 主控台或 Amazon Location APIs，從地理圍欄集合取得特定地理圍欄的詳細資訊，例如建立時間、更新時間 AWS CLI、幾何和狀態。

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

**使用 Amazon Location 主控台檢視地理圍欄的狀態**

1. 開啟位於 https：//[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home) 的 Amazon Location 主控台。

1. 從左側導覽窗格中選擇 **Geofence 集合**。

1. 在**我的地理圍欄集合**下，選取目標地理圍欄集合的名稱連結。

1. 在**地理圍欄**下，您將能夠檢視地理圍欄的狀態。

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

從 Amazon Location Geofences 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 Location APIs 從地理圍欄集合中刪除地理圍欄。

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

**使用 Amazon Location 主控台刪除地理**

**警告**  
此操作會永久刪除資源。

 

1. 開啟位於 https：//[https://console.aws.amazon.com/location/](https://console.aws.amazon.com/location/home) 的 Amazon Location 主控台。

1. 從左側導覽窗格中選擇 **Geofence 集合**。

1. 在**我的地理圍欄集合**下，選取目標地理圍欄集合的名稱連結。

1. 在**地理圍欄**下，選取目標地理圍欄。

1. 選擇**刪除地理圍欄**。

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

從 Amazon Location Geofences APIs 使用 `[BatchDeleteGeofence](https://docs.aws.amazon.com/location/latest/APIReference/API_WaypointGeofencing_BatchDeleteGeofence.html)`操作。

下列範例是從地理圍欄集合 *ExampleCollection* 刪除地理圍欄的 API 請求。

```
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 集合 *ExampleCollection* 刪除地理圍欄的 AWS CLI 命令。

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

------