【问题标题】:filter google api to search geocode of a particular city过滤 google api 以搜索特定城市的地理编码
【发布时间】:2012-07-04 20:48:11
【问题描述】:

是否可以过滤自动填充位置 (api v3) 以搜索仅具有特定邮政编码或城市的街道?

现在我的配置如下

    var options = {
      componentRestrictions: {country: "it"},
      types: ['geocode']
    };

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

现在它仅按国家“it”过滤,我会搜索所有街道,battipaglia (CITY) OR 84091 (ZIP CODE)

提前致谢

【问题讨论】:

    标签: php jquery ajax google-maps-api-3


    【解决方案1】:

    您可以使用边界,但您必须能够指定纬度和经度

    bounds 是一个 google.maps.LatLngBounds 对象,用于指定区域 搜索地点。结果偏向,但不偏向 仅限于,包含在这些范围内的地方。

    【讨论】:

    • 感谢您的回复!可以将一些字符串添加到 var input = document.getElementById('searchTextField');处理前?
    • 当然,+ sting 或 var 通常的 js 方式
    猜你喜欢
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-29
    • 1970-01-01
    • 2013-09-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多