Let's say I have the latitude and longitude coordinate [30, -87]. From that point, I would like to be able to find where my location would be after traveling let's say 10km at 45 degrees of bearing.
My first attempt at trying to solve this didn't go so well as you can see below. This obviously doesn't account for the units which is really the hardest part to comprehend for me at least.
var bearing = 45;
var distance = 10;
var position = {
"latitude": 30,
"longitude": -87
};
var newLat = Math.cos(bearing) * distance + position.latitude;
var newLon = Math.sin(bearing) * distance + position.longitude;
I'm assuming the radius of the earth will come into play at one point but I really didn't know where to start so any help would be greatly appreciated.