You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-maps/tutorial-iot-hub-maps.md
+10-40Lines changed: 10 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,11 @@ titleSuffix: Microsoft Azure Maps
4
4
description: Tutorial on how to Integrate IoT Hub with Microsoft Azure Maps service APIs
5
5
author: eriklindeman
6
6
ms.author: eriklind
7
-
ms.date: 10/28/2021
7
+
ms.date: 09/14/2023
8
8
ms.topic: tutorial
9
9
ms.service: azure-maps
10
10
services: azure-maps
11
-
12
11
ms.custom: mvc
13
-
14
-
#Customer intent: As a customer, I want to build an IoT system so that I can use Azure Maps APIs for spatial analytics on the device data.
15
12
---
16
13
17
14
# Tutorial: Implement IoT spatial analytics by using Azure Maps
@@ -23,7 +20,7 @@ In this tutorial you will:
23
20
> [!div class="checklist"]
24
21
>
25
22
> * Create an Azure storage account to log car tracking data.
26
-
> * Upload a geofence to the Azure Maps Data service using the Data Upload API.
23
+
> * Upload a geofence to an Azure storage account.
27
24
> * Create a hub in Azure IoT Hub, and register a device.
28
25
> * Create a function in Azure Functions, implementing business logic based on Azure Maps spatial analytics.
29
26
> * Subscribe to IoT device telemetry events from the Azure function via Azure Event Grid.
@@ -115,39 +112,11 @@ When you successfully create your storage account, you then need to create a con
115
112
116
113
:::image type="content" source="./media/tutorial-iot-hub-maps/access-keys.png" alt-text="Screenshot of copy storage account name and key.":::
117
114
118
-
## Upload a geofence
119
-
120
-
Next, use the [Postman] app to [upload the geofence] to Azure Maps. The geofence defines the authorized geographical area for our rental vehicle. Use the geofence in your Azure function to determine whether a car has moved outside the geofence area.
121
-
122
-
Follow these steps to upload the geofence by using the Azure Maps Data Upload API:
123
-
124
-
1. Open the Postman app, select **New** again. In the **Create New** window, select **HTTP Request**, and enter a request name for the request.
125
-
126
-
2. Select the **POST** HTTP method in the builder tab, and enter the following URL to upload the geofence to the Data Upload API.
In the URL path, the `geojson` value against the `dataFormat` parameter represents the format of the data being uploaded.
133
-
134
-
3. Select **Body** > **raw** for the input format, and choose **JSON** from the drop-down list. [Open the JSON data file], and copy the JSON into the body section.
135
-
136
-
4. Select **Send** and wait for the request to process. After the request completes, go to the **Headers** tab of the response. Copy the value of the **Operation-Location** key, which is the `status URL`.
5. To check the status of the API call, create a **GET** HTTP request on the `status URL`. Add your subscription key to the URL for authentication. The **GET** request should like the following URL:
## Upload a geofence into your Azure storage account
147
116
148
-
6. When the request completes successfully, select the **Headers** tab in the response window. Copy the value of the **Resource-Location** key, which is the `resource location URL`. The `resource location URL` contains the unique identifier (`udid`) of the uploaded data. Copy the `udid` for later use in this tutorial.
117
+
The geofence defines the authorized geographical area for our rental vehicle. Use the geofence in your Azure function to determine whether a car has moved outside the geofence area.
149
118
150
-
:::image type="content" source="./media/tutorial-iot-hub-maps/resource-location-url.png" alt-text="Copy the resource location URL.":::
119
+
Follow the steps outlined in the [How to create data registry] article to upload the [geofence JSON data file] into your Azure storage account then register it in your Azure Maps account. Make sure to make a note of the unique identifier (`udid`) value, you'll need it. The `udid` is how you reference the geofence you uploaded into your Azure storage account from your source code. For more information on geofence data files, see [Geofencing GeoJSON data].
151
120
152
121
## Create an IoT hub
153
122
@@ -198,7 +167,7 @@ Now, set up your Azure function.
198
167
199
168
1. In the C# code, replace the following parameters:
200
169
* Replace **SUBSCRIPTION_KEY** with your Azure Maps account subscription key.
201
-
* Replace **UDID** with the `udid` of the geofence you uploaded in [Upload a geofence].
170
+
* Replace **UDID** with the `udid` of the geofence you uploaded in [Upload a geofence into your Azure storage account].
202
171
* The `CreateBlobAsync` function in the script creates a blob per event in the data storage account. Replace the **ACCESS_KEY**, **ACCOUNT_NAME**, and **STORAGE_CONTAINER_NAME** with your storage account's access key, account name, and data storage container. These values were generated when you created your storage account in [Create an Azure storage account].
203
172
204
173
1. In the left menu, select the **Integration** pane. Select **Event Grid Trigger** in the diagram. Type in a name for the trigger, *eventGridEvent*, and select **Create Event Grid subscription**.
@@ -304,9 +273,10 @@ To learn more about how to send device-to-cloud telemetry, and the other way aro
[Open the JSON data file]: https://raw.githubusercontent.com/Azure-Samples/iothub-to-azure-maps-geofencing/master/src/Data/geofence.json?token=AKD25BYJYKDJBJ55PT62N4C5LRNN4
279
+
[geofence JSON data file]: https://raw.githubusercontent.com/Azure-Samples/iothub-to-azure-maps-geofencing/master/src/Data/geofence.json?token=AKD25BYJYKDJBJ55PT62N4C5LRNN4
310
280
[Plug and Play schema for geospatial data]: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v1-preview/schemas/geospatial.md
311
281
[Postman]: https://www.postman.com/
312
282
[register a new device in the IoT hub]: ../iot-hub/iot-hub-create-through-portal.md#register-a-new-device-in-the-iot-hub
@@ -317,6 +287,6 @@ To learn more about how to send device-to-cloud telemetry, and the other way aro
317
287
[Send telemetry from a device]: ../iot-develop/quickstart-send-telemetry-iot-hub.md?pivots=programming-language-csharp
318
288
[Spatial Geofence Get API]: /rest/api/maps/spatial/getgeofence
0 commit comments