title | titleSuffix | description | author | ms.author | ms.date | ms.topic | ms.service | services |
---|---|---|---|---|---|---|---|---|
Tutorial: Query datasets with WFS API |
Microsoft Azure Maps |
The second tutorial on Microsoft Azure Maps Creator. How to Query datasets with WFS API |
stevemunk |
v-munksteve |
01/28/2022 |
tutorial |
azure-maps |
azure-maps |
This tutorial describes how to query Azure Maps Creator datasets using WFS API. You can use the WFS API to query features within a dataset. For example, you can use WFS to find all mid-size meeting rooms in a specific building and floor level.
In this tutorial, you'll learn how to:
[!div class="checklist"]
- Query the Azure Maps Web Feature Service (WFS) API to query for all feature collections.
- Query the Azure Maps Web Feature Service (WFS) API to query for a specific collection.
First you'll query all collections, and then you'll query for the unit
collection.
- Successful completion of Tutorial: Use Creator to create indoor maps.
- The
datasetId
obtained in Check dataset creation status section of the previous tutorial.
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 query all collections in your dataset:
-
In the Postman app, create a new HTTP Request and save it 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 thedatasetId
obtained in the Check the dataset creation status section of the Use Creator to create indoor maps tutorial:https://us.atlas.microsoft.com/wfs/datasets/{datasetId}/collections?subscription-key={Your-Azure-Maps-Primary-Subscription-key}&api-version=2.0
-
Select Send.
-
The response body is returned in GeoJSON format and contains all collections in the dataset. For simplicity, the example here only shows the
unit
collection. 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 thelinks
element.{ "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" } ] },
In this section, you'll query WFS API for the unit
feature collection.
To query the unit collection in your dataset:
-
In the Postman app, create a new HTTP Request and save it 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 thedatasetId
obtained 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.0
-
Select Send.
-
After the response returns, copy the feature
id
for one of theunit
features. In the following example, the featureid
is "UNIT26". You'll use "UNIT26" as your featureid
when you Update a feature state in the next tutorial.{ "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": "" }, {"..."} ] }
See WFS for information on the Creator Web Feature Service REST API.
To learn how to use feature statesets to define dynamic properties and values on specific features in the final Creator tutorial.
[!div class="nextstepaction"] Tutorial: Create a feature stateset