I had to repair an old project regarding google maps so this is in V2. In my database, I already had the latlng of all the user in my database. Then there are certain events that the system can create (e.g. a fire event). Now, the system should be able to compute the distance of all the users from the fire event and list down all the people based on their distance from the area. How can I do that? fromAddress should be an array of the people's latlng and toaddress is the latlng of the event. The logic must be similar to the code below
for(i=0;i<fromAddress.length;i++){
gdir.load("from: " + fromAddress[i] + " to: " + toAddress, { "locale": "en" });
distance = Math.round((gdir.getDistance().meters / 1000)*10)/10;
duration = Math.round(gdir.getDuration().seconds/60);
//store distance and duration for output
}
Thanks!
There are different options: