Google Places API - 有时它不会返回结果,有时会返回结果

时间:2013-02-24 01:08:46

标签: google-maps google-maps-api-3 google-places-api

我正在开发一个功能,在我使用谷歌地方API.Code工作正常,有时我得到结果,有时我没有。不确定为什么这发生。我需要一些澄清的几个查询是,

  1. 我有一个下拉,我将距离设为1英里和3英里,然后触发google places api。我正在将类型作为bank.Now当我在1英里范围内搜索时,我得到10个结果,当我用3英里半径的相同类型搜索时,我得到5个结果。实际上我觉得我应该在3英里搜索中总共得到15个结果。但这不会发生吗?我想念一下这里的东西吗?

  2. 我正在客户端进行地理编码,你建议用什么选项来缓存lat和lng。我在谷歌地图Api中读到,我们可以缓存地理编码结果,有人可以告诉我我们可以多久拿着吧 ?我们可以添加ajax调用并将此信息保存在数据库中,或者我需要进行本地存储。我的网站将面向公众,虽然我不希望我每天会有超过几百次点击,但我仍然我需要一些方法做好准备,以备不时之需。

  3. $(“#id-btn”)。click(function(event){

     var type = $('#type').val();
     console.log(type)
     var radius = $('#radius').val();
     console.log(radius)
     console.log(latlng)
    
     var request = {
            location:latlng,
            radius: radius,
            types: [type]
        };
        console.log(request)
          service = new google.maps.places.PlacesService(map);
         console.log(service)
                          service.nearbySearch(request,createMarkers);
                        //service.textSearch(request,createMarkers);                        
                    });
    

0 个答案:

没有答案