确定多个点的质心

发布于 2024-07-10 04:51:09 字数 334 浏览 7 评论 0原文

我正在编写一个用 python 编写的地图应用程序,我需要获取 N 点的经纬度质心。 假设我有两个位置,

a.lat = 101
a.lon = 230

b.lat = 146
b.lon = 200

使用欧几里德公式获取两点的中心相当容易。 我想 能够做到两分以上。

从根本上说,我想做一些类似 http://a.place Between.us/ 的事情,其中​​一个人可以输入多个地址并找到一个对每个人来说都是等距离的地点。

I'm writing a mapping application that I am writing in python and I need to get the lat/lon centroid of N points.
Say I have two locations

a.lat = 101
a.lon = 230

b.lat = 146
b.lon = 200

Getting the center of two points is fairly easy using a euclidean formula. I would like
to be able to do it for more then two points.

Fundamentally I'm looking to do something like http://a.placebetween.us/ where one can enter multiple addresses and find a the spot that is equidistant for everyone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

随梦而飞# 2024-07-17 04:51:09

请查看下面链接的 pdf 文档。 它解释了如何应用比尔蜥蜴提到的平面图形算法 ,但是在球体的表面上。

海报缩略图和一些详细信息 http://img51.imageshack.us/img51/4093/centroidspostersummary .jpg
来源:http://www.jennessent.com/arcgis/shapes_poster.htm< br>
还有25 MB 全尺寸 PDF 可供下载。
感谢 mixdev 找到原始来源的链接,当然还要感谢 Jenness Enterprises 提供的信息。 注意:我与本材料的作者没有任何关系。

Have a look at the pdf document linked below. It explains how to apply the plane figure algorithm that Bill the Lizard mentions, but on the surface of a sphere.

poster thumbnail and some details http://img51.imageshack.us/img51/4093/centroidspostersummary.jpg
Source: http://www.jennessent.com/arcgis/shapes_poster.htm
There is also a 25 MB full-size PDF available for download.
Credit goes to mixdev for finding the link to the original source, and of course to Jenness Enterprises for making the information available. Note: I am in no way affiliated with the author of this material.

水溶 2024-07-17 04:51:09

添加安德鲁·罗林斯的答案。

您还需要确保 0/360 经度线两侧是否有点,您正在以“正确的方向”进行测量

Is the center of (0,359) and (0, 1) at (0,0) or (0,180)?

Adding to Andrew Rollings' answer.

You will also need to make sure that if you have points on either side of the 0/360 longitude line that you are measuring in the "right direction"

Is the center of (0,359) and (0, 1) at (0,0) or (0,180)?
请持续率性 2024-07-17 04:51:09

如果您要平均角度并且必须处理跨越 0/360 的角度,那么将每个值的 sin 和 cos 相加比较安全,然后 Average = atan2(sine 之和,cosine 之和)
(注意 atan2 函数中的参数顺序)

If you are averaging angles and have to deal with them crossing the 0/360 then it is safer to sum the sin and cos of each value and then Average = atan2(sum of sines,sum of cosines)
(be careful of the argument order in your atan2 function)

小忆控 2024-07-17 04:51:09

如果这些点形成一个平面图形,那么数学就非常简单了。 然而,不能保证一组纬度和经度如此简单,因此可能首先需要找到

编辑:正如 eJames 指出的那样,您必须更正球体的表面。 我的错误是假设(不加思考)这是被理解的。 给他+1。

The math is pretty simple if the points form a plane figure. There's no guarantee, however, that a set of latitudes and longitudes are that simple, so it may first be necessary to find the convex hull of the points.

EDIT: As eJames points out, you have to make corrections for the surface of a sphere. My fault for assuming (without thinking) that this was understood. +1 to him.

蓝天白云 2024-07-17 04:51:09

下面的 PDF 比 Jenness Enterprises 的海报更详细。 它还处理两个方向的转换以及球体(例如地球)而不是完美球体的转换。

在 3-D 笛卡尔坐标和椭球纬度、经度和高度坐标之间转换

The below PDF has a bit more detail than the poster from Jenness Enterprises. It also handles conversion in both directions and for a spheroid (such as the Earth) rather than a perfect sphere.

Converting between 3-D Cartesian and ellipsoidal latitude, longitude and height coordinates

善良天后 2024-07-17 04:51:09

分别对纬度和经度进行平均。

Separately average the latitudes and longitudes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文