openlayer 4.4 getArea()给出了错误的结果

getarea()的面积为206.85693359375平方米,一侧为10米。此几何的坐标为:

A: (10) […]
​​0: 349342.54170016386
​​1: 5765285.69787908
​​2: 349356.90080337634
​​3: 5765285.67265447
​​4: 349356.87564911734
​​5: 5765271.266706267
​​6: 349342.51656936127
​​7: 5765271.291930803
​​8: 349342.54170016386
​​9: 5765285.69787908
​​length: 10

feature.getGeometry().getarea()怎么了?

cywmm 回答:openlayer 4.4 getArea()给出了错误的结果

这是正确的投影单位,并且接近此近似计算

 349356.90 -  349342.54 = 14.36
5765285.69 - 5765271.26 = 14.43

 14.36 * 14.43 = 207.21

当您远离网络墨卡托投影中的赤道时,看起来会变大,因此您应该使用 ol.Sphere.getArea(geometry)以获得真实世界的曲面

,

我发现getArea()对于笛卡尔投影效果很好,例如对我来说EPSG:2154(和utm吗?)。

,

您可以向其传递投影,例如:

const opts: SphereMetricOptions = { projection: 'EPSG:32634' }
const area = getArea(polygon,opts)

请参见https://openlayers.org/en/latest/apidoc/module-ol_sphere.html#~SphereMetricOptions

本文链接:https://www.f2er.com/3005247.html

大家都在问