Hi Bio,
I understand that you would like to know the new coordinates for latitude and longitude when you know the distance and directions from the old coordinates.
You can achieve this with the help of “reckon”, “nm2deg” and “atan2d” functions present in “MATLAB Mapping Toolbox”.
Here’s an example code for the same:
% Starting coordinates
startLat = 0.0; % Replace with your actual starting latitude
startLon = 0.0; % Replace with your actual starting longitude
% Distances traveled (in meters)
distanceEast = 1000; % 1000 meters East
distanceSouth = 800; % 800 meters South
% Convert distances from meters to nautical miles
distanceEast_nm = distanceEast / 1852; % 1 nautical mile = 1852 meters
distanceSouth_nm = distanceSouth / 1852;
displacement_nm = sqrt(distanceEast_nm^2 + distanceSouth_nm^2);
% Convert spherical distance from nautical miles to degrees
arclen = nm2deg(displacement_nm);
% Calculate the azimuth (bearing angle)
az = atan2d(distanceEast, distanceSouth);
% Ensure the result is between 0 and 360 degrees
if az < 0
az = az + 360;
end
% Calculate new coordinates using the reckon function
[newLat, newLon] = reckon(startLat, startLon, arclen, az);
% Display the new coordinates
fprintf('New Latitude: %.6f\n', newLat);
fprintf('New Longitude: %.6f\n', newLon);
Alternatively, you could use the traditional approach which uses Haversine formula based on the Great Circle and write your own function for it.
To know more you can refer to the following documentation links:
- reckon: https://www.mathworks.com/help/map/ref/reckon.html
- nm2deg: https://www.mathworks.com/help/map/ref/nm2deg.html
- atan2d: https://www.mathworks.com/help/matlab/ref/atan2d.html
I hope it helps!