openlayers5 由buffer计算缓冲区引出的绘制问题
目前项目正在使用openlayerrs5进行缓冲区分析,就测距长度与缓冲区半径长度一直不相等问题一直不知道从何着手去解决:
出现问题示意:

而后查找资料发现此贴 openlayers5实战--踩坑总结
原因是在平面坐标系3857 下 使用 new Circle(center,radiu) 绘制的圆会比实际测量小一圈,
发现问题可以修改为绘制顶点圆形时,无法根据设置的radius无法正确进行绘制:
故而修改代码:
let circle4326 = circularPolygon(resArr[0],500,64);
let circle3857 = circle4326.clone().transform('EPSG:4326', 'EPSG:3857');
let circleFeature = new Feature(circle3857);
let sourcec = new VectorSource()
sourcec.addFeature(circleFeature);
let testc = new VectorLayer({
source: sourcec,
style: new Style({
fill:new Fill({
color:'pink'
}),
stroke:new Stroke({
color:'red',
width:3
})
})
});
map.addLayer(testc);
修改完成后,进行原图对比 以另一个顶点为例:

因此可将规则图形进行此方法按实际距离计算缓冲区,不规则图形仍需要想想其他办法

浙公网安备 33010602011771号