|
| 1 | +--- |
| 2 | +title: Migrate Azure Maps Traffic API |
| 3 | +titleSuffix: Microsoft Azure Maps |
| 4 | +description: Learn how to Migrate the Azure Maps Traffic API version 1.0. |
| 5 | +author: farazgis |
| 6 | +ms.author: fsiddiqui |
| 7 | +ms.date: 03/28/2025 |
| 8 | +ms.topic: how-to |
| 9 | +ms.service: azure-maps |
| 10 | +ms.subservice: rest-api |
| 11 | +--- |
| 12 | + |
| 13 | +# Migrate Azure Maps Traffic 1.0 APIs |
| 14 | + |
| 15 | +This article provides guidance on migrating the Azure Maps [Traffic v1 service] to other Azure Maps services. |
| 16 | + |
| 17 | +The following table outlines all Traffic service along with their respective migration options. |
| 18 | + |
| 19 | +| Azure Maps Traffic v1.0 | Azure Maps migration option | |
| 20 | +|-------------------------|------------------------------| |
| 21 | +| [Get Traffic Flow Segment] | No direct replacement.<br/>Map tiles can be used to visualize traffic flow, but speed and travel time isn't available. | |
| 22 | +| [Get Traffic Flow Tile]<br/>- Absolute <br/>- Reduced sensitivity <br/>- Relative <br/>- Relative delay | [Get Map Tile]<br/>[TilesetID] <br/>- microsoft.traffic.absolute (vector) <br/>- microsoft.traffic.absolute.main (raster) <br/>- microsoft.traffic.relative (vector) <br/>- microsoft.traffic.relative.dark (raster) <br/>- microsoft.traffic.relative.main (raster) <br/>- microsoft.traffic.delay (vector) <br/>- microsoft.traffic.delay.main (raster) <br/>- microsoft.traffic.reduced.main (raster) | |
| 23 | +| [Get Traffic Incident Detail] | [Get Traffic Incident] | |
| 24 | +| [Get Traffic Incident Tile]| [Get Map Tile] <br/>[TilesetID] <br/>- microsoft.traffic.incident (vector) | |
| 25 | +| [Get Traffic Incident Viewport] | No replacement.<br/>Returns the traffic model ID used by Traffic v1 service, but isn't required for the latest traffic or render services. | |
| 26 | + |
| 27 | +## Notable differences |
| 28 | + |
| 29 | +- Unlike the Traffic v1.0 service, the latest Azure Maps [Get Traffic Incident] API and the Render service [Get Map Tile] API don't require a traffic model ID. |
| 30 | + |
| 31 | +- The [Get Traffic Incident] v2025-01-01 input bounding box and response are in the GeoJSON format. |
| 32 | + |
| 33 | +- [Traffic Flow Segment][Get Traffic Flow Segment] v1.0 provides information about vehicle speeds and travel times of the road segment. This information isn't available in the latest version, but the traffic data can be visualized using the Render [Get Map Tile] API. |
| 34 | + |
| 35 | +- To assign an icon category to the points returned by [Get Traffic Incident] v2025-01-01, use the `incidentType` enum provided in the response. |
| 36 | + |
| 37 | +- Traffic map tiles are available in vector and raster format in the Render service using the [Get Map Tile] API. |
| 38 | + |
| 39 | +## Transactions usage |
| 40 | + |
| 41 | +For information on how transactions are calculated for the Traffic and Render services, see [Understanding Azure Maps Transactions]. |
| 42 | + |
| 43 | +## Traffic service examples |
| 44 | + |
| 45 | +This section provides example requests and responses for version 1.0 and 2025-01-01 of the Traffic Incident API and version 2024-04-01 the Render Map Tile API. |
| 46 | + |
| 47 | +### Traffic Incident version 1.0 example |
| 48 | + |
| 49 | +Version 1.0 of the Traffic Incident API is an HTTP `GET` request that returns all traffic incidents within the specified bounding box. |
| 50 | + |
| 51 | +```http |
| 52 | +https://atlas.microsoft.com/traffic/incident/detail/json?api-version=1.0&style=s3&boundingbox=37,-105,45,-94&boundingZoom=11&trafficmodelid=1335294634919&projection=EPSG4326&subscription-key={Your-Azure-Maps-Subscription-key} |
| 53 | +``` |
| 54 | + |
| 55 | +The response contains all traffic incidents within the specified bounding box in JSON format. The results are truncated for brevity. |
| 56 | + |
| 57 | +```json |
| 58 | +{ |
| 59 | + "tm": { |
| 60 | + "@id": "1742459680", |
| 61 | + "poi": [ |
| 62 | + { |
| 63 | + "id": "CLUSTER_80251", |
| 64 | + "p": { |
| 65 | + "x": -105.0012712, |
| 66 | + "y": 39.7117135 |
| 67 | + }, |
| 68 | + "ic": 8, |
| 69 | + "ty": 0, |
| 70 | + "cbl": { |
| 71 | + "x": -105.0038575, |
| 72 | + "y": 39.7096459 |
| 73 | + }, |
| 74 | + "ctr": { |
| 75 | + "x": -104.99992, |
| 76 | + "y": 39.7148278 |
| 77 | + }, |
| 78 | + "cs": 4, |
| 79 | + "l": 1132 |
| 80 | + }, |
| 81 | + { |
| 82 | + "id": "CLUSTER_80249", |
| 83 | + "p": { |
| 84 | + "x": -105.0070862, |
| 85 | + "y": 39.7491353 |
| 86 | + }, |
| 87 | + "ic": 13, |
| 88 | + "ty": 0, |
| 89 | + "cbl": { |
| 90 | + "x": -105.0214434, |
| 91 | + "y": 39.7391984 |
| 92 | + }, |
| 93 | + "ctr": { |
| 94 | + "x": -104.9985481, |
| 95 | + "y": 39.7597951 |
| 96 | + }, |
| 97 | + "cs": 12, |
| 98 | + "l": 2276 |
| 99 | + } |
| 100 | + ] |
| 101 | + } |
| 102 | +} |
| 103 | +``` |
| 104 | + |
| 105 | +### Traffic Incident version 2025-01-01 example |
| 106 | + |
| 107 | +Version 2025-01-01 of the Traffic Incident API is an HTTP `GET` request that returns all traffic incidents within the specified bounding box. |
| 108 | + |
| 109 | +```http |
| 110 | +https://atlas.microsoft.com/traffic/incident?api-version=2025-01-01&bbox=-105,37,-94,45&subscription-key={Your-Azure-Maps-Subscription-key} |
| 111 | +``` |
| 112 | + |
| 113 | +The response contains all traffic incidents within the specified bounding box in GeoJSON format. The following example shows a single traffic incident of type "Accident": |
| 114 | + |
| 115 | +```json |
| 116 | +{ |
| 117 | + "type": "FeatureCollection", |
| 118 | + "features": [ |
| 119 | + { |
| 120 | + "type": "Feature", |
| 121 | + "id": 18558549332008001, |
| 122 | + "geometry": { |
| 123 | + "type": "Point", |
| 124 | + "coordinates": [ |
| 125 | + -104.939053, |
| 126 | + 39.682642 |
| 127 | + ] |
| 128 | + }, |
| 129 | + "properties": { |
| 130 | + "startTime": "2025-09-12T09:31:37Z", |
| 131 | + "endTime": "2025-09-12T10:21:47Z", |
| 132 | + "description": "At CO 2/Colorado Boulevard (Denver) at Mile Point 204. Two right lanes are closed due to a crash.", |
| 133 | + "title": "I-25 N / US-87 N", |
| 134 | + "incidentType": "Accident", |
| 135 | + "severity": 4, |
| 136 | + "delay": null, |
| 137 | + "lastModified": "2025-09-12T10:21:47Z", |
| 138 | + "endPoint": { |
| 139 | + "type": "Point", |
| 140 | + "coordinates": [ |
| 141 | + -104.940412, |
| 142 | + 39.68307 |
| 143 | + ] |
| 144 | + }, |
| 145 | + "isTrafficJam": false, |
| 146 | + "isRoadClosed": false |
| 147 | + } |
| 148 | + } |
| 149 | +] |
| 150 | +} |
| 151 | +``` |
| 152 | + |
| 153 | +### Azure Maps Render Get Map Tile v2024-04-01 |
| 154 | + |
| 155 | +The Azure Maps Render Get Map Tile API is an HTTP `GET` request that returns relative traffic vector tiles. |
| 156 | + |
| 157 | +#### Example Request |
| 158 | + |
| 159 | +```http |
| 160 | +https://atlas.microsoft.com/map/tile?api-version=2024-04-01&tilesetId=microsoft.traffic.relative&zoom=6&x=10&y=22&subscription-key={Your-Azure-Maps-Subscription-key} |
| 161 | +``` |
| 162 | + |
| 163 | +#### Example Response |
| 164 | + |
| 165 | +Content-Type: application/vnd.mapbox-vector-tile |
| 166 | + |
| 167 | +"binary image string" |
| 168 | + |
| 169 | +[Get Map Tile]: /rest/api/maps/render/get-map-tile |
| 170 | +[Get Traffic Flow Segment]: /rest/api/maps/traffic/get-traffic-flow-segment?view=rest-maps-1.0 |
| 171 | +[Get Traffic Flow Tile]: /rest/api/maps/traffic/get-traffic-flow-tile#trafficflowtilestyle?view=rest-maps-1.0 |
| 172 | +[Get Traffic Incident Detail]: /rest/api/maps/traffic/get-traffic-incident-detail?view=rest-maps-1.0 |
| 173 | +[Get Traffic Incident]: /rest/api/maps/traffic/get-traffic-incident |
| 174 | +[Get Traffic Incident Tile]: /rest/api/maps/traffic/get-traffic-incident-tile?view=rest-maps-1.0 |
| 175 | +[Get Traffic Incident Viewport]: /rest/api/maps/traffic/get-traffic-incident-viewport?view=rest-maps-1.0 |
| 176 | +[TilesetID]: /rest/api/maps/render/get-map-tile#tilesetid |
| 177 | +[Traffic v1 service]: /rest/api/maps/traffic?view=rest-maps-1.0 |
| 178 | +[Understanding Azure Maps Transactions]: /azure/azure-maps/understanding-azure-maps-transactions |
0 commit comments