We have two new features for the Directions Web Service Beta today. One of which is awesome and cool, and is rather obvious in what it does - That would be Time Dependent Routing. The second is incredibly powerful and complex, and is going to take a little time to explain, and that is Path From Route.
Time Dependent Routing
We've added new parameters to the Route function that let you tell us what time, and on what day, you want to start your directions. "Why would that matter?" I hear you ask. Well, the road network can change depending on the time of day. Sometimes a road is open, and sometimes it is not. Sometimes you can turn left at an intersection, and sometimes you can't. There's usually a sign at these lights telling you the hours you are allowed to turn left, and the hours you aren't. You normally only get to see them at the wrong time of day, sitting in a left turn lane with your indicator blinking, wondering how you are going to get back into traffic and what to do now you can't use the road you thought you could. We try to avoid giving people directions that would leave them stranded like that. However, now, by telling us when you plan to travel, we can take this into account and provide better directions that could get you there faster than if we didn't know when you were traveling.
Make sense? good! ok, here's an example...
Because you cannot turn left at certain times, normally we have to route you round the block to make sure you aren't stuck at a left turn you can't make
But if you tell the directions service that you are travelling at 4 PM on a saturday, we know you can turn left.
Path From Route
OK, this could be hard to explain, so bear with me. If you have a bunch of points or places, and you have a route you are going to be traveling, this function takes them both, and will tell you how far away from your route each point is, and how long it will take to drive to each point from the nearest point on your route where you could actually leave it AND tells you the Lat/Lng of where you would leave your route to go to each place.
Again, lets see if an example would help.
1. Lets assume we are driving from Lancaster, PA to Hershey, PA. We have a bunch of Gas Stations (note: these are not real, but randomly generated for the example), and we want to know which ones are accessible within five driving minutes from our route
2. So we tell the
PathFromRoutefunction to compare these gas stations to our route. We also tell it that we are only interested in gas stations that we can get to in 5 minutes (we could also have said 5 miles, for a different result). the service will provide the necessary information to filter the gas stations.
3. If we examine three of the points returned within 5 minutes of our route, we can see that for each point we receive the driving distance and time, as well as the latitude & longitude of where to leave our original route to detour to the gas station. Using that Lat/Lng as a starting point, we can then generate the detour directions to the gas station.
Still with me? Great!. Further details on the
PathFromRoute function, as well as an interactive sample, can be found here.