Skip to content

Commit 692740d

Browse files
authored
Merge pull request #108414 from stevemunk/how-to-use-best-practices-for-routing
Improve grammar: Best practices for Azure Maps Route service
2 parents c710793 + 9231a49 commit 692740d

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

articles/azure-maps/how-to-use-best-practices-for-routing.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ services: azure-maps
1212

1313
# Best practices for Azure Maps Route service
1414

15-
The Route Directions and Route Matrix APIs in Azure Maps [Route service] can be used to calculate the estimated arrival times (ETAs) for each requested route. Route APIs consider factors such as real-time traffic information and historic traffic data, like the typical road speeds on the requested day of the week and time of day. The APIs return the shortest or fastest routes available to multiple destinations at a time in sequence or in optimized order, based on time or distance. Users can also request specialized routes and details for walkers, bicyclists, and commercial vehicles like trucks. In this article, we'll share the best practices to call Azure Maps [Route service], and you'll learn how-to:
15+
The Route Directions and Route Matrix APIs in Azure Maps [Route service] can be used to calculate the estimated arrival times (ETAs) for each requested route. Route APIs consider factors such as real-time traffic information and historic traffic data, like the typical road speeds on the requested date and time. The APIs return the shortest or fastest routes available to multiple destinations at a time in sequence or in optimized order, based on time or distance. Users can also request specialized routes and details for walkers, bicyclists, and commercial vehicles like trucks. This article discusses best practices for calling the Azure Maps [Route service], including how-to:
1616

1717
* Choose between the Route Directions APIs and the Matrix Routing API
1818
* Request historic and predicted travel times, based on real-time and historical traffic data
@@ -35,7 +35,7 @@ This article uses the [Postman] application to build REST calls, but you can cho
3535

3636
## Choose between Route Directions and Matrix Routing
3737

38-
The Route Directions APIs return instructions including the travel time and the coordinates for a route path. The Route Matrix API lets you calculate the travel time and distances for a set of routes that are defined by origin and destination locations. For every given origin, the Matrix API calculates the cost (travel time and distance) of routing from that origin to every given destination. These API allow you to specify parameters such as the desired departure time, arrival times, and the vehicle type, like car or truck. They all use real-time or predictive traffic data accordingly to return the most optimal routes.
38+
The Route Directions APIs return instructions including the travel time and the coordinates for a route path. The Route Matrix API lets you calculate the travel time and distances for a set of routes defined by origin and destination locations. For every given origin, the Matrix API calculates the cost (travel time and distance) of routing from that origin to every given destination. These API allow you to specify parameters such as the desired departure time, arrival times, and the vehicle type, like car or truck. They all use real-time or predictive traffic data accordingly to return the most optimal routes.
3939

4040
Consider calling Route Directions APIs if your scenario is to:
4141

@@ -50,7 +50,7 @@ Consider calling Matrix Routing API if your scenario is to:
5050
* Sort potential routes by their actual travel distance or time. The Matrix API returns only travel times and distances for each origin and destination combination.
5151
* Cluster data based on travel time or distances. For example, your company has 50 employees, find all employees that live within 20 minute Drive Time from your office.
5252

53-
Here is a comparison to show some capabilities of the Route Directions and Matrix APIs:
53+
Here's a comparison to show some capabilities of the Route Directions and Matrix APIs:
5454

5555
| Azure Maps API | Max number of queries in the request | Avoid areas | Truck and electric vehicle routing | Waypoints and Traveling Salesman optimization | Supporting points |
5656
| :--------------: | :--------------: | :--------------: | :--------------: | :--------------: | :--------------: |
@@ -63,11 +63,11 @@ To learn more about electric vehicle routing capabilities, see our tutorial on h
6363

6464
## Request historic and real-time data
6565

66-
By default, the Route service assumes the traveling mode is a car and the departure time is now. It returns route based on real-time traffic conditions unless a route calculation request specifies otherwise. Fixed time-dependent traffic restrictions, like 'Left turns aren't allowed between 4:00 PM to 6:00 PM' are captured and will be considered by the routing engine. Road closures, like roadworks, will be considered unless you specifically request a route that ignores the current live traffic. To ignore the current traffic, set `traffic` to `false` in your API request.
66+
By default, the Route service assumes the traveling mode is a car and the departure time is now. It returns route based on real-time traffic conditions unless a route calculation request specifies otherwise. The routing engine factors fixed time-dependent traffic restrictions, like 'Left turns aren't allowed between 4:00 PM to 6:00 PM'. Road closures, like roadworks, are considered unless you specifically request a route that ignores the current live traffic. To ignore the current traffic, set `traffic` to `false` in your API request.
6767

68-
The route calculation **travelTimeInSeconds** value includes the delay due to traffic. It's generated by leveraging the current and historic travel time data, when departure time is set to now. If your departure time is set in the future, the APIs return predicted travel times based on historical data.
68+
The route calculation **travelTimeInSeconds** value includes the delay due to traffic. It's generated by using the current and historic travel time data, when departure time is set to now. If your departure time is set in the future, the APIs return predicted travel times based on historical data.
6969

70-
If you include the **computeTravelTimeFor=all** parameter in your request, then the summary element in the response will have the following additional fields including historical traffic conditions:
70+
If you include the **computeTravelTimeFor=all** parameter in your request, then the summary element in the response has the following fields including historical traffic conditions:
7171

7272
| Element | Description|
7373
| :--- | :--- |
@@ -85,7 +85,7 @@ In the first example below the departure time is set to the future, at the time
8585
https://atlas.microsoft.com/route/directions/json?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=1.0&query=51.368752,-0.118332:51.385426,-0.128929&travelMode=car&traffic=true&departAt=2025-03-29T08:00:20&computeTravelTimeFor=all
8686
```
8787

88-
The response contains a summary element, like the one below. Because the departure time is set to the future, the **trafficDelayInSeconds** value is zero. The **travelTimeInSeconds** value is calculated using time-dependent historic traffic data. So, in this case, the **travelTimeInSeconds** value is equal to the **historicTrafficTravelTimeInSeconds** value.
88+
The response contains a summary element, like the following example. Because the departure time is set to the future, the **trafficDelayInSeconds** value is zero. The **travelTimeInSeconds** value is calculated using time-dependent historic traffic data. So, in this case, the **travelTimeInSeconds** value is equal to the **historicTrafficTravelTimeInSeconds** value.
8989

9090
```json
9191
"summary": {
@@ -102,13 +102,13 @@ The response contains a summary element, like the one below. Because the departu
102102

103103
### Sample query
104104

105-
In the second example below, we have a real-time routing request, where departure time is now. It's not explicitly specified in the URL because it's the default value.
105+
In the next example, we have a real-time routing request, where departure time is now. It's not explicitly specified in the URL because it's the default value.
106106

107107
```http
108108
https://atlas.microsoft.com/route/directions/json?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=1.0&query=47.6422356,-122.1389797:47.6641142,-122.3011268&travelMode=car&traffic=true&computeTravelTimeFor=all
109109
```
110110

111-
The response contains a summary as shown below. Because of congestions, the **trafficDelaysInSeconds** value is greater than zero. It's also greater than **historicTrafficTravelTimeInSeconds**.
111+
The response contains a summary as shown in the following example. Because of congestion, the **trafficDelaysInSeconds** value is greater than zero. It's also greater than **historicTrafficTravelTimeInSeconds**.
112112

113113
```json
114114
"summary": {
@@ -125,7 +125,7 @@ The response contains a summary as shown below. Because of congestions, the **tr
125125

126126
## Request route and leg details
127127

128-
By default, the Route service will return an array of coordinates. The response will contain the coordinates that make up the path in a list named `points`. Route response also includes the distance from the start of the route and the estimated elapsed time. These values can be used to calculate the average speed for the entire route.
128+
By default, the Route service returns an array of coordinates. The response contains the coordinates that make up the path in a list named `points`. Route response also includes the distance from the start of the route and the estimated elapsed time. These values can be used to calculate the average speed for the entire route.
129129

130130
The following image shows the `points` element.
131131

@@ -165,13 +165,13 @@ The Route API returns directions that accommodate the dimensions of the truck an
165165

166166
### Sample query
167167

168-
Changing the US Hazmat Class, from the above query, will result in a different route to accommodate this change.
168+
Changing the US Hazmat Class, from the above query, results in a different route to accommodate this change.
169169

170170
```http
171171
https://atlas.microsoft.com/route/directions/json?subscription-key={Your-Azure-Maps-Subscription-key}&api-version=1.0&vehicleWidth=2&vehicleHeight=2&vehicleCommercial=true&vehicleLoadType=USHazmatClass9&travelMode=truck&instructionsType=text&query=51.368752,-0.118332:41.385426,-0.128929
172172
```
173173

174-
The response below is for a truck carrying a class 9 hazardous material, which is less dangerous than a class 1 hazardous material. When you expand the `guidance` element to read the directions, you'll notice that the directions aren't the same. There are more route instructions for the truck carrying class 1 hazardous material.
174+
The following response is for a truck carrying a class 9 hazardous material, which is less dangerous than a class 1 hazardous material. When you expand the `guidance` element to read the directions, notice that the directions aren't the same. There are more route instructions for the truck carrying class 1 hazardous material.
175175

176176
![Truck with class 9 hazwaste](media/how-to-use-best-practices-for-routing/truck-with-hazwaste9-img.png)
177177

@@ -191,7 +191,7 @@ The response contains the sections that are suitable for traffic along the given
191191

192192
![Traffic sections](media/how-to-use-best-practices-for-routing/traffic-section-type-img.png)
193193

194-
This option can be used to color the sections when rendering the map, as in the image below:
194+
This option can be used to color the sections when rendering the map, as in The following image:
195195

196196
![Colored sections rendered on map](media/how-to-use-best-practices-for-routing/show-traffic-sections-img.png)
197197

@@ -203,7 +203,7 @@ Azure Maps currently provides two forms of route optimizations:
203203

204204
* Traveling salesman optimization, which changes the order of the waypoints to obtain the best order to visit each stop
205205

206-
For multi-stop routing, up to 150 waypoints may be specified in a single route request. The starting and ending coordinate locations can be the same, as would be the case with a round trip. But you need to provide at least one additional waypoint to make the route calculation. Waypoints can be added to the query in-between the origin and destination coordinates.
206+
For multi-stop routing, up to 150 waypoints may be specified in a single route request. The starting and ending coordinate locations can be the same, as would be the case with a round trip. But you need to provide at least one more waypoint to make the route calculation. Waypoints can be added to the query in-between the origin and destination coordinates.
207207

208208
If you want to optimize the best order to visit the given waypoints, then you need to specify **computeBestOrder=true**. This scenario is also known as the traveling salesman optimization problem.
209209

@@ -219,7 +219,7 @@ The response describes the path length to be 140,851 meters, and that it would t
219219

220220
![Non-optimized response](media/how-to-use-best-practices-for-routing/non-optimized-response-img.png)
221221

222-
The image below illustrates the path resulting from this query. This path is one possible route. It's not the optimal path based on time or distance.
222+
The following image illustrates the path resulting from this query. This path is one possible route. It's not the optimal path based on time or distance.
223223

224224
![Non-optimized image](media/how-to-use-best-practices-for-routing/non-optimized-image-img.png)
225225

@@ -237,7 +237,7 @@ The response describes the path length to be 91,814 meters, and that it would ta
237237

238238
![Optimized response](media/how-to-use-best-practices-for-routing/optimized-response-img.png)
239239

240-
The image below illustrates the path resulting from this query.
240+
The following image illustrates the path resulting from this query.
241241

242242
![Optimized image](media/how-to-use-best-practices-for-routing/optimized-image-img.png)
243243

@@ -255,9 +255,9 @@ You might have situations where you want to reconstruct a route to calculate zer
255255
3. Order the locations based on the distance from the start of the route
256256
4. Add these locations as supporting points in a new route request to [Post Route Directions]. To learn more about the supporting points, see the [Post Route Directions API documentation].
257257

258-
When calling [Post Route Directions], you can set the minimum deviation time or the distance constraints, along with the supporting points. Use these parameters if you want to offer alternative routes, but you also want to limit the travel time. When these constraints are used, the alternative routes will follow the reference route from the origin point for the given time or distance. In other words, the other routes diverge from the reference route per the given constraints.
258+
When calling [Post Route Directions], you can set the minimum deviation time or the distance constraints, along with the supporting points. Use these parameters if you want to offer alternative routes, but you also want to limit the travel time. When these constraints are used, the alternative routes follow the reference route from the origin point for the given time or distance. In other words, the other routes diverge from the reference route per the given constraints.
259259

260-
The image below is an example of rendering alternative routes with specified deviation limits for the time and the distance.
260+
The following image is an example of rendering alternative routes with specified deviation limits for the time and the distance.
261261

262262
![Alternative routes](media/how-to-use-best-practices-for-routing/alternative-routes-img.png)
263263

@@ -270,24 +270,28 @@ The Azure Maps Web SDK provides a [Service module]. This module is a helper libr
270270
To learn more, please see:
271271

272272
> [!div class="nextstepaction"]
273-
> [Azure Maps Route service](/rest/api/maps/route)
273+
> [Azure Maps Route service]
274274
275275
> [!div class="nextstepaction"]
276-
> [How to use the Service module](./how-to-use-services-module.md)
276+
> [How to use the Service module]
277277
278278
> [!div class="nextstepaction"]
279-
> [Show route on the map](./map-route.md)
279+
> [Show route on the map]
280280
281281
> [!div class="nextstepaction"]
282-
> [Azure Maps npm Package](https://www.npmjs.com/package/azure-maps-rest )
282+
> [Azure Maps npm Package]
283283
284-
[Route service]: /rest/api/maps/route
285284
[Azure Maps account]: quick-demo-map-app.md#create-an-azure-maps-account
286-
[subscription key]: quick-demo-map-app.md#get-the-subscription-key-for-your-account
287-
[Routing Coverage]: routing-coverage.md
288-
[Postman]: https://www.postman.com/downloads/
289-
[RouteType]: /rest/api/maps/route/postroutedirections#routetype
285+
[Azure Maps npm Package]: https://www.npmjs.com/package/azure-maps-rest
286+
[Azure Maps Route service]: /rest/api/maps/route
287+
[How to use the Service module]: how-to-use-services-module.md
290288
[Point of Interest]: /rest/api/maps/search/getsearchpoi
291-
[Post Route Directions]: /rest/api/maps/route/postroutedirections
292289
[Post Route Directions API documentation]: /rest/api/maps/route/postroutedirections#supportingpoints
290+
[Post Route Directions]: /rest/api/maps/route/postroutedirections
291+
[Postman]: https://www.postman.com/downloads/
292+
[Route service]: /rest/api/maps/route
293+
[RouteType]: /rest/api/maps/route/postroutedirections#routetype
294+
[Routing Coverage]: routing-coverage.md
293295
[Service module]: /javascript/api/azure-maps-rest/
296+
[Show route on the map]: map-route.md
297+
[subscription key]: quick-demo-map-app.md#get-the-subscription-key-for-your-account

0 commit comments

Comments
 (0)