matlab 地理网格数据显示的三种方式 | 您所在的位置:网站首页 › matlab绘制经纬度 › matlab 地理网格数据显示的三种方式 |
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')第一种显示情况如下: 第二种显示情况如下图 第三种显示结果如下,注意到全部数据被限定在经度纬度内部,网格线内部有四个数据,这种显示模式是不准确的,不推荐使用。 应该从图中看出数据的显示顺序从图的第一行开始,但是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 实验室设备网 版权所有 |