map.removeOverlay(overlays[i]);
}
overlays.length=0
}
//添加覆盖物删除覆盖物
varmarker=newBMap.Marker(newBMap.Point(116.404,39.915));//创建点
varpolyline=newBMap.Polyline([
newBMap.Point(116.399,39.910),
newBMap.Point(116.405,39.920),
newBMap.Point(116.425,39.900)
],{strokeColor:
"blue",strokeWeight:
2,strokeOpacity:
0.5});//创建折线
varcircle=newBMap.Circle(point,500,{strokeColor:
"blue",strokeWeight:
2,strokeOpacity:
0.5});//创建圆
varpolygon=newBMap.Polygon([
newBMap.Point(116.387112,39.920977),
newBMap.Point(116.385243,39.913063),
newBMap.Point(116.394226,39.917988),
newBMap.Point(116.401772,39.921364),
newBMap.Point(116.41248,39.927893)
],{strokeColor:
"blue",strokeWeight:
2,strokeOpacity:
0.5});//创建多边形
varpStart=newBMap.Point(116.392214,39.918985);
varpEnd=newBMap.Point(116.41478,39.911901);
varrectangle=newBMap.Polygon([
newBMap.Point(pStart.lng,pStart.lat),
newBMap.Point(pEnd.lng,pStart.lat),
newBMap.Point(pEnd.lng,pEnd.lat),
newBMap.Point(pStart.lng,pEnd.lat)
],{strokeColor:
"blue",strokeWeight:
2,strokeOpacity:
0.5});//创建矩形
varinfoWindow1=newBMap.InfoWindow("天安门坐落在中国北京市中心,故宫的南侧,与天安门广场隔长安街相望,是清朝皇城的大门");//创建信息窗口对象
marker.addEventListener("click",function(){
this.openInfoWindow(infoWindow1);//开启信息窗口
});
//添加覆盖物
functionadd_overlay()
{
map.addOverlay(marker);//增加点
map.addOverlay(polyline);//增加折线
map.addOverlay(circle);//增加圆
map.addOverlay(polygon);//增加多边形
map.addOverlay(rectangle);//增加矩形
}
//清除覆盖物
functionremove_overlay(){
map.clearOverlays();
}
//地址解析
functiondizhijiexi()
{
vardizhi=document.getElementById("dizhi").value;
展开阅读全文
相关搜索
资源标签