I am trying to calculate the driving distance from one origin point and then to many different destinations points (I need to find the closest driver). I use PHP and I basically run this function many times:
file_get_contents('https://maps.googleapis.com/maps/api/distancematrix/json?origins=' . $latitude . ',' . $longitude . '&destinations=' . $latitude1 . ',' . $longitude1 . '&mode=car&language=da-DK&key=My_API&alternatives=false&sensor=false');
I need the distance from latitude, longitude and in some cases 40+ different potential destinations. My problem is, that it takes forever to calculate the many points one call at the time. It takes 51-56 sec to find the distance from the one origin point to 37 different potential destination points.
Is there a faster way? or service ?
I wish you all a great day.
best regards