This is not currently available in Azure Maps, however it is a feature that is being investigated as a possible enhancement. Consider adding this as a feature request here: https://feedback.azure.com/forums/909172-azure-maps
Calculate Distance Region wise

Tejinder S
1
Reputation point
looking for a solution to calculate route distance for each province/region, For example, my route start from Vancouver BC, Canada and ends at Toronto ON, I want to get the distance I travelled in each province/region. like in BC 300 and AB 400 etc.
I am using Azure Map API to calculate route distance (calculateRouteDirections).
Is anyone know, how I can get that.
Thanks in advance for helping.
Ok, Bing Maps and Azure Maps are two different mapping platforms.
I believe Bing Maps does include information about when a route crosses provinces as part of the instructions, but not exposed as a property of the route itself. So you would have to scan the instructions which may be error prone and would likely need different logic if you want to support additional languages such as French.
Depending on how accurate you need to be, a common way to achieve this is to get set of polygons for each province, then loop through them and calculate the intersection with the route line. Then you will have the route line sections for each province.
Thanks,
I will try Bing APIs and lets see what I will get in instructions