避免在 google 地图 geocomplete 中列出本地企业?
Avoid local business listing in google map geocomplete?
我正在为我的地图使用 google 地图 api v3。我需要避免从结果列表中获得业务结果。
附上截图以供参考。
图片还显示了所有与业务相关的结果。我需要将结果过滤为地点。可能吗?
根据documentation可以过滤结果:
An options argument, which can contain the following properties:
An array of types specifies an explicit 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. The supported types are:
geocode instructs the Places service to return only geocoding results, rather than business results.
address instructs the Places service to return only geocoding results with a precise address.
establishment instructs the Places service to return only business results.
the (regions) type collection instructs the Places service to return any result matching the following types:
- locality
- sublocality
- postal_code
- country
- administrative_area1
- administrative_area2
the (cities) type collection instructs the Places service to return results that match either locality or administrative_area3.
示例:
var input = document.getElementById('searchTextField');
var options = {
types: ['(cities)']
};
autocomplete = new google.maps.places.Autocomplete(input, options);
我正在为我的地图使用 google 地图 api v3。我需要避免从结果列表中获得业务结果。
附上截图以供参考。
图片还显示了所有与业务相关的结果。我需要将结果过滤为地点。可能吗?
根据documentation可以过滤结果:
An options argument, which can contain the following properties:
An array of types specifies an explicit 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. The supported types are:
geocode instructs the Places service to return only geocoding results, rather than business results.
address instructs the Places service to return only geocoding results with a precise address.
establishment instructs the Places service to return only business results.
the (regions) type collection instructs the Places service to return any result matching the following types:
- locality
- sublocality
- postal_code
- country
- administrative_area1
- administrative_area2
the (cities) type collection instructs the Places service to return results that match either locality or administrative_area3.
示例:
var input = document.getElementById('searchTextField');
var options = {
types: ['(cities)']
};
autocomplete = new google.maps.places.Autocomplete(input, options);