Code covered by the BSD License  

Highlights from
deg2utm

4.88889

4.9 | 9 ratings Rate this file 118 Downloads (last 30 days) File Size: 2.61 KB File ID: #10915

deg2utm

by Rafael Palacios

 

29 Apr 2006 (Updated 17 Aug 2006)

Function to convert lat/lon vectors into UTM coordinates (WGS84)

| Watch this File

File Information
Description

This function is based on UTM.m function by Gabriel Ruiz Martinez, but instead of providing a GUI it works with vectors of coordinates.
[x,y,utmzone] = deg2utm(Lat,Lon)
% Example 1:
% Lat=[40.3154333; 46.283900; 37.577833; 28.645650; 38.855550; 25.061783];
% Lon=[-3.4857166; 7.8012333; -119.95525; -17.759533; -94.7990166; 121.640266];
% [x,y,utmzone] = deg2utm(Lat,Lon);
% fprintf('%7.0f ',x)
% 458731 407653 239027 230253 343898 362850
% fprintf('%7.0f ',y)
% 4462881 5126290 4163083 3171843 4302285 2772478
% utmzone =
% 30 T
% 32 T
% 11 S
% 28 R
% 15 S
% 51 R
%
% Example 2: If you have Lat/Lon coordinates in Degrees, Minutes and Seconds
% LatDMS=[40 18 55.56; 46 17 2.04];
% LonDMS=[-3 29 8.58; 7 48 4.44];
% Lat=dms2deg(mat2dms(LatDMS)); %convert into degrees
% Lon=dms2deg(mat2dms(LonDMS)); %convert into degrees
% [x,y,utmzone] = deg2utm(Lat,Lon)
%

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Conversion of Spherical Coordinates to UTM Coordinates
This submission has inspired the following:
SP_PROJ, get_google_map, wgs2utm (version 2)

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
06 Jun 2006 oh kwoun

Thanks a lot!

11 Jul 2006 Philippe Blondel

Very good ! Thank you very much !

25 Oct 2006 Anthony Liou

Great stuff~ Thank you very much.

26 Jan 2007 Junseok Park

Excellent!! And Thank you. This is applied for Korea.

22 Jun 2007 Andy Gardos

Excellent Script! I wonder if you would provide some comments for the calculation section. I've compared some lat/lon data to actual x,y profiles; however, I've found that I must multiply the x and y valuse derived from deg2utm by approximately 3.2 to match the actual values?! Thanks! Again, great script!!!

03 Jan 2008 Tony Gibb  
02 Sep 2008 E Bobane

I have my Lat/Lon coordinates in Degrees, Minutes and Seconds (as in your Example 2). However I am missing the 'dms2deg' and 'mat2dms' functions. Are these in some toolbox or part of this submission.

16 Nov 2010 Anna

Hello!
I have a question about this script:
I want to convert lat lon points in the Northern Shelf Sea (Europe) to coordinates which have the unit meters. So I thought using UTM coordinates was the best solution.
However, the area is quite big (1000km x 1000km) and contains different zones. So after converting, my points are not in the right order any more. So either it is simply not possible to have points of different zones in one data base or the script makes some mistake.
Can somebody help me with this issue?
Thank you. Anna

10 Jan 2011 r nawaz  
26 Jan 2011 S. A. van der Wulp  
Please login to add a comment or rating.
Updates
29 Jun 2006

Update description. Minor fixes

03 Aug 2006

Fixed a problem with southern hemisphere coordinates. Now it works properly.

17 Aug 2006

corrected m-Lint warnings

Tag Activity for this File
Tag Applied By Date/Time
utm Rafael Palacios 22 Oct 2008 08:23:41
coordinates Rafael Palacios 22 Oct 2008 08:23:41
latitude Rafael Palacios 22 Oct 2008 08:23:41
longitude Rafael Palacios 22 Oct 2008 08:23:41
degrees Rafael Palacios 22 Oct 2008 08:23:41
wgs84 Rafael Palacios 22 Oct 2008 08:23:41
geo Bo 20 May 2009 15:53:51
coordinates Johannes 27 May 2011 07:28:54
utm Kun Aguero 03 Jun 2011 06:34:20
coordinates gianluca 30 Jan 2012 16:57:58
gis Jakob Tougaard 11 Mar 2012 14:50:44

Contact us at files@mathworks.com