从经度纬度转换为笛卡尔坐标 [英] Converting from longitudelatitude to Cartesian coordinates

查看:94
本文介绍了从经度纬度转换为笛卡尔坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些以地球为中心的坐标点作为纬度和经度(WGS-84).

I have some earth-centered coordinate points given as latitude and longitude (WGS-84).

如何将它们转换为原点位于地球中心的笛卡尔坐标 (x,y,z)?

How can i convert them to Cartesian coordinates (x,y,z) with the origin at the center of the earth?

推荐答案

我最近使用Haversine 公式"关于 WGS-84 数据,它是Haversines 定律"的派生词;结果非常令人满意.

I have recently done something similar to this using the "Haversine Formula" on WGS-84 data, which is a derivative of the "Law of Haversines" with very satisfying results.

是的,WGS-84 假设地球是一个椭球体,但我相信使用Haversine Formula"之类的方法只会得到大约 0.5% 的平均误差,这在你的情况下可能是可接受的误差量.除非您谈论的是几英尺的距离,否则您总会有一些错误,即使在理论上地球也存在曲率......如果您需要更严格的 WGS-84 兼容方法,请查看Vincenty 公式"."

Yes, WGS-84 assumes the Earth is an ellipsoid, but I believe you only get about a 0.5% average error using an approach like the "Haversine Formula", which may be an acceptable amount of error in your case. You will always have some amount of error unless you're talking about a distance of a few feet and even then there is theoretically curvature of the Earth... If you require a more rigidly WGS-84 compatible approach checkout the "Vincenty Formula."

我了解 starblue 的来源,但好的软件工程通常需要权衡取舍,因此这完全取决于您所做工作所需的准确性.例如,根据曼哈顿距离公式"计算的结果为与距离公式"的结果相比,在某些情况下可能会更好,因为它的计算成本更低.想想哪个点最近?"不需要精确距离测量的场景.

I understand where starblue is coming from, but good software engineering is often about trade-offs, so it all depends on the accuracy you require for what you are doing. For example, the result calculated from "Manhattan Distance Formula" versus the result from the "Distance Formula" can be better for certain situations as it is computationally less expensive. Think "which point is closest?" scenarios where you don't need a precise distance measurement.

关于Haversine 公式"它很容易实现并且很好,因为它使用了球面三角".而不是余弦定律"基于二维三角函数的方法,因此您可以在准确性与复杂性之间取得很好的平衡.

Regarding, the "Haversine Formula" it is easy to implement and is nice because it is using "Spherical Trigonometry" instead of a "Law of Cosines" based approach which is based on two-dimensional trigonometry, therefore you get a nice balance of accuracy over complexity.

一位名叫 Chris Veness 的绅士有一个伟大的 网站,解释您感兴趣的一些概念并演示各种程序化实现;这也应该回答您的 x/y 转换问题.

A gentleman by the name of Chris Veness has a great website that explains some of the concepts you are interested in and demonstrates various programmatic implementations; this should answer your x/y conversion question as well.

这篇关于从经度纬度转换为笛卡尔坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆