Skip to content

Commit a1773f7

Browse files
committed
Updated article (api-version=2024-04-01) and added 3 new examples.
1 parent d609ca0 commit a1773f7

File tree

8 files changed

+125
-36
lines changed

8 files changed

+125
-36
lines changed

articles/azure-maps/how-to-render-custom-data.md

Lines changed: 125 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@ The following are examples of custom data:
2828
- [Azure Maps account]
2929
- [Subscription key]
3030

31-
This article uses the [Postman] application, but you may use a different API development environment.
31+
This article uses the [Bruno] application, but you may use a different API development environment.
3232

3333
>[!IMPORTANT]
3434
> In the URL examples, replace `{Your-Azure-Maps-Subscription-key}` with your Azure Maps subscription key.
3535
3636
## Render pushpins with labels and a custom image
3737

3838
> [!NOTE]
39-
> The procedure in this section requires an Azure Maps account in the Gen1 or Gen2 pricing tier.
40-
The Azure Maps account Gen1 S0 pricing tier only supports a single instance of the [pins] parameter. It allows you to render up to five pushpins, specified in the URL request, with a custom image.
39+
> The procedure in this section requires an Azure Maps account in the Gen2 pricing tier.
4140
>
4241
> **Azure Maps Gen1 pricing tier retirement**
4342
>
@@ -47,25 +46,27 @@ The Azure Maps account Gen1 S0 pricing tier only supports a single instance of t
4746

4847
To get a static image with custom pins and labels:
4948

50-
1. In the Postman app, select **New**.
49+
1. In the Bruno app, select **New Request**.
5150

52-
2. In the **Create New** window, select **HTTP Request**.
51+
1. Set type to **HTTP**.
5352

54-
3. Enter a **Request name** for the request, such as *Get Map Static Image*.
53+
1. Enter a **Name** for the request, such as *Get Map Static Image*.
5554

56-
4. Select the **GET** HTTP method.
55+
1. Select the **GET** HTTP URL method.
5756

58-
5. Enter the following URL:
57+
1. Enter the following URL:
5958

6059
```HTTP
61-
https://atlas.microsoft.com/map/static/png?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=2022-08-01&layer=basic&style=main&zoom=12&center=-73.98,%2040.77&pins=custom%7Cla15+50%7Cls12%7Clc003b61%7C%7C%27CentralPark%27-73.9657974+40.781971%7C%7Chttps%3A%2F%2Fsamples.azuremaps.com%2Fimages%2Ficons%2Fylw-pushpin.png
60+
https://atlas.microsoft.com/map/static?subscription-key={Your-Azure-Maps-Subscription-key}&zoom=13&tilesetId=microsoft.base.road&api-version=2024-04-01&language=en-us&center=-73.964085, 40.78477&path=lcFF0000|lw2|la0.60|ra700||-122.13230609893799 47.64599069048016&pins=custom%7Cla15+50%7Cls12%7Clc003b61%7C%7C%27Central Park%27-73.9657974+40.781971%7C%7Chttps%3A%2F%2Fsamples.azuremaps.com%2Fimages%2Ficons%2Fylw-pushpin.png
6261
```
6362
64-
6. Select **Send**.
63+
1. Select **Create**.
6564
66-
7. The service returns the following image:
65+
1. Select the *Send Request* arrow that appears to the right of the request URL.
6766
68-
:::image type="content" source="./media/how-to-render-custom-data/render-pins.png" alt-text="A custom pushpin with a label.":::
67+
The following image is returned:
68+
69+
:::image type="content" source="./media/how-to-render-custom-data/render-pins.png" alt-text="A custom pushpin with a label.":::
6970
7071
## Render a polygon with color and opacity
7172
@@ -76,24 +77,23 @@ You can modify the appearance of a polygon by using style modifiers with the [pa
7677
7778
To render a polygon with color and opacity:
7879
79-
1. In the Postman app, select **New**.
80+
1. In the Bruno app, select **New Request**.
8081
81-
2. In the **Create New** window, select **HTTP Request**.
82+
1. Set type to **HTTP**.
8283
83-
3. Enter a **Request name** for the request, such as *GET Polygon*.
84+
1. Enter a **Name** for the request, such as *GET Polygon*.
8485
85-
4. Select the **GET** HTTP method.
86+
1. Select the **GET** HTTP URL method.
8687
87-
5. Enter the following URL to the [Render] service:
88+
1. Enter the following URL to the [Render] service:
8889
8990
```HTTP
90-
https://atlas.microsoft.com/map/static/png?api-version=2022-08-01&style=main&layer=basic&sku=S1&zoom=14&height=500&Width=500&center=-74.040701, 40.698666&path=lc0000FF|fc0000FF|lw3|la0.80|fa0.50||-74.03995513916016 40.70090237454063|-74.04082417488098 40.70028420372218|-74.04113531112671 40.70049568385827|-74.04298067092896 40.69899904076542|-74.04271245002747 40.69879568992435|-74.04367804527283 40.6980961582905|-74.04364585876465 40.698055487620714|-74.04368877410889 40.698022951066996|-74.04168248176573 40.696444909137|-74.03901100158691 40.69837271818651|-74.03824925422668 40.69837271818651|-74.03809905052185 40.69903971085914|-74.03771281242369 40.699340668780984|-74.03940796852112 40.70058515602143|-74.03948307037354 40.70052821920425|-74.03995513916016 40.70090237454063
91-
&subscription-key={Your-Azure-Maps-Subscription-key}
91+
https://atlas.microsoft.com/map/static?subscription-key={Your-Azure-Maps-Subscription-key}&zoom=15&tilesetId=microsoft.base.road&api-version=2024-04-01&language=en-us&path=lc0000FF|fc0000FF|lw3|la0.80|fa0.50||-74.03995513916016 40.70090237454063|-74.04082417488098 40.70028420372218|-74.04113531112671 40.70049568385827|-74.04298067092896 40.69899904076542|-74.04271245002747 40.69879568992435|-74.04367804527283 40.6980961582905|-74.04364585876465 40.698055487620714|-74.04368877410889 40.698022951066996|-74.04168248176573 40.696444909137|-74.03901100158691 40.69837271818651|-74.03824925422668 40.69837271818651|-74.03809905052185 40.69903971085914|-74.03771281242369 40.699340668780984|-74.03940796852112 40.70058515602143|-74.03948307037354 40.70052821920425|-74.03995513916016 40.70090237454063&pins=custom%7Cla15+50%7Cls12%7Clc003b61%7C%7C%27Central Park%27-73.9657974+40.781971%7C%7Chttps%3A%2F%2Fsamples.azuremaps.com%2Fimages%2Ficons%2Fylw-pushpin.png&center=-74.040701, 40.698666&height=500&Width=500
9292
```
9393
94-
6. The service returns the following image:
94+
The following image is returned:
9595
96-
:::image type="content" source="./media/how-to-render-custom-data/opaque-polygon.png" alt-text="Render an opaque polygon.":::
96+
:::image type="content" source="./media/how-to-render-custom-data/opaque-polygon.png" alt-text="Render an opaque polygon.":::
9797
9898
## Render a circle and pushpins with custom labels
9999
@@ -104,47 +104,135 @@ You can modify the appearance of the pins by adding style modifiers. For example
104104
105105
To render a circle and pushpins with custom labels:
106106
107-
1. In the Postman app, select **New**.
107+
1. In the Bruno app, select **New Request**.
108108
109-
2. In the **Create New** window, select **HTTP Request**.
109+
1. Set type to **HTTP**.
110110
111-
3. Enter a **Request name** for the request, such as *GET Polygon*.
111+
1. Enter a **Name** for the request, such as *GET Polygon*.
112112
113-
4. Select the **GET** HTTP method.
113+
1. Select the **GET** HTTP URL method.
114114
115-
5. Enter the following URL to the [Render] service:
115+
1. Enter the following URL to the [Render] service:
116116
117117
```HTTP
118-
https://atlas.microsoft.com/map/static/png?api-version=2022-08-01&style=main&layer=basic&zoom=14&height=700&Width=700&center=-122.13230609893799,47.64599069048016&path=lcFF0000|lw2|la0.60|ra1000||-122.13230609893799 47.64599069048016&pins=default|la15+50|al0.66|lc003C62|co002D62||'Microsoft Corporate Headquarters'-122.14131832122801 47.64690503939462|'Microsoft Visitor Center'-122.136828 47.642224|'Microsoft Conference Center'-122.12552547454833 47.642940335653996|'Microsoft The Commons'-122.13687658309935 47.64452336193245&subscription-key={Your-Azure-Maps-Subscription-key}
118+
https://atlas.microsoft.com/map/static?subscription-key={Your-Azure-Maps-Subscription-key}&zoom=14&tilesetId=microsoft.base.road&api-version=2024-04-01&language=en-us&center=-122.13230609893799,47.64599069048016&path=lcFF0000|lw2|la0.60|ra1000||-122.13230609893799 47.64599069048016&pins=default|la15+50|al0.66|lc003C62|co002D62||'Microsoft Corporate Headquarters'-122.14131832122801 47.64690503939462|'Microsoft Visitor Center'-122.136828 47.642224|'Microsoft Conference Center'-122.12552547454833 47.642940335653996|'Microsoft The Commons'-122.13687658309935 47.64452336193245&height=700&Width=700
119119
```
120120
121-
6. Select **Send**.
121+
1. Select **Create**.
122+
123+
1. Select the *Send Request* arrow that appears to the right of the request URL.
122124
123-
7. The service returns the following image:
125+
The following image is returned:
124126
125-
:::image type="content" source="./media/how-to-render-custom-data/circle-custom-pins.png" alt-text="Render a circle with custom pushpins.":::
127+
:::image type="content" source="./media/how-to-render-custom-data/circle-custom-pins.png" alt-text="Render a circle with custom pushpins.":::
126128
127-
8. Next, change the color of the pushpins by modifying the `co` style modifier. If you look at the value of the `pins` parameter (`pins=default|la15+50|al0.66|lc003C62|co002D62|`), notice that the current color is `#002D62`. To change the color to `#41d42a`, replace `#002D62` with `#41d42a`. Now the `pins` parameter is `pins=default|la15+50|al0.66|lc003C62|co41D42A|`. The request looks like the following URL:
129+
1. Next, change the color of the pushpins by modifying the `co` style modifier. If you look at the value of the `pins` parameter (`pins=default|la15+50|al0.66|lc003C62|co002D62|`), notice that the current color is `#002D62`. To change the color to `#41d42a`, replace `#002D62` with `#41d42a`. Now the `pins` parameter is `pins=default|la15+50|al0.66|lc003C62|co41D42A|`. The request looks like the following URL:
128130
129131
```HTTP
130-
https://atlas.microsoft.com/map/static/png?api-version=2022-08-01&style=main&layer=basic&zoom=14&height=700&Width=700&center=-122.13230609893799,47.64599069048016&path=lcFF0000|lw2|la0.60|ra1000||-122.13230609893799 47.64599069048016&pins=default|la15+50|al0.66|lc003C62|co41D42A||'Microsoft Corporate Headquarters'-122.14131832122801 47.64690503939462|'Microsoft Visitor Center'-122.136828 47.642224|'Microsoft Conference Center'-122.12552547454833 47.642940335653996|'Microsoft The Commons'-122.13687658309935 47.64452336193245&subscription-key={Your-Azure-Maps-Subscription-key}
132+
https://atlas.microsoft.com/map/static?subscription-key={Your-Azure-Maps-Subscription-key}&zoom=14&tilesetId=microsoft.base.road&api-version=2024-04-01&language=en-us&center=-122.13230609893799,47.64599069048016&path=lcFF0000|lw2|la0.60|ra1000||-122.13230609893799 47.64599069048016&pins=default|la15+50|al0.66|lc003C62|co41D42A||'Microsoft Corporate Headquarters'-122.14131832122801 47.64690503939462|'Microsoft Visitor Center'-122.136828 47.642224|'Microsoft Conference Center'-122.12552547454833 47.642940335653996|'Microsoft The Commons'-122.13687658309935 47.64452336193245&height=700&Width=700
131133
```
132134
133-
9. Select **Send**.
135+
1. Select **Create**.
134136
135-
10. The service returns the following image:
137+
1. Select the *Send Request* arrow that appears to the right of the request URL.
136138
137-
:::image type="content" source="./media/how-to-render-custom-data/circle-updated-pins.png" alt-text="Render a circle with updated pushpins.":::
139+
The following image is returned:
140+
141+
:::image type="content" source="./media/how-to-render-custom-data/circle-updated-pins.png" alt-text="Render a circle with updated pushpins.":::
138142
139143
Similarly, you can change, add, and remove other style modifiers.
140144
145+
### Add a traffic layer
146+
147+
To get a static image with a traffic layer rendered on a roads basemap, use the `trafficLayer` parameter. The following example shows a map with a traffic layer as well as a pin with a label:
148+
149+
1. In the Bruno app, select **New Request**.
150+
151+
1. Set type to **HTTP**.
152+
153+
1. Enter a **Name** for the request, such as *Get Map Static Image - traffic layer*.
154+
155+
1. Select the **GET** HTTP URL method.
156+
157+
1. Enter the following URL:
158+
159+
```HTTP
160+
https://atlas.microsoft.com/map/static?subscription-key={Your-Azure-Maps-Subscription-key}&zoom=14&tilesetId=microsoft.base.road&api-version=2024-04-01&language=en-us&center= -0.122427, 51.500867&pins=custom%7Cla15+50%7Cls12%7Clc003b61%7C%7C%27Westminster Bridge%27-0.122427+51.500867%7C%7Chttps%3A%2F%2Fsamples.azuremaps.com%2Fimages%2Ficons%2Fylw-pushpin.png&height=700&Width=700&trafficLayer=microsoft.traffic.relative.main
161+
```
162+
163+
1. Select **Create**.
164+
165+
1. Select the *Send Request* arrow that appears to the right of the request URL.
166+
167+
The following image is returned:
168+
169+
:::image type="content" source="./media/how-to-render-custom-data/rendering-traffic-layer-information.png" alt-text="A screenshot of a map showing the traffic layer, as well as a custom pushpin with the label Westminster Bridge.":::
170+
171+
### Create a map using the dark gray style
172+
173+
To get a static image with the dark gray style appplied, set the `TilesetId` parameter to `microsoft.base.darkgrey`:
174+
175+
1. In the Bruno app, select **New Request**.
176+
177+
1. Set type to **HTTP**.
178+
179+
1. Enter a **Name** for the request, such as *Get Map Static Image - dark gray style*.
180+
181+
1. Select the **GET** HTTP URL method.
182+
183+
1. Enter the following URL:
184+
185+
```HTTP
186+
https://atlas.microsoft.com/map/static?subscription-key={Your-Azure-Maps-Subscription-key}&zoom=16&tilesetId=microsoft.base.darkgrey&api-version=2024-04-01&language=en-us&center=-95.360200,29.753452&pins=custom%7Cla15+50%7Cls12%7Clc003b61%7C%7C%27Westminster Bridge%27-0.122427+51.500867%7C%7Chttps%3A%2F%2Fsamples.azuremaps.com%2Fimages%2Ficons%2Fylw-pushpin.png&height=700&Width=700
187+
```
188+
189+
1. Select **Create**.
190+
191+
1. Select the *Send Request* arrow that appears to the right of the request URL.
192+
193+
The following image is returned:
194+
195+
:::image type="content" source="./media/how-to-render-custom-data/darkgray.png" alt-text="A screenshot of a map showing the dark gray style created by setting the tileset ID parameter to microsoft.base.darkgrey.":::
196+
197+
For more information the different styles available using the TilesetId parameter, see [TilesetId] in the *Render - Get Map Tileset* REST API documentation.
198+
199+
200+
### Create a map using the imagery style
201+
202+
To get a static image with the imagery style appplied, set the `TilesetId` parameter to `microsoft.imagery`:
203+
204+
1. In the Bruno app, select **New Request**.
205+
206+
1. Set type to **HTTP**.
207+
208+
1. Enter a **Name** for the request, such as *Get Map Static Image - imagery style*.
209+
210+
1. Select the **GET** HTTP URL method.
211+
212+
1. Enter the following URL:
213+
214+
```HTTP
215+
https://atlas.microsoft.com/map/static?subscription-key={Your-Azure-Maps-Subscription-key}&zoom=16&tilesetId=microsoft.base.darkgrey&api-version=2024-04-01&language=en-us&center=-95.360200,29.753452&pins=custom%7Cla15+50%7Cls12%7Clc003b61%7C%7C%27Westminster Bridge%27-0.122427+51.500867%7C%7Chttps%3A%2F%2Fsamples.azuremaps.com%2Fimages%2Ficons%2Fylw-pushpin.png&height=700&Width=700
216+
```
217+
218+
1. Select **Create**.
219+
220+
1. Select the *Send Request* arrow that appears to the right of the request URL.
221+
222+
The following image is returned:
223+
224+
:::image type="content" source="./media/how-to-render-custom-data/darkgray.png" alt-text="A screenshot of a map showing the dark gray style created by setting the tileset ID parameter to microsoft.base.darkgrey.":::
225+
226+
For more information the different styles available using the TilesetId parameter, see [TilesetId] in the *Render - Get Map Tileset* REST API documentation.
227+
228+
141229
## Next steps
142230
143231
> [!div class="nextstepaction"]
144232
> [Render - Get Map Static Image]
145233
146234
[Azure Maps account]: quick-demo-map-app.md#create-an-azure-maps-account
147-
[Postman]: https://www.postman.com/
235+
[Bruno]: https://www.usebruno.com/
148236
[Subscription key]: quick-demo-map-app.md#get-the-subscription-key-for-your-account
149237
150238
[Get Map Static Image]: /rest/api/maps/render/get-map-static-image
@@ -153,3 +241,4 @@ Similarly, you can change, add, and remove other style modifiers.
153241
[pins]: /rest/api/maps/render/get-map-static-image#uri-parameters
154242
[Render]: /rest/api/maps/render/get-map-static-image
155243
[Render - Get Map Static Image]: /rest/api/maps/render/get-map-static-image
244+
[TilesetId]: /rest/api/maps/render/get-map-tileset#tilesetid
378 KB
Loading
384 KB
Loading
344 KB
Loading
1.71 MB
Loading
109 KB
Loading
542 KB
Loading
1.21 MB
Loading

0 commit comments

Comments
 (0)