utm2deg
Function to convert vectors of UTM coordinates into Lat/Lon vectors (WGS84).
Contents
Syntax
[Lat,Lon] = utm2deg(xx,yy,utmzone)
Description
Function to convert vectors of UTM coordinates into Lat/Lon vectors (WGS84). Some code has been extracted from UTMIP.m function by Gabriel Ruiz Martinez. Author: Rafael Palacios, Universidad Pontificia Comillas, Madrid, Spain
Inputs
- x - x coordinate in UTM
- y - y coordinate in UTM
- utmzone - the UTM zone designation
Outputs
- Lat - Latitude vector. Degrees. +ddd.ddddd WGS84
- Lon - Longitude vector. Degrees. +ddd.ddddd WGS84
Copyright
Copyright (c) 2006, Rafael Palacios All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution * Neither the name of the Univ Pontificia Comillas nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Example
Calculate the latitude/longitude for 6 example locations in difference UTM zones
x=[ 458731; 407653; 239027; 230253; 343898; 362850]; y=[4462881; 5126290; 4163083; 3171843; 4302285; 2772478]; utmzone=['30 T'; '32 T'; '11 S'; '28 R'; '15 S'; '51 R']; [Lat, Lon]=utm2deg(x,y,utmzone); [Lat';Lon']
ans = 40.3154 46.2839 37.5778 28.6456 38.8556 25.0618 -3.4857 7.8012 -119.9552 -17.7595 -94.7990 121.6403