var myLatLng1 = new google.maps.LatLng(beach[1], beach[2]); path.push(myLatLng1); var contentString =\; if(j==0)//这里的 0 代表起点! {
map.setCenter(myLatLng1);
var marker2 = new google.maps.Marker ({
position: myLatLng1, map: map,
title:'起点:'+beach[0], });
contentString1= GetcontentString(\点信息\,\起点\); var infowindow1 = new google.maps.InfoWindow ({
content: contentString1 , maxWidth: 200, });
google.maps.event.addListener(marker2, 'click', function() { infowindow1.open(map,marker2); }); }
else if(j== arr.length-2) {
var marker3 = new google.maps.Marker ({
position: myLatLng1, map: map,
title:'终点:'+beach[0], });
contentString2= GetcontentString(\点信息\,\终点\);
var infowindow2 = new google.maps.InfoWindow ({
content: contentString2 , maxWidth: 200, });
google.maps.event.addListener(marker3, 'click', function() { infowindow2.open(map,marker3); }); } else {
var marker1 = new google.maps.Marker ({
position: myLatLng1, map: map, icon: image, title: beach[0], }); }
}
(5) 显示当前位置,代码如下: var dest='<%=Dest %>'; var d=dest.split('*');
//alert(d[0]+\经度:\纬度:\点号:\var latlng_new = new google.maps.LatLng(d[1] ,d[2]); map.setCenter(latlng_new);
var info =d[0]+\经度:\+d[1]+\纬度:\+d[2]+\点号:\+d[3]; document.getElementById('information').innerHTML = info; 截图如下所示: 图1为显示电子地图 图2 为显示南邮位置标志
图3为显示历史轨迹 图4为显示当前位置信息
图1
图2
图3
图4