【问题标题】:Google Place API Not showing Right ListingGoogle Place API 未显示正确的列表
【发布时间】:2015-09-02 16:12:02
【问题描述】:

我正在使用 Google Place API。我们在我们拥有的每个位置页面上都使用谷歌地图。我在这个位置页面遇到的问题是,它正在抓取一个对我们有用的个人谷歌地图列表,而不是整个商业列表。

这里是测试页面:http://www.bkd.com/about-us/locations/nebraska/lincoln-test.htm

这是当前显示的列表:https://www.google.com/maps?ll=40.814142,-96.702888&z=15&t=m&hl=en-US&gl=US&mapclient=embed&cid=13581319227403147888

这是我需要它显示的列表:https://www.google.com/maps/place/BKD+LLP/@40.8140716,-96.7028712,17z/data=!3m1!4b1!4m2!3m1!1s0x8796befcf76bff05:0xa6eb8785f0c0d8e4?hl=en-US

这是我页面上的代码:

<iframe
 width="360"
 height="270"
 frameborder="0" style="border:0"
 src="https://www.google.com/maps/embed/v1/place?key=AIzaSyAjae4NHf45sLSplhcsEDpFxj7P9sp8-PI
&q=BKD+LLP,lincoln+NE &zoom=15
">
</iframe>

如何让列表显示我想要的而不是个人列表?

谢谢!

【问题讨论】:

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


    【解决方案1】:

    从某种意义上说,您的问题并不清楚所需的行为是什么。但是,在查看您的请求后,可以分析出 REST API 调用与文档中的不同。在您知道要在地图上显示该地点的位置坐标后。

    试试这个使用 Places Library 的 API 请求:

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places"></script>
    

    查看这里Places Library overview

    并使用此示例代码:

    var map;
    var service;
    var infowindow;
    
    function initialize() {
      var pyrmont = new google.maps.LatLng(-33.8665433,151.1956316);
    
      map = new google.maps.Map(document.getElementById('map'), {
          center: pyrmont,
          zoom: 15
        });
    
      var request = {
        location: pyrmont,
        radius: '500',
        types: ['store']
      };
    
      service = new google.maps.places.PlacesService(map);
      service.nearbySearch(request, callback);
    }
    
    function callback(results, status) {
      if (status == google.maps.places.PlacesServiceStatus.OK) {
        for (var i = 0; i < results.length; i++) {
          var place = results[i];
          createMarker(results[i]);
        }
      }
    }
    

    【讨论】:

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