[Google Distance Matrix API] Find the nearest local office

Forge Component
Published on 2018-11-02 by Hanno
4 votes
Published on 2018-11-02 by Hanno

We are writing an app that will link a potential customer to an office nearest to their location.  The company has several hundreds of locations, perhaps thousands.  Can this app determine their location and find the nearest office to their location?  Thanks.

Hi Brian,

What you will need to do is to build the logic of iterating through these offices yourself. Maybe use a radius function to narrow down the top 10 nearest offices first and then loop through the top 10 calling the distance api to see which one is nearest.

*Key note: Do you want to determine nearest office as line of sight or driving distance? If driving distance then use this app otherwise just filter on the co-ordinates with a radius function and order them in distance.

To link  a customer to an office nearest to them will work great with this app. 

You will not be using the traffic information though.