const angle = parseFloat("东南114°".match(/(\d+)/)[1]); // 提取数字部分 const rotation = (angle - 90) * (Math.PI / 180); // 转换为弧度并进行调整 const fanShapeStyle = new Style({ image: new RegularShape({ fill: new Fill({ color: 'rgba(255,165,0,0.5)' }), // 半透明的橙色 points: 3, radius1: 50, radius2: 0, angle: rotation }), stroke: new Stroke({ color: 'red', width: 2 }) }); const pointerStyle = new Style({ geometry: function(feature) { const coordinates = feature.getGeometry().getCoordinates(); return new LineString([coordinates, [ coordinates[0] + 50 * Math.cos(rotation), coordinates[1] + 50 * Math.sin(rotation) ]]); }, stroke: new Stroke({ color: 'red', width: 2 }) });