M_Map工具箱简介及地理图形绘制

M_Map是一个用于Matlab的映射工具包,支持20多种投影方式,包括方位投影、圆锥投影和圆柱投影等。文章详细介绍了如何设置投影、网格与轴以及如何绘制不同类型的地理图形,如海岸线、地形和等值线。还提供了多个示例,如LambertConformalConic投影的北美地形和北极地区的立体投影等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 M_Map简介

官网-M_Map: A mapping package for Matlab
在这里插入图片描述
M_Map 是一组为 Matlab 编写的映射工具(它也适用于Octave)。M_Map包括:

  • 使用球形和椭圆体地球模型以 20 种不同的投影方式(并确定逆向映射)投影数据的例程
  • 一个网格生成例程,用于在纬度/经度或平面 X/Y 方面制作具有限制的漂亮轴
  • 海岸线数据库(1/4 度分辨率)
  • 全球高程数据库(1 度分辨率)
  • 连接到免费提供的高分辨率海岸线和测深数据库
  • 其他有用的东西

1.1 具体代码说明

1.1.1 投影设置

m_proj('oblique mercator');
m_proj('oblique mercator','longitudes',[-132 -125], ...
           'latitudes',[56 40],'direction','vertical','aspect',.5);
  • 设置投影类型,默认投影参数(oblique mercator),也可以自己设置参数,详细参见用户手册(Users Guide
投影类型投影名称说明
Azimuthal projections(方位投影)Stereographic 立体影像立体投影是等角的,但不是等面积的。该投影通常用于极地地区。
Azimuthal projections(方位投影)Orthographic 正字投影这个投影既不是等面积的,也不是共形的,而是类似于地球的透视视图。
Azimuthal projections(方位投影)Azimuthal Equal-area 方位等积有时称为 Lambert 方位角等积投影,这种映射是等面积的但不是共形的。
Azimuthal projections(方位投影)Azimuthal Equidistant 方位等距该投影既不是等积投影也不是等角投影,但距中心点的所有距离和方向都是真实的。
Azimuthal projections(方位投影)Gnomonic该投影既不是等积投影也不是等角投影,但地图上的所有直线(不仅是通过中心的直线)都是大圆路线。然而,地图的边缘有很大程度的扭曲,所以最大半径应该保持相当小——最多 20 或 30 度。
Azimuthal projections(方位投影)Satellite这是地球的透视图,由卫星在指定高度看到。
Conic Projections(圆锥投影)Albers Equal-Area Conic此投影是等面积的,但不是共形的
Conic Projections(圆锥投影)Lambert Conformal Conic此投影是等角投影,但不是等积投影。
Cylindrical and Pseudo-cylindrical Projections(圆柱和伪圆柱投影)Mercator 墨卡托这是一个共形贴图,基于环绕赤道的切线圆柱体。此投影上的直线是等向线(即轨道后跟恒定方位的路线)。
Cylindrical and Pseudo-cylindrical Projections(圆柱和伪圆柱投影)Equidistant Cylindrical 等距圆柱该投影既不是等积投影也不是等角投影。它由等距的纬度和经度线组成,经常用于快速绘制数据。
  • 关于经度的设置,负号西经,正号为东经

1.1.2 网格与轴设置

m_grid

1.1.3 绘制各种类型的图形

m_plot(LONG,LAT,...line properties)     
m_line(LONG,LAT,...line properties)      % 线条
m_text(LONG,LAT,string)                % 文本   
m_quiver(LONG,LAT,U,V,S)                 % 矢量箭头
m_patch(LONG,LAT,..patch properties)     % 色块
m_annotation(‘line’,LON,LAT)             % 注释
m_contour(LONG,LAT,VALUES)				 % 等值线
m_contourf(LONG,LAT,VALUES)				 % 等值线填充
m_image(LON,LAT,DATA)					 % 影像
m_pcolor(LON,LAT,DATA)					 % 色块
[IM,X,Y]=m_image(LON,LAT,DATA);
m_shadedrelief(X,Y,IM,'coords','map’)	 % 地形渲染
m_etopo2(OPTION)						 
m_elev(OPTION)
m_ruler([.5 .8],.9,'tickdir','out','ticklen',[.007 .007]);  	  % 距离标尺
m_northarrow(-123-4.5/60,49+19.5/60,1/60,'type',4,'aspect',1.5);  % 指北针

2 地理图形绘制案例

2.1 M_Map给定案例

2.1.1 M_Map Logo

成图如下:
在这里插入图片描述
相关MATLAB代码:

%% Example1:M_Map Logo
figure(1);

m_proj('ortho','lat',48','long',-123');
m_coast('patch','r');
m_grid('linest','-','xticklabels',[],'yticklabels',[]);

patch(.55*[-1 1 1 -1],.25*[-1 -1 1 1]-.55,'w'); 
text(0,-.55,'M\_Map','fontsize',25,'color','b',...
    'verticalalignment','middle','horizontalalignment','center');
set(gca,'Layer','top','FontSize',14,'Fontname', 'Times New Roman');

2.1.2 Lambert Conformal Conic projection of North American Topography

成图如下:
在这里插入图片描述
相关MATLAB代码:

%% Example2:Lambert Conformal Conic projection of North American Topography
figure(2);

m_proj('lambert','long',[-160 -40],'lat',[30 80]);
m_coast('patch',[1 .85 .7]);
m_elev('contourf',[500:500:6000]);
m_grid('box','fancy','tickdir','in');
colormap(flipud(copper));
set(gca,'Layer','top','FontSize',14,'Fontname', 'Times New Roman');

2.1.3 Stereographic projection of North Polar regions

成图如下:
在这里插入图片描述
相关MATLAB代码:

%% Example3:Stereographic projection of North Polar regions
% Note that coastline is drawn OVER the grid because of the order in which
% the two routines are called

figure(3);

m_proj('stereographic','lat',90,'long',30,'radius',25);
m_elev('contour',[-3500:1000:-500],'edgecolor','b');
m_grid('xtick',12,'tickdir','out','ytick',[70 80],'linest','-');
m_coast('patch',[.7 .7 .7],'edgecolor','r');
set(gca,'Layer','top','FontSize',14,'Fontname', 'Times New Roman');

2.1.4 Colourmaps

在这里插入图片描述
相关MATLAB代码:

 % This command generates the figure
 % In each subplot title is the M_COLMAP call that 
 % generated the colourmap displayed.
 %
 % Uses of these colourmaps can be seen
 % in other maps in this gallery.

 m_colmap demo

2.2 案例

3 绘制流域特征数据

图形如下:
在这里插入图片描述
代码如下:

figure(1)
m_proj('Equidistant Cylindrical','long',[101.5 104.5],'lat',[33.9 36.1]);
m_northarrow(101.8 ,35.8 , .2, 'type',2);

m_contourf( X , Y, DataPreYear  ,'linestyle','none'); 
c = colorbar('eastoutside','ticklength',0);          % 显示色阶的颜色栏
caxis([ Pmin, Pmax ]);                                          % 设置颜色图范围
c.Label.FontSize = 12;
c.Label.FontName = 'Times New Roman';

hold on;
m_line( [ TaoheBasin(:).X ],[ TaoheBasin(:).Y ],'color','k');                     %绘制范围内的地图
m_grid('ytick',[34:0.5:37],'xtick',[101:0.5:105],'tickdir','out','linest','none','fontname','Times','fontsize',12,'linewidth',1.5);
set( get(c,'ylabel') ,'string','\fontname{宋体}降水\fontname{Times New Roman}/mm','fontsize',12);
xlabel('经度','color','k','fontsize',12,'FontWeight','bold');
ylabel('纬度','color','k','fontsize',12,'FontWeight','bold');

参考

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WW、forever

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值