(20190504-2)matlab绘制中国地图(海岸线,国界,省界)——mapshow/geoshow
参考:
【3】https://jingyan.baidu.com/article/a17d5285c8d0cb8098c8f28a.html
【4】https://jingyan.baidu.com/article/870c6fc36fdacfb03ee4be58.html
【5】https://blog.****.net/rumswell/article/details/14644231
%======================
%======
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文件可以网上自行下载,或联系本文作者。