google-mapsgoogle-maps-api-3distance-matrix

Google Map distance-matrix api Serverside multiple address by latlong


In https://www.npmjs.com/package/google-distance-matrix example we can add multiple destincation as latlong pair,

The server side code is like

string Test = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=Lat1,long1&destinations=Lat2,long2&sensor=false"

Now the question is how to use it in multiple origin destination mode Can we something like

string Test = "http://maps.googleapis.com/maps/api/distancematrix/json?origins=Lat1,long1,lat2,long2&destinations=Lat3,long3,Lat4,long4&sensor=false"

Example

http://maps.googleapis.com/maps/api/distancematrix/json?origins=23.020284,72.4396566&destinations=22.3039702,70.7671403&sensor=false http://maps.googleapis.com/maps/api/distancematrix/json?origins=23.027100,72.508000&destinations=22.999500,72.600300&sensor=false

Combo of this two

http://maps.googleapis.com/maps/api/distancematrix/json?origins=23.020284,72.4396566,23.027100,72.508000&destinations=22.3039702,70.7671403,22.999500,72.600300&sensor=false


Solution

  • I solved it by using "|" delimiter. Thank you every one