在知道起点和距离的情况下计算第二点 [英] Calculate second point knowing the starting point and distance

查看:160
本文介绍了在知道起点和距离的情况下计算第二点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用纬度和经度值(点A),我试图计算另一个B点,距离X点距离X米,该弧距点A的弧度为0弧度.然后显示点B的纬度和经度值.

using a Latitude and Longitude value (Point A), I am trying to calculate another Point B, X meters away bearing 0 radians from point A. Then display the point B Latitude and Longitude values.

示例(伪代码):

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

new_PointB = PointA-Distance;

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

I was able to calculate the distance between two Points but what I want to find is the second point knowing the distance and bearing.

最好使用PHP或Javascript.

Preferably in PHP or Javascript.

谢谢

推荐答案

似乎您正在以米为单位测量距离(R),并从正东开始逆时针旋转方位角(theta).并且出于您的目的(米数),平面几何形状应该足够准确.在这种情况下,

It seems you are measuring distance (R) in meters, and bearing (theta) counterclockwise from due east. And for your purposes (hundereds of meters), plane geometry should be accurate enough. In that case,

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

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

If theta is measured clockwise from due north (for example, compass bearings), the calculation for dx and dy is slightly different:

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

无论哪种情况,经度和纬度的变化是:

In either case, the change in degrees longitude and latitude is:

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

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

The difference between the constants 110540 and 111320 is due to the earth's oblateness (polar and equatorial circumferences are different).

这是一个可行的示例,使用您后面的问题中的参数:

Here's a worked example, using the parameters from a later question of yours:

给出经度-87.62788度,纬度41.88592度的起始位置, 在距起始位置西北500米处找到该点的坐标.

Given a start location at longitude -87.62788 degrees, latitude 41.88592 degrees, find the coordinates of the point 500 meters northwest from the start location.

如果我们要从正东逆时针测量角度,则西北"对应 到theta = 135度. R是500米.

If we're measuring angles counterclockwise from due east, "northwest" corresponds to theta=135 degrees. R is 500 meters.

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

这篇关于在知道起点和距离的情况下计算第二点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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