Tutorial: Use Creator to create indoor maps
This tutorial describes how to create indoor maps. In this tutorial, you'll learn how to:
- Upload your indoor map Drawing package.
- Convert your Drawing package into map data.
- Create a dataset from your map data.
- Create a tileset from the data in your dataset.
- Query the Azure Maps Web Feature Service (WFS) API to learn about your map features.
- Create a feature stateset by using your map features and the data in your dataset.
- Update your feature stateset.
Prerequisites
- Make an Azure Maps account.
- Obtain a primary subscription key, also known as the primary key or the subscription key.
- Create a Creator resource.
- Download the Sample Drawing package.
This tutorial uses the Postman application, but you can use a different API development environment.
Important
This tutorial uses the us.atlas.microsoft.com geographical URL. If your Creator service wasn't created in the United States, you must use a different geographical URL. For more information, see Access to Creator Services. To view mappings of region to geographical location, see Creator service geographic scope.
Upload a Drawing package
Use the Data Upload API to upload the Drawing package to Azure Maps resources.
The Data Upload API is a long running transaction that implements the pattern defined in Creator Long-Running Operation API V2.
To upload the Drawing package:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as POST Data Upload.
Select the POST HTTP method.
Enter the following URL to the Data Upload API The request should look like the following URL (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key)::https://us.atlas.microsoft.com/mapData?api-version=2.0&dataFormat=dwgzippackage&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select the Headers tab.
In the KEY field, select
Content-Type.In the VALUE field, select
application/octet-stream.
Select the Body tab.
In the dropdown list, select binary.
Select Select File, and then select a Drawing package.
Select Send.
In the response window, select the Headers tab.
Copy the value of the Operation-Location key, which is the
status URL. We'll use thestatus URLto check the status of the Drawing package upload.
Check the Drawing package upload status
To check the status of the drawing package and retrieve its unique ID (udid):
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as GET Data Upload Status.
Select the GET HTTP method.
Enter the
status URLyou copied in Upload a Drawing package. The request should look like the following URL (replace{Azure-Maps-Primary-Subscription-key}with your primary subscription key):https://us.atlas.microsoft.com/mapData/operations/{operationId}?api-version=2.0&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select Send.
In the response window, select the Headers tab.
Copy the value of the Resource-Location key, which is the
resource location URL. Theresource location URLcontains the unique identifier (udid) of the drawing package resource.
(Optional) Retrieve Drawing package metadata
You can retrieve metadata from the Drawing package resource. The metadata contains information like the resource location URL, creation date, updated date, size, and upload status.
To retrieve content metadata:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as GET Data Upload Metadata.
. Select the GET HTTP method.
Enter the
resource Location URLyou copied in Check Drawing package upload status. The request should look like the following URL (replace{Azure-Maps-Primary-Subscription-key}with your primary subscription key):https://us.atlas.microsoft.com/mapData/metadata/{udid}?api-version=2.0&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select Send.
In the response window, select the Body tab. The metadata should like the following JSON fragment:
{ "udid": "{udid}", "location": "https://us.atlas.microsoft.com/mapData/6ebf1ae1-2a66-760b-e28c-b9381fcff335?api-version=2.0", "created": "5/18/2021 8:10:32 PM +00:00", "updated": "5/18/2021 8:10:37 PM +00:00", "sizeInBytes": 946901, "uploadStatus": "Completed" }
Convert a Drawing package
Now that the Drawing package is uploaded, we'll use the udid for the uploaded package to convert the package into map data. The Conversion API uses a long-running transaction that implements the pattern defined here.
To convert a Drawing package:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as POST Convert Drawing Package.
Select the POST HTTP method.
Enter the following URL to the Conversion Service (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key andudidwith theudidof the uploaded package):https://us.atlas.microsoft.com/conversions?subscription-key={Your-Azure-Maps-Primary-Subscription-key}&api-version=2.0&udid={udid}&inputType=DWG&outputOntology=facility-2.0Select Send.
In the response window, select the Headers tab.
Copy the value of the Operation-Location key, which is the
status URL. We'll use thestatus URLto check the status of the conversion.
Check the Drawing package conversion status
After the conversion operation completes, it returns a conversionId. We can access the conversionId by checking the status of the Drawing package conversion process. The conversionId can then be used to access the converted data.
To check the status of the conversion process and retrieve the conversionId:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as GET Conversion Status.
Select the GET HTTP method:
Enter the
status URLyou copied in Convert a Drawing package. The request should look like the following URL (replace{Azure-Maps-Primary-Subscription-key}with your primary subscription key):https://us.atlas.microsoft.com/conversions/operations/{operationId}?api-version=2.0&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select Send.
In the response window, select the Headers tab.
Copy the value of the Resource-Location key, which is the
resource location URL. Theresource location URLcontains the unique identifier (conversionId), which can be used by other APIs to access the converted map data.
The sample Drawing package should be converted without errors or warnings. However, if you receive errors or warnings from your own Drawing package, the JSON response includes a link to the Drawing error visualizer. You can use the Drawing Error visualizer to inspect the details of errors and warnings. To receive recommendations to resolve conversion errors and warnings, see Drawing conversion errors and warnings.
The following JSON fragment displays a sample conversion warning:
{
"operationId": "{operationId}",
"created": "2021-05-19T18:24:28.7922905+00:00",
"status": "Succeeded",
"warning": {
"code": "dwgConversionProblem",
"details": [
{
"code": "warning",
"details": [
{
"code": "manifestWarning",
"message": "Ignoring unexpected JSON property: unitProperties[0].nonWheelchairAccessible with value False"
}
]
}
]
},
"properties": {
"diagnosticPackageLocation": "https://atlas.microsoft.com/mapData/ce61c3c1-faa8-75b7-349f-d863f6523748?api-version=1.0"
}
}
Create a dataset
A dataset is a collection of map features, such as buildings, levels, and rooms. To create a dataset, use the Dataset Create API. The Dataset Create API takes the conversionId for the converted Drawing package and returns a datasetId of the created dataset.
To create a dataset:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as POST Dataset Create.
Select the POST HTTP method.
Enter the following URL to the Dataset API. The request should look like the following URL (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key, and{conversionId} with theconversionIdobtained in Check Drawing package conversion status):https://us.atlas.microsoft.com/datasets?api-version=2.0&conversionId={conversionId}&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select Send.
In the response window, select the Headers tab.
Copy the value of the Operation-Location key, which is the
status URL. We'll use thestatus URLto check the status of the dataset.
Check the dataset creation status
To check the status of the dataset creation process and retrieve the datasetId:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as GET Dataset Status.
Select the GET HTTP method.
Enter the
status URLyou copied in Create a dataset. The request should look like the following URL (replace{Azure-Maps-Primary-Subscription-key}with your primary subscription key):https://us.atlas.microsoft.com/datasets/operations/{operationId}?api-version=2.0&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select Send.
In the response window, select the Headers tab. The value of the Resource-Location key is the
resource location URL. Theresource location URLcontains the unique identifier (datasetId) of the dataset.Copy the
datasetId, because you'll use it in the next sections of this tutorial.
Create a tileset
A tileset is a set of vector tiles that render on the map. Tilesets are created from existing datasets. However, a tileset is independent from the dataset from which it was sourced. If the dataset is deleted, the tileset continues to exist.
To create a tileset:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as POST Tileset Create.
Select the POST HTTP method.
Enter the following URL to the Tileset API. The request should look like the following URL (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key), and{datasetId} with thedatasetIdobtained in Check dataset creation status:https://us.atlas.microsoft.com/tilesets?api-version=2.0&datasetID={datasetId}&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select Send.
In the response window, select the Headers tab.
Copy the value of the Operation-Location key, which is the
status URL. We'll use thestatus URLto check the status of the tileset.
Check the tileset creation status
To check the status of the dataset creation process and retrieve the tilesetId:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as GET Tileset Status.
Select the GET HTTP method.
Enter the
status URLyou copied in Create a tileset. The request should look like the following URL (replace{Azure-Maps-Primary-Subscription-key}with your primary subscription key):https://us.atlas.microsoft.com/tilesets/operations/{operationId}?api-version=2.0&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select Send.
In the response window, select the Headers tab. The value of the Resource-Location key is the
resource location URL. Theresource location URLcontains the unique identifier (tilesetId) of the dataset.
Query datasets with WFS API
Datasets can be queried using WFS API. You can use the WFS API to query for all feature collections or a specific collection. In this section of the tutorial, we'll do both. First we'll query all collections, and then we will query for the unit collection.
Query for feature collections
To query the all collections in your dataset:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as GET Dataset Collections.
Select the GET HTTP method.
Enter the following URL to WFS API. The request should look like the following URL (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key), and{datasetId} with thedatasetIdobtained in Check dataset creation status:https://us.atlas.microsoft.com/wfs/datasets/{datasetId}/collections?subscription-key={Your-Azure-Maps-Primary-Subscription-key}&api-version=2.0Select Send.
The response body is returned in GeoJSON format and contains all collections in the dataset. For simplicity, the example here only shows the
unitcollection. To see an example that contains all collections, see WFS Describe Collections API. To learn more about any collection, you can select any of the URLs inside thelinkelement.{ "collections": [ { "name": "unit", "description": "A physical and non-overlapping area which might be occupied and traversed by a navigating agent. Can be a hallway, a room, a courtyard, etc. It is surrounded by physical obstruction (wall), unless the is_open_area attribute is equal to true, and one must add openings where the obstruction shouldn't be there. If is_open_area attribute is equal to true, all the sides are assumed open to the surroundings and walls are to be added where needed. Walls for open areas are represented as a line_element or area_element with is_obstruction equal to true.", "links": [ { "href": "https://atlas.microsoft.com/wfs/datasets/{datasetId}/collections/unit/definition?api-version=1.0", "rel": "describedBy", "title": "Metadata catalogue for unit" }, { "href": "https://atlas.microsoft.com/wfs/datasets/{datasetId}/collections/unit/items?api-version=1.0", "rel": "data", "title": "unit" } { "href": "https://atlas.microsoft.com/wfs/datasets/{datasetId}/collections/unit?api-version=1.0", "rel": "self", "title": "Metadata catalogue for unit" } ] },
Query for unit feature collection
In this section, we'll query WFS API for the unit feature collection.
To query the unit collection in your dataset:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as GET Unit Collection.
Select the GET HTTP method.
Enter the following URL (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key, and{datasetId} with thedatasetIdobtained in Check dataset creation status):https://us.atlas.microsoft.com/wfs/datasets/{datasetId}/collections/unit/items?subscription-key={Your-Azure-Maps-Primary-Subscription-key}&api-version=2.0Select Send.
After the response returns, copy the feature
idfor one of theunitfeatures. In the following example, the featureidis "UNIT26". In this tutorial, we'll use "UNIT26" as our featureidin the next section.{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": ["..."] }, "properties": { "original_id": "b7410920-8cb0-490b-ab23-b489fd35aed0", "category_id": "CTG8", "is_open_area": true, "navigable_by": [ "pedestrian" ], "route_through_behavior": "allowed", "level_id": "LVL14", "occupants": [], "address_id": "DIR1", "name": "157" }, "id": "UNIT26", "featureType": "" }, {"..."} ] }
Create a feature stateset
Feature statesets define dynamic properties and values on specific features that support them. In this section, we'll create a stateset that defines boolean values and corresponding styles for the occupancy property.
To create a stateset:
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as POST Create Stateset.
Select the POST HTTP method.
Enter the following URL to the Stateset API. The request should look like the following URL (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key, and{datasetId} with thedatasetIdobtained in Check dataset creation status):https://us.atlas.microsoft.com/featurestatesets?api-version=2.0&datasetId={datasetId}&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select the Headers tab.
In the KEY field, select
Content-Type.In the VALUE field, select
application/json.
Select the Body tab.
In the dropdown lists, select raw and JSON.
Copy the following JSON styles, and then paste them in the Body window:
{ "styles":[ { "keyname":"occupied", "type":"boolean", "rules":[ { "true":"#FF0000", "false":"#00FF00" } ] } ] }Select Send.
After the response returns successfully, copy the
statesetIdfrom the response body. In the next section, we'll use thestatesetIdto change theoccupancyproperty state of the unit with featureid"UNIT26".
Update a feature state
To update the occupied state of the unit with feature id "UNIT26":
In the Postman app, select New.
In the Create New window, select HTTP Request.
Enter a Request name for the request, such as PUT Set Stateset.
Select the PUT HTTP method.
Enter the following URL to the Feature Statesets API. The request should look like the following URL (replace
{Azure-Maps-Primary-Subscription-key}with your primary subscription key, and{statesetId} with thestatesetIdobtained in Create a feature stateset):https://us.atlas.microsoft.com/featurestatesets/{statesetId}/featureStates/UNIT26?api-version=2.0&subscription-key={Your-Azure-Maps-Primary-Subscription-key}Select the Headers tab.
In the KEY field, select
Content-Type.In the VALUE field, select
application/json.
Select the Body tab.
In the dropdown lists, select raw and JSON.
Copy the following JSON style, and then paste it in the Body window:
{ "states": [ { "keyName": "occupied", "value": true, "eventTimestamp": "2020-11-14T17:10:20" } ] }Note
The update will be saved only if the time posted stamp is after the time stamp of the previous request.
Select Send.
After the update completes, you'll receive a
200 OKHTTP status code. If you implemented dynamic styling for an indoor map, the update displays at the specified time stamp in your rendered map.
You can use the Feature Get Stateset API to retrieve the state of a feature using its feature id. You can also use the Feature State Delete State API to delete the stateset and its resources.
To learn more about the different Azure Maps Creator services discussed in this article, see Creator Indoor Maps.
Clean up resources
There aren't any resources that require cleanup.
Next steps
To learn how to use the Indoor Maps module, see