Reputation: 3745
I want to filter away establishments
in my autocomplete service.
I have tried
var service = new google.maps.places.AutocompleteService;
var request = {
"input": "Nørregade",
"componentRestrictions": { "country": "dk" },
"types": ["(cities)", "(regions)", "geocode"]
};
service.getPlacePredictions(request, function(predictions, status) {
console.log(status) # => INVALID_REQUEST
});
(http://jsfiddle.net/gdk0j9eg/1/)
Following this link (https://developers.google.com/maps/documentation/javascript/reference#AutocompletionRequest) it seems that the autocomplete service does indeed take these types.
What am I doing wrong here?
Upvotes: 0
Views: 1074
Reputation: 161384
See the documentation, you are only allowed to use a single type or type collection:
You may restrict results from a Place Autocomplete request to be of a certain type by passing a types parameter. The parameter specifies a type or a type collection, as listed in the supported types below. If nothing is specified, all types are returned. In general only a single type is allowed. The exception is that you can safely mix the geocode and establishment types, but note that this will have the same effect as specifying no types.
Upvotes: 1