【matlab程序】UTM(x_y)转经纬度(lon_lat)

文摘   2024-06-11 23:46   德国  

【matlab程序】UTM(x_y)转经纬度(lon_lat)

UTM(x_y)图像:

经纬度(lon_lat)图像:



函数来源/函数下载:

utm2deg - File Exchange - MATLAB Central (mathworks.cn)

代码示例:

clear;clc;close all;% UTM (x-y)转经纬度(lon-lat)% 读取UTM (x-y)load('x_y.mat')% 读取数据load('data.mat')%  UTM (x-y)转经纬度(lon-lat)关键步骤x1 =reshape(x,[size(A3,1)*size(A3,2),1]);y1 =reshape(y,[size(A3,1)*size(A3,2),1]);utm_zone=['32 T'];utm_zone1=repmat(utm_zone,size(A3,1)*size(A3,2),1);[Lat, Lon]=utm2deg(x1,y1,utm_zone1);clear x1 y1 utm_zone1 utm_zoneLat = reshape(Lat,[size(A3,1) size(A3,2)]);Lon = reshape(Lon,[size(A3,1) size(A3,2)]);%% 画图展示 UTM (x-y)close allfigureset(gcf,'Position',[50 50 1000 1000],'color','w')pcolor(x(1:2:end,1:1:end),y(1:2:end,1:1:end),A3(1:2:end,1:1:end));shading flatcmap=load('autumn.txt');%colormap(cmap(1:80:500,1:3));print('-dpng','-r600','x_y');%% 画图展示 经纬度close allfigurem_proj('miller','lon',[6.175 9.5],'lat',[53.2 55.135])set(gcf,'Position',[50 50 1000 1000],'color','w')m_pcolor(Lon(1:2:end,1:1:end),Lat(1:2:end,1:1:end),A3(1:2:end,1:1:end));shading flatcmap=load('autumn.txt');%colormap(cmap(1:80:500,1:3));m_gshhs_f('color',[0.8 0.8 0.8]);m_grid('fontsize',15,'linewidth',2)print('-dpng','-r600','经纬度');

参考文献:

Copyright (c) 2006, Rafael Palacios

All rights reserved.



Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions aremet:

* 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, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BELIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OFSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESSINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.


海洋与大气科学
海洋与大气科学数据分析,数据可视化分享,可教学。
 最新文章