Denys Konoplin
Denys Konoplin

Reputation: 362

Google Places API: Why i got different places list based on search radius?

I faced with the next problem: when I try to get the list of hospitals (with the GooglePlaces API) I got different results, i.e. when the radius of search is small - 1500 meters - i got 3 hospitals in results, but when I increase the radius of search - 10000 meters - i got the bigger list of hospitals, but in this list previous three hospitals are not present.. It's really strange, because the bigger radius of search should include all hospitals (and the results of smaller radius should be included to list). Maybe there is some limit of results length?

var pyrmont = new google.maps.LatLng(50.061829599999996, 36.1911966);

  map = new google.maps.Map(document.getElementById('map-canvas'), {
    center: pyrmont,
    zoom: 13
  });

  var request = {
    location: pyrmont,
    radius: 1500,
    types: ['hospital', 'doctor']
  };

  infowindow = new google.maps.InfoWindow();
  var service = new google.maps.places.PlacesService(map);
  service.nearbySearch(request, callback);

Thanks

Upvotes: 2

Views: 223

Answers (1)

plexer
plexer

Reputation: 4622

The Places API will return the most relevant search results, taking into account the specified radius. Since ranking by distance is only one, of many, factors that influence which places are returned, you should not expect searches with larger radius' to be a superset of searches with smaller radius'.

Upvotes: 1

Related Questions