Google Maps API" Listings By"

时间:2016-04-27 19:06:18

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

我使用谷歌地方API并且它工作正常,除了它一直显示某些"列表"文本。我的地图只有500x400,因此它会显示在屏幕中央,看起来非常糟糕。

我猜它只是一些广告,必须显示(according to docs)。但无论如何要改变它的立场?

相关herehere

注意我已经使用了一个PlacesService对象,所以它不是一个太多的问题。它只有一条线在地图上大约300px。

链接到屏幕截图http://i.imgur.com/I1Eh5KM.png

createAmenitiesMarkers(type) {
    var _this = this;

    this.placesService = this.placesService || new google.maps.places.PlacesService(this.map);

    this.placesService.nearbySearch({
        location: new google.maps.LatLng(
            this.address.location.coordinates[1],
            this.address.location.coordinates[0]
        ),
        radius: 1000,
        type: [type]
    }, function(results, status) {
        var i, ii;

        if (status == google.maps.places.PlacesServiceStatus.OK) {
            for (i = 0, ii = results.length; i < ii; i++) {
                _this.amenitiesMarkers.push(new google.maps.Marker({
                    map: _this.map,
                    position: results[i].geometry.location,
                    title: results[i].name,
                    icon: {
                        url: 'http://mt.google.com/vt/icon/name=icons/spotlight/' + type + '_search_L_8x.png&scale=1'
                    }
                }));
            }
        }
    });
},

1 个答案:

答案 0 :(得分:0)

我不知道使用API​​控制此位置的任何方法,但您可以控制其他UI元素的定位。如果在您的示例中设置了:

zoomControlOptions: {
   position: google.maps.ControlPosition.LEFT_BOTTOM
},
streetViewControlOptions: {
   position: google.maps.ControlPosition.LEFT_BOTTOM
},

初始化地图时,&#34;列出来&#34;通知将显示在Google版权声明的上方,该通知看起来为way better