Latitude, Longitude (degrees) to UTM and UPS projections

9 views (last 30 days)
S K
S K on 10 Feb 2012
Answered: ag on 6 Nov 2024 at 10:10
I need a function to convert latitude, longitude to UTM and UPS systems and convert them back to latitude and logitude. Please let me know if someone has developed it already. :)

Answers (1)

ag
ag on 6 Nov 2024 at 10:10
Hi SK,
To convert latitude and longitude to the UTM or UPS coordinate system, you can utilize the Mapping Toolbox in MATLAB.
Below is an example code that demonstrates this process:
% Create a map projection structure for a UPS/UTM projection
mstruct = defaultm("ups");
% Specify map limits and a reference ellipsoid for the map projection structure.
% Populate additional fields of the structure based on the map limits using the defaultm function again.
mstruct.maplonlimit = [-150 -30];
mstruct.geoid = referenceEllipsoid("grs80", "kilometers");
mstruct = defaultm(mstruct);
% Load coastline data and trim it to the specified map limits.
% Project the latitude and longitude coordinates using the projfwd function and the map projection structure.
load coastlines
[lat, lon] = maptriml(coastlat, coastlon, mstruct.maplatlimit, mstruct.maplonlimit);
[x, y] = projfwd(mstruct, lat, lon);
% Display the projected coordinates on a Cartesian plot.
figure
plot(x, y)
axis equal
For more details, please refer to the following MathWorks documentation:
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!