GPS/GIS Calculations: Algorithm to predict future position based on movement/mph?

泪湿孤枕 提交于 2019-12-03 03:14:20

Here is the complete parametric answer :

variables :

  • heading : heading (i.e. backwards angle from azimuth 0°, in degrees)
  • speed : velocity (i.e. norm of the speed vector, in miles/hour)
  • lat0, lon0 : initial coordinates in degrees
  • dtime : time interval from the start position, in seconds
  • lat, lon : predicted coordinates in degrees
  • pi : the pi constant (3.14159...)
  • Rt : Earth radius in miles (6378137.0 meters which makes 3964.037911746 miles)

In an (East, North) local frame, the position after the time interval is :

x = speed * sin(heading*pi/180) * dtime / 3600;
y = speed * cos(heading*pi/180) * dtime / 3600;

(with coordinates in miles)

From there you can compute the new position in the WGS84 frame (i.e. latitude and longitude) :

lat = lat0 + 180 / pi * y / Rt;
lon = lon0 + 180 / pi / sin(lat0*pi/180) * x / Rt;

Edit : corrected the last line : *sin(phi) to /sin(phi)

Here are the formulas that you need.

http://www.movable-type.co.uk/scripts/latlong.html

Hope that helps.

Bob

[update] Here are the formulas in JavaScript (copied from source)

var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) +                       Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) ); var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1),                              Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));

d=distance traveled=velocity x time R=radius of the earth

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!