Question

i'm programmaticaly trying to set dynamicaly the types of the places i want to search , i have an array selectedPlaceTypes filled as follows : ["aquarium", " art_gallery", " bar"] . only one type in the array is taken into account .

 var request = {
            location: pos,
            radius: 5000,
            types: selectedPlaceTypes
          };
          infowindow = new google.maps.InfoWindow();
          var service = new google.maps.places.PlacesService(map);
          service.nearbySearch(request, callback);
Was it helpful?

Solution

In documentation, it says: types — Restricts the results to Places matching at least one of the specified types. Types should be separated with a pipe symbol (type1|type2|etc). So use var types="aquarium|art_gallery|bar" .

Or maybe the problem is just the spaces you have in art_gallery and bar

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top