如何创建Google地图链接以嵌入带有地标和描述的HTML网页,如下图所示?
答案 0 :(得分:0)
例如:
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var InfoWindow = new google.maps.InfoWindow({
map: map,
position: myLocation,
content:
'<h1>Location pinned from HTML5 Geolocation!</h1>' +
'<h2>Latitude: ' + position.coords.latitude + '</h2>' +
'<h2>Longitude: ' + position.coords.longitude + '</h2>'
});
变量'map'是您的地图画布,带有您的选项,而不是您使用地图创建新的InfoWindow,在此示例中,postion是我当前的位置(“var myLocation = new google.maps.LatLng(position) .coords.latitude,position.coords.longitude);“)。而内容方面,您可以使用html和变量来创建视觉效果。