29

使用纬度和经度值(A 点),我正在尝试计算另一个 B 点,距离 A 点 X 米,带有 0 弧度。然后显示 B 点的纬度和经度值。

示例(伪代码):

PointA_Lat = x.xxxx;
PointA_Lng = x.xxxx;
Distance = 3; //Meters
bearing = 0; //radians

new_PointB = PointA-Distance;

我能够计算出两个点之间的距离,但我想找到的是知道距离和方位的第二个点。

最好使用 PHP 或 Javascript。

谢谢

4

4 回答 4

49

看来您正在以米为单位测量距离(R),并从正东逆时针方向测量(θ)。并且为了您的目的(数百米),平面几何应该足够准确。在这种情况下,

dx = R*cos(theta) ; theta measured counterclockwise from due east
dy = R*sin(theta) ; dx, dy same units as R

如果从正北顺时针测量 theta(例如,罗盘方位),则 dx 和 dy 的计算略有不同:

dx = R*sin(theta)  ; theta measured clockwise from due north
dy = R*cos(theta)  ; dx, dy same units as R

在任何一种情况下,经度和纬度的变化是:

delta_longitude = dx/(111320*cos(latitude))  ; dx, dy in meters
delta_latitude = dy/110540                   ; result in degrees long/lat

常数 110540 和 111320 之间的差异是由于地球的扁率(极地周长和赤道周长不同)。

这是一个工作示例,使用您稍后问题中的参数:

给定一个经度 -87.62788 度,纬度 41.88592 度的起始位置,找到距起始位置西北 500 米的点的坐标。

如果我们从正东逆时针测量角度,“西北”对应于 theta=135 度。R 为 500 米。

dx = R*cos(theta) 
   = 500 * cos(135 deg) 
   = -353.55 meters

dy = R*sin(theta) 
   = 500 * sin(135 deg) 
   = +353.55 meters

delta_longitude = dx/(111320*cos(latitude)) 
                = -353.55/(111320*cos(41.88592 deg))
                = -.004266 deg (approx -15.36 arcsec)

delta_latitude = dy/110540
               = 353.55/110540
               =  .003198 deg (approx 11.51 arcsec)

Final longitude = start_longitude + delta_longitude
                = -87.62788 - .004266
                = -87.632146

Final latitude = start_latitude + delta_latitude
               = 41.88592 + .003198
               = 41.889118
于 2010-02-02T23:41:23.563 回答
3

如果您知道 3600 秒的弧度是 1 度(纬度或经度),海里有 1852 米,而海里是 1 秒的弧度,这可能会有所帮助。当然,您取决于距离相对较短,否则您必须使用球面三角法。

于 2010-02-02T21:18:54.347 回答
2

这是使用 Swift 的更新版本:

let location = CLLocation(latitude: 41.88592 as CLLocationDegrees, longitude: -87.62788 as CLLocationDegrees)

let distanceInMeter : Int = 500
let directionInDegrees : Int = 135

let lat = location.coordinate.latitude
let long = location.coordinate.longitude

let radDirection : CGFloat = Double(directionInDegrees).degreesToRadians

let dx = Double(distanceInMeter) * cos(Double(radDirection)) 
let dy = Double(distanceInMeter) * sin(Double(radDirection))

let radLat : CGFloat = Double(lat).degreesToRadians

let deltaLongitude = dx/(111320 * Double(cos(radLat)))  
let deltaLatitude = dy/110540                   

let endLat = lat + deltaLatitude
let endLong = long + deltaLongitude

使用这个扩展:

extension Double {
    var degreesToRadians : CGFloat {
        return CGFloat(self) * CGFloat(M_PI) / 180.0
    }
}
于 2015-08-24T11:52:08.413 回答
-2

dx = sin(轴承)
dy = cos(轴承)
x = center.x + dist dx;
y = center.y + dist
dy;

于 2010-02-02T21:09:18.817 回答