问题描述
我想根据坐标和以米为单位的距离创建 2 个新的经度和 2 个新的纬度,我想在某个点周围创建一个漂亮的边界框.它适用于城市的一部分,最大±1500 米.因此,我认为不必考虑地球的曲率.
I want to create 2 new longitude and 2 new latitudes based on a coordinate and a distance in meters, I want to create a nice bounding box around a certain point. It is for a part of a city and max ±1500 meters. I therefore don't think the curvature of earth has to be taken into account.
所以我有 50.0452345
(x) 和 4.3242234
(y) 我想知道 x + 500 米,x - 500 米,y - 500 米,y+ 500 米
So I have 50.0452345
(x) and 4.3242234
(y) and I want to know x + 500 meters, x - 500 meters, y - 500 meters, y + 500 meters
我发现了很多算法,但几乎所有算法似乎都处理点之间的距离.
I found many algorithms but almost all seem to deal with the distance between points.
推荐答案
每度经度的公里数约为
(pi/180) * r_earth * cos(theta*pi/180)
其中 theta
是以度为单位的纬度,r_earth
约为 6378 公里.
where theta
is the latitude in degrees and r_earth
is approximately 6378 km.
所有地点每纬度的公里数大致相同,大约
The number of kilometers per degree of latitude is approximately the same at all locations, approx
(pi/180) * r_earth = 111 km / degree
所以你可以这样做:
new_latitude = latitude + (dy / r_earth) * (180 / pi);
new_longitude = longitude + (dx / r_earth) * (180 / pi) / cos(latitude * pi/180);
只要 dx
和 dy
与地球的半径相比很小,并且您不会离两极太近.
As long as dx
and dy
are small compared to the radius of the earth and you don't get too close to the poles.
这篇关于从旧 + n 米计算新的经度、纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!