TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
Distance Finder Using Google's Distance Matrix API
I would like to be able to integrate a "driving" distance finder as we invoice our clients based on distances and certain radius's from our warehouses. I typically use google maps to look for these distances, however it would be more helpful been able to integrate this with the information/data we already store on Teamdesk.

I am solely interested in the driving distance and not the map or the directions. I have added the link below to the documentation found on google's developer site.


Dale Oliver
Date Created
4/25/2012 3:44:21 AM
Date Updated
2/28/2013 8:22:38 AM
New Idea
Promoted By
Gii SystemsMartin Odendaalbasenine
Wade CardinalScott MillerDale Oliver
Scott Miller 4/25/2012 3:52:05 AM
I too am looking for this exact functionality but in relation to employee expenses and claiming for mileage. On this topic I understand this is slightly specialised but could this type of enhancement be treated as an 'add on' and sold by the developer community that now exists?
Wade Cardinal 4/25/2012 4:39:31 AM
Scott and Dale - I might be able to put something together. How do you both store location data? U.S. addresses?
Dale Oliver 4/25/2012 5:06:12 AM
Hi Nathan, I am based in South Africa and I have loaded street/postal codes of different cities/suburbs onto Team Desk. I was thinking of calculating distances from an originating suburb street/postal code to a destination suburb street/postal code.
Wade Cardinal 4/25/2012 5:54:03 AM
Thanks Dale. I will look at it. I have something basic working already.
Scott Miller 4/25/2012 6:20:01 AM
Hi Nathan it would be a manual entry at present (from) and (to) although this may change as if it is an existing Customer the Post Code is held within Teamdesk. We are based in the UK. Ideally it would use the Google functionality of suggested routes (where it provides different a number of mileage options using different routes) although that would be a 'nice to have'.

Wade Cardinal 4/25/2012 8:45:08 AM
OK, thanks Scott. I'll look at the suggested routes function. That does seem like a nice feature.

I see the Google API has restrictive terms of use. It's prohibited for any use not related to a Google map. MapQuest has APIs with favourable, open access terms of use. They do have a web service that provides driving distance. Would MapQuest instead of Google be acceptable for both of you?
Dale Oliver 4/25/2012 9:04:25 AM
Hi Nathan, Thanks a million for your help/interest in this idea! It does not seem to work as well as Google Maps. I am battling to get a route/distance between a suburb in Johannesburg and Cape Town, South Africa using MapQuest. Let me browse around, perhaps there are other sites with driving distances.
Dale Oliver 4/25/2012 9:07:49 AM
Dale Oliver 4/25/2012 9:15:52 AM
Perhaps if the map associated with the integration appeared in the form of a pop-up window (could this not be a work-around on their T & C's)
Scott Miller 4/25/2012 9:17:50 AM
Hi Nathan, on initial inspection it appears to offer similar functionality to Google Maps at a high level and includes alternative routes as per Google. Appears to work with UK Post Codes and locations.
Wade Cardinal 4/26/2012 11:29:43 PM
Hi guys - Please check out this demo I put together. It's a very early-stage prototype; I have more to do to make it generally useful. But it's functional and it proves the concept. Please do create records and test it.

Please also bear with me while I get my head around the terms of service of the various mapping services. I don't want to offer you guys something that violates any terms of service.

Dale - I wonder if Yahoo Maps or Bing Maps would work for your location?

I think I might end up writing it to support a few different mapping services, so you can select whichever service has the best data for your location.
basenine 5/2/2012 5:53:23 PM
Hi Nathan,

I checked out the Driving Distance Calculator that you've written - looks great.

Works well
basenine 5/2/2012 5:55:32 PM
I wonder if you could use GPS coordinates from an iPhone to do the calculation...
Press 'Start' - pre populates the appropriate fields
Press 'End' - pre populates the appropriate fields
Calculation made
Wade Cardinal 5/3/2012 3:00:43 AM
Thanks, Brett. Interesting idea about the iPhone - it sounds possible.
Gii Systems 5/14/2012 6:35:32 AM
Hi Nathan - I am also in South Africa and could use this in some of my apps. Keep us posted on your progress.
Wade Cardinal 5/14/2012 7:10:01 AM
Thanks Jacques. I'll keep you posted!
basenine 6/18/2012 8:56:20 PM
Hello Nathan,

Have you completed your distance calculator?

I recreated a quite simple formula using Google Maps that opens the directions directly in Google Apps.
Wade Cardinal 6/18/2012 9:29:12 PM
Hi Brett,

Thanks for the ping. The licensing issues are pretty complex. Even the people who run the services don't have answers to all the questions. There are ongoing debates about how courts are likely to interpret the licenses. I'm talking to the communities around the various mapping services to figure out where something like this fits in.

There are pretty stringent restrictions on all of the free services. With virtually all of them, you're not legally permitted to use the service in a password-protected application, or for internal business use. Only on "public-facing" websites and services. It seems with most (possibly all), you're also not permitted to pull data from the mapping service and store it into a database.

There are also attribution requirements - when you use a mapping service in your app, you're legally required to display a visible message expressing where the map or map data is from. (ie, Copyright X mapping service). So I need to build that into my code.

I had no idea this was a such a complex situation! The technical side of things is coming together. I'm working on finding the sweet spot that will make it work legally. I will eventually have something to offer, but it may be a while before I've worked out all those issues.
basenine 6/18/2012 10:19:53 PM
Thanks Nathan,

The formula I created simply opens up Google Maps and pre-populates the Start and Destination fields. Opening up in this format limits the TD user to capture the Distance in their record automatically, but it does mean they can view the map free of charge and licensing fees. They can then "Edit" their record (if required) to enter the distance in - a bit of double handling but it solves the licencing issue.

Wade Cardinal 6/18/2012 10:22:56 PM
Good deal!
martin oliver 9/21/2012 2:06:01 AM
Has there been any further development? We would be looking for driving distance only (Km) hopefully by using street codes in South Africa

basenine 9/21/2012 3:18:07 AM

I'm thinking the new workflow rule:Call URL will help with this idea.

Have a look into free map API's and you may find something useful there
Slava Shinderov  Staff  2/28/2013 8:22:38 AM
We've extended "Example: Geolocation" sample application:
with some Call URL to the MapQuest Open Platform Web Services:
Please review "Routes" table.
I guess it will give you some thoughts on how you can calculate distance between two locations.
Back to Search Results