百度地图坐标显示隐藏

<div id="l-map"></div>
    <div id="r-result">
        <input type="button" onclick="showOver()" value="显示" />
        <input type="button" onclick="hideOver()" value="隐藏" />
    </div>
View Code
var map = new BMap.Map("l-map");
    var point = new BMap.Point(116.404, 39.915);
    map.centerAndZoom(point, 15);
    
    var marker = new BMap.Marker(new BMap.Point(116.404, 39.915));  // 创建标注
    map.addOverlay(marker);              // 将标注添加到地图中
    
    var polyline = new BMap.Polyline([
        new BMap.Point(116.399, 39.910),
        new BMap.Point(116.405, 39.920),
        new BMap.Point(116.425, 39.900)
    ], {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5});
    map.addOverlay(polyline);          //增加折线
    
    var circle = new BMap.Circle(point,500);
    map.addOverlay(circle);            //增加圆
    hideOver();
    
    function showOver(){
        marker.show(); polyline.show(); circle.show();
    }
    function hideOver(){
        marker.hide(); polyline.hide(); circle.hide();
    }
View Code
posted @ 2019-12-17 09:49  光影易逝  阅读(584)  评论(0编辑  收藏  举报