======================
%===输入的shp文件与代码放在一起,再运行===
figure(1)
a = worldmap('China');%描绘出中国地图的轮廓,其中的China是描绘中国地图;
worldmap([10,55],[70,140]);
%要是换做其他地图,就可以换成‘World’,或者'North Pole', 'South Pole',
'Pacific'
%======
%读取中国大陆的架构
% figure(2)
% landareas = shaperead('landareas.shp','UseGeoCoords',
true);
% geoshow (landareas, 'FaceColor', [1 1
.5],'lon',[70,140],'lat',[0,60]);
%======
%画出大陆的海岸线
% figure(3)
load coast
plotm(lat, long)
%======
%设置经纬度的间隔
setm(gca,'MLineLocation',5)%设置经度间隔为5
setm(gca,'PLineLocation',10)%设置纬度间隔为10
%设置经纬度标签的间隔
setm(gca,'MLabelLocation',10)%设置经度标签为每隔5度
setm(gca,'PLabelLocation',5)%设置纬度标签为每隔10度
grid on
%给大陆加上颜色
% land = shaperead('landareas', 'UseGeoCoords',
true);
% geoshow(a, land, 'FaceColor', [0.5 0.7 0.5])
%========
显示不带投影的地图数据
%=========
close all;
clear ;
clc;
figure(2)
fnshp_L='bou2_4l.shp';
fnshp_P='bou2_4p.shp';
LatLonLim=[70,15;140,55];%读取指定经度纬度的范围
readL=shaperead(fnshp_L,'BoundingBox',LatLonLim,'UseGeoCoords',
true);%只读一部分数据
readP=shaperead(fnshp_P,'BoundingBox',LatLonLim,'UseGeoCoords',
true);%只读一部分数据
mapshow(readL,'Color','k');
title('ChinaMap')
%=========
%============
figure(3)
%==============
fnshp_L='bou2_4l.shp';
fnshp_P='bou2_4p.shp';
readL=shaperead(fnshp_L);
readP=shaperead(fnshp_P);
%==============
% a = worldmap('China');%描绘出中国地图的轮廓,其中的China是描绘中国地图;
worldmap([15,55],[70,140]); %指定经纬度范围
geoshow(fnshp_L,'Color','k');
%=============绘制海岸线
load coast
plotm(lat, long,'Color','k') ;% plotm(lat, long)
%海岸线默认颜色为蓝色
hold on;
%==============
%设置经纬度的间隔
setm(gca,'MLineLocation',5)%设置经度间隔为5
setm(gca,'PLineLocation',10)%设置纬度间隔为10
%设置经纬度标签的间隔
setm(gca,'MLabelLocation',10)%设置经度标签为每隔5度
setm(gca,'PLabelLocation',5)%设置纬度标签为每隔10度
title('China','FontSize',14,'FontWeight','Bold')
%==================
shp文件可以网上自行下载,或联系本文作者。
————————————————
版权声明:本文为CSDN博主「sinat_32602421」的原创文章,遵循 CC 4.0 BY-SA
版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sinat_32602421/article/details/89815546
53104981