TransWikia.com

Are there spreadsheet functions to query route planner for travel time and distance?

Geographic Information Systems Asked on February 28, 2021

I would like to realise a spreadsheet where the columns are as follows.

Place A Place B Distance by road between A and B Travel time by road between A and B

I thought this might be possible using the ‘Google’ functions of Google Docs’ spreadsheet, but I’ve found none that does the trick.

In the end, I could knock up an app to do this using the Google Maps API, but I would rather avoid it if I can.

One Answer

MapQuest seems to be the best bet, as they have a URL-based API for directions, whereas Google Maps seems to be a JavaScript library.

This worked for me in a Google Docs Spreadsheet. This one gets the distance (miles):

=importXML("http://mapquestapi.com/directions/v1/route?key=YOUR_KEY_HERE&outFormat=xml&from=" & A2 & "&to=" & B2,"//response/route/distance")

And this one gets the time (formatted in hh:mm:ss):

=importXML("http://mapquestapi.com/directions/v1/route?key=YOUR_KEY_HERE&outFormat=xml&from=" & A2 & "&to=" & B2,"//response/route/formattedTime")

where A2 is the origin and B2 is the destination.

You have to get an API key from MapQuest and replace the value YOUR_KEY_HERE with it.

Answered by Neil McGuigan on February 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP