欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

询问谷歌地图 api v3 是否仅适用于选定城市的自动完成功能。

最编程 2024-06-19 15:26:50
...
代码语言:javascript
复制
var southWest = new google.maps.LatLng( 28.3914,-81.936035 );
    var northEast = new google.maps.LatLng( 28.3914,-81.936035 );
    var hyderabadBounds = new google.maps.LatLngBounds( southWest, northEast );

    var options = {
        bounds: hyderabadBounds,
        types:  ['geocode'],
        componentRestrictions: { country: 'us' }
    };

    var input1 = document.getElementById('search_header');
    var autocomplete = new google.maps.places.Autocomplete(input1,options);