Calculate the center point of multiple latitude/longitude coordinate pairs

后端 未结 21 1519
暖寄归人
暖寄归人 2020-11-27 09:27

Given a set of latitude and longitude points, how can I calculate the latitude and longitude of the center point of that set (aka a point that would center a view on all poi

21条回答
  •  情深已故
    2020-11-27 09:47

    This is is the same as a weighted average problem where all the weights are the same, and there are two dimensions.

    Find the average of all latitudes for your center latitude and the average of all longitudes for the center longitude.

    Caveat Emptor: This is a close distance approximation and the error will become unruly when the deviations from the mean are more than a few miles due to the curvature of the Earth. Remember that latitudes and longitudes are degrees (not really a grid).

提交回复
热议问题