【问题标题】:Searching by State in Google Maps在 Google 地图中按州搜索
【发布时间】:2013-11-29 14:21:56
【问题描述】:

我正在尝试搜索一个州的所有地方,我认为下面的网址可能有效,但遗憾的是没有,这甚至可能吗? https://maps.googleapis.com/maps/api/place/textsearch/json?query=kansas,usa&sensor=false&key=[在此处插入密钥]

【问题讨论】:

  • 你用真钥匙试过了吗?你有什么错误吗?
  • 你不能返回一个状态的所有个地方。 places API textsearch 最多返回 60 个结果,每组 20 个。places API radarsearch 最多返回 200 个结果(但不包含所有详细信息)。
  • 是的,我用真正的钥匙试过了!它需要使用文本搜索,因为这是唯一提供按名称搜索能力的api,雷达和附近搜索需要长/纬度

标签: google-maps


【解决方案1】:

请参考以下链接。

http://jsfiddle.net/nB2ej/

geocoder.geocode({ 'address': addresscity }, function (results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    latitude = results[0].geometry.location.lat();
                    longitude = results[0].geometry.location.lng();
                    document.getElementById("lat").value=   latitude;
                   document.getElementById("lon").value=   longitude; 
                 var myLatlng = new google.maps.LatLng(latitude, longitude);
                    var mapOptions = {
                 center: new google.maps.LatLng(latitude, longitude),
                  zoom: 8,
                 mapTypeId: google.maps.MapTypeId.ROADMAP

             };
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多