纬度/经度和米 [英] Latitude / Longitude and meters

查看:609
本文介绍了纬度/经度和米的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的算法问题。

I have a small algorithmic problem.

我开发一个Android应用程序。我得到的GPS坐标。例如:纬度: 23.23907 ,经度: 50.45786

I am developing an Android application. I get GPS coordinates. For example: latitude: 23.23907, longitude: 50.45786.

所以,我拿到一分。我想计算在这一点上加或减5米范围的细节。即:

So I get a point. I want to compute bounds details on this point plus or minus 5 meters. I.e.:

[23.23907 - 5 meters ; 23.23907 + 5 meters]
[50.45786 - 5 meters ; 50.45786 + 5 meters]

如何使这种计算?

How to make this calculation?

非常感谢你!

推荐答案

在半正矢公式可以,当你在南北和东西方向的工作被简化了很多而已。

The haversine formula can be simplified a great deal when you work in north-south and east-west directions only.

如果地球的周长为C,该点在d公里到指定的点的南面是 360 * D / C 度到南部。在d公里,到东的一点是 360 * D /(C * COS(纬度))度到东部。分母中的余弦来自一个事实,即经度的在给定纬度比由赤道多

If Earth's circumference is C, the point at d kilometers to south of a given point is 360*d/C degrees to the south. The point at d kilometers to east is 360*d/(C*cos(latitude)) degrees to the east. The cosine in the denominator comes from the fact that the length of the longitude at a given latitude shorter than the equator by that much.

因此​​,如果地球的周长是40075.04公里,移动5μm到北/南,你会加/减 0.0000449 从纬度和使用相同的经度。移动5μm到东/西,你会使用相同的纬度,加/减 0.0000449 / COS(纬度)以经度。不要忘了边缘的情况下,虽然:两极附近,你必须夹紧北纬90°,东经附近的180°你必须得加上或减去360°,以保持经度在正确的范围内

So if the Earth's circumference is 40075.04 km, to move 5 m to the north/south you would add/subtract 0.0000449 from the latitude and use the same longitude. To move 5 m to the west/east you would use the same latitude and add/subtract 0.0000449/cos(latitude) to the longitude. Don't forget about the edge cases though: near poles you have to clamp latitude to 90°, and near longitude 180° you'll have too add or subtract 360° to keep the longitude in the correct range.

通过你的号码的范围内原来是近似为:

With your numbers the range turns out to be approximately:

latitude:  [23.23903 ; 23.23911]
longitude: [50.45781 ; 50.45791]


更新:请注意,这还是假设地球是一个完美的球体,它不是。例如模型地球为椭圆体,其中赤道是在6378.137公里和两极GPS系统是在从地球的中心6356.7523142公里。的差大约是1 / 1/300和关系重大对于许多应用,但在这种情况下,它是误差范围之内。


Update: Note that this still assumes that the Earth is a perfect sphere, which it's not. The GPS system for example models the Earth as an ellipsoid where the equator is at 6378.137km and the poles are at 6356.7523142km from the center of the Earth. The difference is about 1/300th and matters a great deal for many applications, but in this case it's within the margin of error.

校正公式经度应该是简单的,因为相似之处仍然圈子:你只需要换 COS(纬度)的修正系数。计算正确纬度是困难,因为经脉不是圆形而是椭圆,椭圆形的圆弧长度不能使用计算初等函数,所以你必须使用近似。

Correcting the formula for the longitude should be simple since the parallels are still circles: you would just have to swap cos(latitude) for the correct coefficient. Calculating the correct latitude is harder because the meridians are not circles but ellipses, and the arc length of an ellipse cannot be calculated using elementary functions, so you must use approximations.

这篇关于纬度/经度和米的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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