Measure distance from multiple points using Google

-1

I'm working on an app where the user can see the establishments closest to him.

In the bank I keep latitude and longitude, and in mobile I retrieve the user's position. I made a LIMIT in SQL to bring paged this data by ordering by the shortest distance. For this I made use of an algorithm to calculate these points.

But the customer informed me that the distance entered in the app and the distance in google maps are not accurate. Looking at it, I've verified that Google computes the route-based calculation.

How could I cross-reference this data using some google api by keeping my sort order in SQL?

I've already thought about putting a column in the database and going updating, but it's a lot of data for me to keep calling a webservice. Someone knows some solution to solve this "problem".

    
asked by anonymous 22.01.2018 / 13:41

1 answer

0

I've been working on this kind of calculation for some time, but when I did, I used Google Distance Matrix .

It is possible for you to define some metrics to do this calculation, such as mode of transport (car, walking, subway, etc.) or route restrictions (avoiding avenues, etc.).

What I liked a lot when I used it was the option to use both coordinates (Lat, Lng) and addresses (as long as they are valid). As I have not used in a while, I do not know if it has changed, but it was possible to define only one source and some destinations, so it is only you to reconcile the two data (distance and your order) to display the best results.

  

Note: I needed to enable access to this API within the Google Developers Console.

    
22.01.2018 / 13:49