百度地图

//去除底图中的图标,防止干扰

    var styleJson =[
          {
                "featureType": "poilabel",
                "elementType": "labels.icon",
                "stylers": {
                          "visibility": "off"
                }
          },
          {
                "featureType": "subway",
                "elementType": "labels.icon",
                "stylers": {
                          "visibility": "off"
                }
          }
        ];
    map.setMapStyle({styleJson:styleJson});

效果:


image.png

添加自定义标注

var label =new BMap.Label(name,{offset:new BMap.Size(38,5)});
        if(tbdz==""){
            tbdz="icon_c1.png";
        }
        var myIcon = new BMap.Icon("${base}/include/css/mapstyle/img/"+tbdz, new BMap.Size(36,36));
        var marker = new BMap.Marker(point,{icon:myIcon});
            //marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
        label.setStyle({
            color : color,
            fontSize : "12px",
            height : "20px",
            //lineHeight : "20px",
            fontFamily:"微软雅黑",
            backgroundColor:"rgba(255,255,255,0)",
            border:"none"
        });
        label.setTitle(nameAll); //为label添加鼠标提示    
        map.addOverlay(marker);
        marker.setLabel(label);

        marker.addEventListener("touchstart", function () {
            map.disableDragging();  //禁用地图拖拽功能
        });
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容