I have know my current position({lat:x,lon:y}) and I know my speed and direction angle; How to predict next position at next time?
Here in JS for calculating lat and lng given bearing and distance:
//lat, lng in degrees. Bearing in degrees. Distance in Km
calculateNewPostionFromBearingDistance = function(lat, lng, bearing, distance) {
var R = 6371; // Earth Radius in Km
var lat2 = Math.asin(Math.sin(Math.PI / 180 * lat) * Math.cos(distance / R) + Math.cos(Math.PI / 180 * lat) * Math.sin(distance / R) * Math.cos(Math.PI / 180 * bearing));
var lon2 = Math.PI / 180 * lng + Math.atan2(Math.sin( Math.PI / 180 * bearing) * Math.sin(distance / R) * Math.cos( Math.PI / 180 * lat ), Math.cos(distance / R) - Math.sin( Math.PI / 180 * lat) * Math.sin(lat2));
return [180 / Math.PI * lat2 , 180 / Math.PI * lon2];
};
calculateNewPostionFromBearingDistance(60,25,30,1)
[60.007788047871614, 25.008995333937197]