-1

I'm creating a website and on this website I need to add a map and the user can type any address and it will return the closest place out of a list of places. I have the API imported to my code, but I'm not a very skilled JavaScript programmer so I have no idea how to create this funcionallity. From what I've searched, it has to loop through an array of places to find the closest one.

Does anyone have any clue? Thank you in advance.

melpomene
  • 84,125
  • 8
  • 85
  • 148
  • 1
    possible duplicate of [Google Maps Api v3 - find nearest markers](http://stackoverflow.com/questions/4057665/google-maps-api-v3-find-nearest-markers) – taesu Sep 10 '15 at 19:17
  • possible duplicate of [Google Maps API - Closest marker function change to closest n markers](http://stackoverflow.com/questions/27905570/google-maps-api-closest-marker-function-change-to-closest-n-markers/27909798#27909798) – geocodezip Sep 10 '15 at 19:35

1 Answers1

0

You would want to use Places API and do Radar Search Request

A Radar Search lets you search for places within a specified search radius by keyword, type or name

service = new google.maps.places.PlacesService(map);
service.radarSearch(request, callback);
Verma
  • 8,199
  • 2
  • 15
  • 17