我是programmaticaly尝试动态设置我想要搜索的地方的类型,我有一个数组selectedPlaceTypes填写如下:[“aquarium”,“art_gallery”,“bar”]。只考虑数组中的一种类型。
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);
答案 0 :(得分:1)
在文档中,它说: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).
因此请使用var types="aquarium|art_gallery|bar"
。
或许问题只是art_gallery
和bar