let layer = new VectorLayer(); //新建一个绘线层 let pointFeature = new Feature(new Point(fromLonLat([114.02, 24]))); pointFeature.setStyle( new Style({ //规则形状 image: new RegularShape({ fill: new Fill({ color: "#00FF00" }), stroke: new Stroke({ color: "blue", width: 2 }), points: 5, //角数量 radius1: 20, //第一类角的半径 radius2: 10, //第二类角的半径 }), }) ); layer.setSource( new VectorSource({ features: [pointFeature], }) ); map.addLayer(layer); //把线的图层添加到地图中
效果:
标签:layer,let,color,OpenLayers,new,pointFeature,绘制,标注 From: https://www.cnblogs.com/mesmerize/p/16768531.html