【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_zone
Lat = reshape(Lat,[size(A3,1) size(A3,2)]);
Lon = reshape(Lon,[size(A3,1) size(A3,2)]);
%% 画图展示 UTM (x-y)
close all
figure
set(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 flat
cmap=load('autumn.txt');%
colormap(cmap(1:80:500,1:3));
print('-dpng','-r600','x_y');
%% 画图展示 经纬度
close all
figure
m_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 flat
cmap=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 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.