Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
621 views
in Technique[技术] by (71.8m points)

openlayers - openlayer 4.4 getArea()给出了错误的结果(openlayer 4.4 getArea() gives a bad result)

getArea() gives 206.85693359375 m2 for a square of 10 meters on the side.

(getArea()可提供206.85693359375平方米getArea()一侧为10米的正方形)。)

The coordinates of this geometry are:

(此几何的坐标为:)

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

What's wrong with feature.getGeometry().getArea() ?

(feature.getGeometry().getArea()什么问题?)

  ask by ericire translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

That is correct in projection units, and is close to this approximate calculation

(以投影单位为单位是正确的,并且接近此近似计算)

 349356.90 -  349342.54 = 14.36
5765285.69 - 5765271.26 = 14.43

 14.36 * 14.43 = 207.21

As you move away from away from the equator in a web mercator projection things look larger so you should use ol.Sphere.getArea(geometry) to get the true area on the curved surface of the world

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...