gpt4 book ai didi

c# - C#计算平均经纬度

转载 作者:太空狗 更新时间:2023-10-30 00:08:34 39 4
gpt4 key购买 nike

我有十进制的 (minLatitude,maxLatitude) 和 (minLongitude,maxLongitude) 对,我需要计算这些对定义的方框的平均点,我怎样才能得到它们的平均纬度/经度?当计算简单的算术平均值时,我得到了相当大的偏移量。

谢谢!

最佳答案

Pierre-Luc Champigny 建议的解决方案是错误的。

在下图中你可以看到两条线:

  1. (lat1,lon1) --> (lat2,lon2)
  2. (lat1,lon2) --> (lat2,lon1)

每条线的一半长度为绿色,另一半为蓝色。

可以看到两条线的中心不是同一个点,两个中心都不是多边形的中心。

earth

为了找到多边形的中心:

  • lat= avrg(lat1,lat2)
  • lon= avrg(lon1,lon2)

要获得这些值,您可以使用 Pierre-Luc Champigny 建议的链接,但是:

  • 取 (lat1,lon1) 中点的纬度 --> (lat2,lon1)
  • 取(lat1,lon1)的中点的lon --> (lat1,lon2)

关于c# - C#计算平均经纬度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7259014/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com