If I have a series of points as longitude and latitude, how would I calculate the center of all of those points?
7 回答
Geomidpoint涵盖了 3 种不同的计算方法。
有几个人回答要取经纬度的平均值。这是一种正确的想法,但在 sphere 上的手段更加复杂。
纬度/经度表示本质上是人为的并且有不连续性(在两极,如果你不小心的话,在本初子午线对面),所以它似乎不太可能(对我来说)有一个合理的几何解释. 我认为你需要做一些事情,比如在地心坐标中平均矢量,然后对结果进行归一化以将其放回球体上。
我希望在这些问题上有更多经验的人可以更具体地发表评论。
First off, you need to define which centre you're interested in. Take these two points:
A. .B
The centre is easy, it's halfway between them. Now add a third point:
A. C. .B
Is the centre still halfway between A and B or is it weighted towards A because of C? So is the centre the point nearest to all points or just the points on the enclosing polygon?
Also, as it's long/lat you're dealing with the points are on a surface of a sphere so the distance between long 0 and long 90 degrees is much greater at lat 0 than at lat 45 degrees.
您可能正在寻找由点定义的简单多边形的质心。该文章中有关于如何计算各种几何形状的信息。
如果您以下列形式提出问题,Wolfram Alpha 将为您执行此操作: 具有顶点的多边形的质心:(X, Y), (X, Y), (X, Y), (X, Y), (X, Y) 等。
只需记住先将每个“(X,Y)”转换为十进制形式。Wolfram Alpha 将以十进制形式返回答案,然后您可以将其复制并粘贴到 Google 地球中。
See Moe's answer, although if your points are distributed across the globe, you'll have to be satisfied that your center tends towards the Prime Meridian and not the International Date Line.