1

There are 1 best solutions below

0
Shawn Domingo On

The feature is currently not available for Directions API, however, you may file a Feature Request in the Issue Tracker and share your use case so the engineers can review the feasibility of the feature.

As a workaround, what you may do is scan the results of the request then look for strings like "Passing through Idaho Entering Washington", this way, you'll know that a boundary has been crossed, you may then call a Timezone API request to return the timezone information.

for this sample request:

Origin: Roundup, MT 59072, USA

Destination: 2945 Jacklin Rd, Victoria, BC V9B 5E3, Canada

URL Request: https://maps.googleapis.com/maps/api/directions/json?origin=Roundup%2C%20Montana%2059072%2C%20USA&destination=2945%20Jacklin%20Rd%2C%20Victoria%2C%20BC%20V9B%205E3&mode=driving&key=YOUR_API_KEY

If you inspect the result, you will see in the html_instruction there will be instructions:

"html_instructions":"Merge onto I-90 W
Passing through Idaho
Entering Washington
",

and

"html_instructions":"Merge onto I-5 N
Entering Canada (British Columbia)
",

This will be your basis on whether a timezone has been crossed, but please also note that this may not be very reliable. I would still suggest that you file a Feature Request for this.