首页 文章

通过Google Maps API V3生成的 Map 在Google首页中显示Google Place Page数据

提问于
浏览
0

我有一张 Map 可以很好地使用我想要的标记,并且能够通过自定义内容显示信息窗口 .

我在_stat.google.com上找到了什么 . Example here .

我使用Maps API而不是嵌入的唯一原因是我们需要将 Map 控件移出左上角 . 如果有办法嵌入 Map 并移动控件那将是很棒的!否则我需要能够将Place内容拉入我正在生成的infowindow中 . 我的代码如下 .

var latlng = new google.maps.LatLng(43.6985770, -73.7154730);
var mapOptions = {
        zoom: 17,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        mapTypeControl: false,
        zoomControl: true,
        zoomControlOptions: {
            style: google.maps.ZoomControlStyle.DEFAULT,
            position: google.maps.ControlPosition.RIGHT_TOP
        },
        streetViewControl: false,
        panControl: false,
        scaleControl: false
    };

var map = new google.maps.Map(document.getElementById("map_canvas"),
    mapOptions);

var contentString = '<h1>Title</h1> <p>Content</p>';

var infowindow = new google.maps.InfoWindow({
    content: contentString,
    maxWidth: 260
});

var marker = new google.maps.Marker({
    position: latlng,
    map: map,
    title:"Directions!"
});

infowindow.open(map,marker);

谢谢!

1 回答

相关问题