matlab 地理网格数据显示的三种方式 您所在的位置:网站首页 matlab绘制经纬度 matlab 地理网格数据显示的三种方式

matlab 地理网格数据显示的三种方式

2024-07-06 19:30| 来源: 网络整理| 查看: 265

matlab 地理网格数据显示方式 地图数据与经纬度坐标矩阵关系决定显示方式

首先确保matlab平台已经暗转Mapping Toolbox工具,它目前支持三种地理地图数据的显示,通过经纬度定位信息来决定采用何种显示方式,具体例子来自matlab帮助文档。

第一种显示方式 地图地理数据矩阵的尺寸为mxn,即是m行n列的二维数据;若经度纬度坐标信息的尺寸恰好也是mxn,那么会在相应的地理点(数据单元的中心)对数据进行地理定位。第一种显示方式的例子: Z = [ ... 1 2 3 4; ... 5 6 7 8; ... 9 10 11 12; ... 13 14 15 16]; lat = [ ... 30 30 30 30; ... 0 0 0 0; ... -30 -30 -30 -30; ... -60 -60 -60 -60]; lon = [ ... 0 30 60 90;... 0 30 60 90;... 0 30 60 90;... 0 30 60 90]; figure('Color','white','Colormap',autumn(64)) axesm('pcarree','Grid','on','Frame','on',... 'PLineLocation',30,'PLabelLocation',30) mlabel; plabel; axis off; tightmap h = geoshow(lat,lon,Z,'DisplayType','surface'); set(h,'ZData',zeros(size(Z))) ht = textm(lat(:),lon(:),num2str(Z(:)), ... 'Color','blue','FontSize',14); colorbar('southoutside')

第一种显示情况如下: 在这里插入图片描述

第二种显示方式 地图地理数据矩阵的尺寸为(m-1)x(n-1),即是m-1行n-1列的二维数据;经度纬度坐标信息的尺寸是mxn,地理数据的行的纬度以及列纬度恰好比坐标矩阵纬度小1,那么由四个相邻的纬度和经度组成的区域对应一个地图数据。请注意测试中”DisplayType“要为”texture“才能正常显示。第二种显示方式的例子: %Z3by3为地图数据二维数组 Z3by3 = [ ... 1 2 3; ... 4 5 6; ... 7 8 9]; %lat 与 lon分别为 纬度线和经度线的坐标矩阵 lat = [ ... 30 30 30 30; ... 0 0 0 0; ... -30 -30 -30 -30; ... -60 -60 -60 -60]; lon = [ ... 0 30 60 90;... 0 30 60 90;... 0 30 60 90;... 0 30 60 90]; figure('Color','white','Colormap',autumn(64)) axesm('pcarree','Grid','on','Frame','on',... 'PLineLocation',30,'PLabelLocation',30) mlabel; plabel; axis off; tightmap h = geoshow(lat,lon,Z3by3,'DisplayType','texture'); %显示每个地图数据的对应的地理位置 tlat = [ ... 15 15 15; ... -15 -15 -15; ... -45 -45 -45]; tlon = [ ... 15 45 75; ... 15 45 75; ... 15 45 74]; textm(tlat(:),tlon(:),num2str(Z3by3(:)), ... 'Color','blue','FontSize',14)

第二种显示情况如下图 在这里插入图片描述

第三种显示方式 地图地理数据矩阵的尺寸为mxn,即是m行n列的二维数据;纬度坐标矩阵的纬度都比地理数据行数小,即,纬度矩阵纬度可能是m-1,m-2,…1;而经度坐标矩阵纬度比地理数据列数小,即为n-1,n-2,…1。那么地图数据就会一起被框在最外围经度和纬度线所限定的网格内,有可能正常显示每个地图数据,也有可能扭曲全部地图数据,具体看经度坐标和纬度坐标的纬度,以下给出对应的例子第三种显示方式的例子: %Z4by4为地图数据二维数组 Z4by4 = [ ... 1 2 3 10; ... 4 5 6 10; ... 7 8 9 10;... 10 10 10 10]; %lat 与 lon分别为 纬度线和经度线的坐标矩阵 lat = [ ... 30 30 30; ... 0 0 0;... -30 -30 -30]; lon = [ ... 0 30 60;... 0 30 60;... 0 30 60]; figure('Color','white','Colormap',autumn(64)) axesm('pcarree','Grid','on','Frame','on',... 'PLineLocation',30,'PLabelLocation',30) mlabel; plabel; axis off; tightmap h = geoshow(lat,lon,Z4by4,'DisplayType','texture');

第三种显示结果如下,注意到全部数据被限定在经度纬度内部,网格线内部有四个数据,这种显示模式是不准确的,不推荐使用。 在这里插入图片描述

数据显示顺序

应该从图中看出数据的显示顺序从图的第一行开始,但是matlab默认的数据显示模式是数据从图的底部开始,这所以有不同,是因为上面的三个例子里面,规定的lat和lon矩阵已经给定,全部地图数据按照给定的lat和lon指定的顺序进行排列。 地图方格图形标准生成函数为 meshgrat,用法参考相关手册,一般使用给定的数据矩阵和数据对应的地理光栅参考对象,即 [lat, lon] = meshgrat(Z, R) constructs a graticule for use in displaying a regular data grid, Z. In typical usage, a latitude-longitude graticule is projected, and the grid is warped to the graticule using MATLAB® graphics functions. In this two-argument calling form, the graticule size is equal to the size of Z. R can be a geographic raster reference object, a referencing vector, or a referencing matrix.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有