Google places api returns duplicate places

As an interim solution, could you build an array of found places in your Callback each time and then within the same loop, see if the place has a count of >1, then don't call createMarker if so?

Not sure if perfect, but see below:

var foundPlaces = [];
var found;

function callback(results, status) { 
  if (status === google.maps.places.PlacesServiceStatus.OK) {
    for (var i = 0; i < results.length; i++) {
      found = 0;
      foundPlaces.push(results[i].id);
      for (var j = 0; j < foundPlaces.length; j++) {
        if (foundPlaces[j] === results[i].id) {
          found++;
          console.log(foundPlaces[j], results[i].id);
        }
      }

      if (found < 2) {
        createMarker(results[i]);
      }
    }
  }
}

http://jsfiddle.net/2KrmY/15/


The bounds parameter is described as below:

The bounds within which to search for Places. Both location and radius will be ignored if bounds is set.

But for the second bounds in your code example, 2 results outside the bounds get into the result.

You could display the bounds area by using:

new google.maps.Rectangle({
    strokeColor: 'red',
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: 'bulue',
    fillOpacity: 0.6,
    map: map,
    bounds: bounds
});

And then you can see the result.

Check The demo.

This may be a bug of the google map api.