我已尝试使用Google Maps strictbounds参数将自动填充结果限制为特定区域 . 我目前的代码是:

var autocomplete = new google.maps.places.Autocomplete(spaceAddress,{types:['geocode'],strictbounds:{location:“ - 23.544085,-46.7125434”,radius:“12000”},语言:“pt-BR” });

虽然它不会破坏我的应用程序,但它也不会将结果限制在选定区域 . 或者,我使用下面的国家限制,但客户不喜欢它!

这是现在使用的完整代码:

document.addEventListener("DOMContentLoaded", function() {
  var spaceAddress = document.getElementById('space_address');
  if (spaceAddress) {
  var autocomplete = new google.maps.places.Autocomplete(spaceAddress, { types: [ 'geocode' ], strictbounds: {location: "-23.544085,-46.7125434", radius: "12000"}, language: "pt-BR" });
  google.maps.event.addDomListener(spaceAddress, 'keydown', function(e) {
    if (e.key === "Enter") {
      e.preventDefault();
      const spaceAddress = document.getElementById('space_address').value;
      if (spaceAddress != '' && spaceAddress != null) {
      codeAddress(spaceAddress);
      }
    }
    });
  }

有人可以赐教吗?!