Using Bing Maps to calculate routes to stay within countries
Blog|25 March 2020
![](https://greymatter.com/wp-content/uploads/2021/12/Calculate-API-Truck-API-4.png)
At times, route planning calculations can return the fastest route through a neighbouring country. In the following use case example, driving from “Mussey Township, MI” to “850 Lake Ave, Rochester, NY”, the calculation for the fastest route is via Ontario, Canada at Blue Water Bridge, and then entering New York, United States:
![](https://greymatter.com/wp-content/uploads/2021/12/Calculate-API-Truck-API-1.png)
Bing Maps Calculate Route API
Visa requirements and custom duties mean that some drivers and vehicles need to keep their routes within the United States (for example). Using the optional parameter avoid=borderCrossing
, Bing Maps Calculate Route API can offer an alternate route, which may have a longer travel time and travel distance, but the route is kept within the United States without crossing country borders. The example map is below:
![](https://greymatter.com/wp-content/uploads/2021/12/Calculte-API-Truck-API-2.png)
Bing Maps Truck Routing API border crossing restrictions
In addition to avoid=borderCrossing
for avoiding crossing country borders for auto and truck routes, Bing Maps now also supports customisable border crossing restrictions for the Truck Routing API. This optional borderRestriction
parameter supports specifying regions or geographic areas where border crossing should be avoided, is allowed or must be minimised.
Transport rules to consider
Transport rules can vary. Some rules may allow trucks to route through some countries while strictly prohibit the trucks from entering other countries. There may be state or federal regulations around transportation of items such as tobacco, alcohol, medicines or controlled substances across a country border or state lines.
The Bing Maps Truck Routing API can now handle these scenarios by simply setting a parameter in the API call. For this use case example, our scenario is a truck driver who needs to drive from Ashville, TN to Jacksonville, FL, with a requirement to avoid driving through the state of Georgia. Using the borderRestriction
parameter the API returns the following:
![](https://greymatter.com/wp-content/uploads/2021/12/Calculate-API-Truck-API-3.jpg)
When visualised on the map below, the example without the borderRestriction
parameter shows the broken black line tracking the route through the state of Georgia. The blue line shows the route specified using the borderRestriction
parameter, with the state boundary restriction for Georgia (US-GA).
![](https://greymatter.com/wp-content/uploads/2021/12/Calculate-API-Truck-API-4.png)
For more details on these new Bing Maps features, read the Calculate a Route API and Calculate a Truck Route API documentation.
For more information about Microsoft Bing Maps, or to discuss your use case, contact the Grey Matter team of mapping specialists. Call them direct on +44 (0)1364 655 133 or email mapping@greymatter.com
Contact Grey Matter
If you have any questions or want some extra information, complete the form below and one of the team will be in touch ASAP. If you have a specific use case, please let us know and we'll help you find the right solution faster.
By submitting this form you are agreeing to our Privacy Policy and Website Terms of Use.
Related News
Our Donation to Moor Trees
In May, we sponsored Microsoft Build 2024, and also had a Partner Showcase page where you could check out our demos and free resources. Download our digital swag bag and view our session for Build, Building a better way to...
Grey Matter and AppCheck Partnership
Grey Matter is delighted to announce our partnership with AppCheck to expand our security solutions for testing and vulnerability management. About AppCheck AppCheck provides up-to-the-minute coverage of your assets. This includes Web Apps, SPA, APIs, CMS systems, and Infrastructure networks....
VMware on Azure
Embarking on a journey to the cloud can be a transformative experience for businesses, and VMware on Azure offers a seamless path to achieve this transition. This powerful combination enables organisations to migrate, manage, and modernise their applications more easily....
Microsoft 365 Copilot for Operations
Discourse surrounding Generative AI in the workplace varies depending on who you ask, with some lauding its ability to cut down on the time spent on repetitive tasks, and others suggesting that it’s not quite up to scratch. But if...