0

I wanted to draw a vector line of the plane's current speed and heading to predict its future position, with a solid point added every five minutes. I didn't know how to do that. look like this

sueRimn
  • 21
  • 6

1 Answers1

0

The formula using spherical geometry is given here https://www.movable-type.co.uk/scripts/latlong.html (ellipsoidal geometry would be slightly more accurate but more complex)

var lat2 = Math.asin( Math.sin(lat1)*Math.cos(distance/radius) +
                    Math.cos(lat1)*Math.sin(distance/radius)*Math.cos(bearing) );
var lon2 = lon1 + Math.atan2(Math.sin(bearing)*Math.sin(distance/radius)*Math.cos(lat1),
                         Math.cos(distance/radius)-Math.sin(lat1)*Math.sin(lat2));

OpenLayers uses 6371008.8 meters for the Earth's radius

distance would be calculated from time*speed in the same units

Mike
  • 16,042
  • 2
  • 14
  • 30