Get driving distance between two points using Google Maps API

后端 未结 5 2173
Happy的楠姐
Happy的楠姐 2020-12-12 18:53

I\'m trying to get driving distance between two points using Google Maps API. Now, I have code which get direct distance:

This function get lat and

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-12 19:26

    You can try using Google Distance Matrix API. Here is a sample HTML, PHP code in bellow. Here you must change the 'YOUR_API_KEY' with your app key.

    
    
        
            






    rows[0]->elements[0]->distance->value / 1000).' Km'; ?>

    rows[0]->elements[0]->duration->text; ?>

提交回复
热议问题