var map = new BMap.Map("mapcontainer"); map.enableScrollWheelZoom();// 启用滚轮缩放 map.enableDragging(); // 启用拖拽功能 // 创建点坐标 var points = [ new BMap.Point(106.644876, 29.494949), new BMap.Point(106.635821, 29.481304), new BMap.Point(106.638048, 29.480675), new BMap.Point(106.645379, 29.481744), new BMap.Point(106.648397, 29.479921), new BMap.Point(106.65429, 29.480675), new BMap.Point(106.66392, 29.481367), new BMap.Point(106.663057, 29.486209), new BMap.Point(106.662985, 29.486901), new BMap.Point(106.666076, 29.48885), new BMap.Point(106.666507, 29.490233), new BMap.Point(106.665573, 29.493817), new BMap.Point(106.66162, 29.49564), new BMap.Point(106.661692, 29.493503), new BMap.Point(106.659105, 29.49344), new BMap.Point(106.658171, 29.491868), new BMap.Point(106.654721, 29.492874), new BMap.Point(106.65314, 29.494383), new BMap.Point(106.651415, 29.496143), new BMap.Point(106.649475, 29.493251), ]; // 创建多边形 var polygon = new BMap.Polygon(points, { strokeColor: "blue", strokeWeight: 2, strokeOpacity: 0.5, fillColor: "blue", fillOpacity: 0.15 }); // 将多边形添加到地图中 // map.addOverlay(polygon); // 设定中心点和地图级别 map.centerAndZoom(new BMap.Point(106.651444, 29.48682), 15); map.setMapType(BMAP_NORMAL_MAP);