受边界限制(完全限制)的位置(城市和邮政编码)的自动完成
Autocomplete for locations (city & postcode) restricted by bounds (fully restricted)
我正在尝试为位置(城市和邮政编码)实现自动完成功能。结果必须在指定范围内(该网站具有很强的区域重点)。
我试图通过使用 Google 自动完成地点 API 来实现它,但是 componentRestrictions
参数只接受国家(在这种情况下这对德国来说太不明确了)。
这种偏见似乎运作良好,但我仍然从全国各地获得较大的城市,这与项目的区域范围背道而驰。
地理编码 API 确实提供了限制,但它 returns 大多数情况下只有一个结果(这对自动完成功能不是很有用)。
是否有可能在 Google API 秒内实现我的目标,或者是否有替代方案 API 我应该检查一下?
看来你想要严格的界限,请关注Issue 8606: places bound restrict。
现在看来 Google API 中已经实施了严格的限制。他们是我所知道的唯一在德国具有此自动完成功能的服务。这是他们对 Issue 8606 的评论文本:
Good news!
The Place Autocomplete web service and the Autocomplete class in the
JavaScript Places library now support restricting predictions to be
strictly within specific bounds:
https://developers.google.com/places/web-service/autocomplete#location_restrict
https://developers.google.com/maps/documentation/javascript/places-autocomplete#add_autocomplete
Please file new feature requests for the Android and iOS Places API
SDKs if you are interested in using this feature in the SDKs.
See also the new "Strict Bounds" checkbox in this example: Place
Autocomplete Restricted to Multiple Countries
https://google-developers.appspot.com/maps/documentation/javascript/examples/full/places-autocomplete
Note: strictBounds is currently only available in the JavaScript
Places library as an option for the Autocomplete class, but we will
be adding it to the AutocompletionRequest (for the
AutocompleteService) as well in the coming weeks.
完全披露:我在 SmartyStreets 工作,这是一家地址验证和验证公司。
我正在尝试为位置(城市和邮政编码)实现自动完成功能。结果必须在指定范围内(该网站具有很强的区域重点)。
我试图通过使用 Google 自动完成地点 API 来实现它,但是 componentRestrictions
参数只接受国家(在这种情况下这对德国来说太不明确了)。
这种偏见似乎运作良好,但我仍然从全国各地获得较大的城市,这与项目的区域范围背道而驰。
地理编码 API 确实提供了限制,但它 returns 大多数情况下只有一个结果(这对自动完成功能不是很有用)。
是否有可能在 Google API 秒内实现我的目标,或者是否有替代方案 API 我应该检查一下?
看来你想要严格的界限,请关注Issue 8606: places bound restrict。
现在看来 Google API 中已经实施了严格的限制。他们是我所知道的唯一在德国具有此自动完成功能的服务。这是他们对 Issue 8606 的评论文本:
Good news!
The Place Autocomplete web service and the Autocomplete class in the JavaScript Places library now support restricting predictions to be strictly within specific bounds:
https://developers.google.com/places/web-service/autocomplete#location_restrict https://developers.google.com/maps/documentation/javascript/places-autocomplete#add_autocomplete
Please file new feature requests for the Android and iOS Places API SDKs if you are interested in using this feature in the SDKs.
See also the new "Strict Bounds" checkbox in this example: Place Autocomplete Restricted to Multiple Countries https://google-developers.appspot.com/maps/documentation/javascript/examples/full/places-autocomplete
Note: strictBounds is currently only available in the JavaScript Places library as an option for the Autocomplete class, but we will be adding it to the AutocompletionRequest (for the AutocompleteService) as well in the coming weeks.
完全披露:我在 SmartyStreets 工作,这是一家地址验证和验证公司。