Skip to content

Commit aaddef6

Browse files
authored
Merge pull request #250971 from stevemunk/tutorial-iot-hub-maps-data-depricated
tutorial-iot-hub-maps: Replace data upload instructions with data registry instructions.
2 parents da0874a + 7283869 commit aaddef6

File tree

2 files changed

+10
-40
lines changed

2 files changed

+10
-40
lines changed
Binary file not shown.

articles/azure-maps/tutorial-iot-hub-maps.md

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ titleSuffix: Microsoft Azure Maps
44
description: Tutorial on how to Integrate IoT Hub with Microsoft Azure Maps service APIs
55
author: eriklindeman
66
ms.author: eriklind
7-
ms.date: 10/28/2021
7+
ms.date: 09/14/2023
88
ms.topic: tutorial
99
ms.service: azure-maps
1010
services: azure-maps
11-
1211
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.
1512
---
1613

1714
# Tutorial: Implement IoT spatial analytics by using Azure Maps
@@ -23,7 +20,7 @@ In this tutorial you will:
2320
> [!div class="checklist"]
2421
>
2522
> * 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.
2724
> * Create a hub in Azure IoT Hub, and register a device.
2825
> * Create a function in Azure Functions, implementing business logic based on Azure Maps spatial analytics.
2926
> * 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
115112

116113
:::image type="content" source="./media/tutorial-iot-hub-maps/access-keys.png" alt-text="Screenshot of copy storage account name and key.":::
117114

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.
127-
128-
```HTTP
129-
https://us.atlas.microsoft.com/mapData?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=2.0&dataFormat=geojson
130-
```
131-
132-
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`.
137-
138-
```http
139-
https://us.atlas.microsoft.com/mapData/operations/{operationId}?api-version=2.0
140-
```
141-
142-
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:
143-
144-
```HTTP
145-
https://us.atlas.microsoft.com/mapData/{operationId}/status?api-version=2.0&subscription-key={Your-Azure-Maps-Subscription-key}
146-
```
115+
## Upload a geofence into your Azure storage account
147116

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.
149118

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].
151120

152121
## Create an IoT hub
153122

@@ -198,7 +167,7 @@ Now, set up your Azure function.
198167

199168
1. In the C# code, replace the following parameters:
200169
* 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].
202171
* 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].
203172

204173
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
304273
[general-purpose v2 storage account]: ../storage/common/storage-account-overview.md
305274
[Get Geofence]: /rest/api/maps/spatial/getgeofence
306275
[Get Search Address Reverse]: /rest/api/maps/search/getsearchaddressreverse
276+
[How to create data registry]: how-to-create-data-registries.md
307277
[IoT Hub message routing]: ../iot-hub/iot-hub-devguide-routing-query-syntax.md
308278
[IoT Plug and Play]: ../iot-develop/index.yml
309-
[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
310280
[Plug and Play schema for geospatial data]: https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v1-preview/schemas/geospatial.md
311281
[Postman]: https://www.postman.com/
312282
[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
317287
[Send telemetry from a device]: ../iot-develop/quickstart-send-telemetry-iot-hub.md?pivots=programming-language-csharp
318288
[Spatial Geofence Get API]: /rest/api/maps/spatial/getgeofence
319289
[subscription key]: quick-demo-map-app.md#get-the-subscription-key-for-your-account
320-
[Upload a geofence]: #upload-a-geofence
321-
[upload the geofence]: ./geofence-geojson.md
290+
[Upload a geofence into your Azure storage account]: #upload-a-geofence-into-your-azure-storage-account
291+
[Geofencing GeoJSON data]: ./geofence-geojson.md
322292
[Use IoT Hub message routing]: ../iot-hub/iot-hub-devguide-messages-d2c.md

0 commit comments

Comments
 (0)