问题描述
我可以做一个简单的计算,将km转换为一个值,将该值添加到lat或lon float中,以计算搜索的边界框吗?
Is there a simple calculation I can do which will convert km into a value which I can add to a lat or lon float to calculate a bounding box for searches? It doesn't need to be completely accurate.
例如:如果我得到了英国伦敦的经纬度(51.5001524,-0.1262362),我想计算从该点向东/向西25公里处的纬度是什么,到该点向北/南北25公里处的纬度应该是什么,我需要怎么做才能将25公里转换为十进制以添加到上面的值中?
For instance: if I were given a lat/lon for London, England (51.5001524, -0.1262362) and I wanted calculate what the lat would be 25km east/west from that point, and what the lon would be 25km north/south of that point, what would I need to do to convert the 25km into a decimal to add to the values above?
我正在寻找一般的经验法则,即:1km == +/- 0.XXX
I'm looking for a general rule-of-thumb, ie: 1km == +/- 0.XXX
编辑:
我最初搜索 lat lon没有返回此结果:
My original search for "lat lon" didn't return this result:
接受的答案似乎足以满足我的要求。
The accepted answer seems adequate for my requirements.
推荐答案
大概的转换是:
- 纬度:1度= 110.574公里
- 纵向e:1度= 111.320 * cos(纬度)公里
对于地球的极地平坦化而言,这并不完全正确-为此,您可能需要使用WGS84参考椭球(用于GPS的模型)更复杂的公式。但是对于您而言,该错误可能可以忽略不计。
This doesn't fully correct for the Earth's polar flattening - for that you'd probably want a more complicated formula using the WGS84 reference ellipsoid (the model used for GPS). But the error is probably negligible for your purposes.
来源:
注意:请注意,表示的是经纬度坐标以度为单位,而大多数(所有)语言中的 cos
函数通常接受弧度,因此是必需的。
Caution: Be aware that latlong coordinates are expressed in degrees, while the cos
function in most (all?) languages typically accepts radians, therefore a degree to radians conversion is needed.
这篇关于使用纬度/经度和公里距离的简单计算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!