gmaps.js, find the nearest point
I have a array of point with latitude and longitude. Next, I add all points to my map. I need solution/algorithm to move user to the nearest point from my array using geoloation on page load. (if geolocation success of course) This should do the trick. I combined both HTML5 geolocation to find the user's current location and Haversine function to calculate distances from a set of locations and the user's current location. The set of locations is defined in the JS array 'locations'. <!DOCTYPE html> <html> <head> <title>Google Map Template with Marker at User's Position</title> <script src=