(20190504-2)matlab绘制中国世界地图(海岸线,国界,
省界)——mapsho。。。
参考:
%======================
%======
figure(1)
梁博个人资料a = worldmap('China');%描绘出中国地图的轮廓,其中的China是描绘中国地图;
worldmap([10,55],[70,140]);
%要是换做其他地图,就可以换成‘World’,或者'North Pole', 'South Pole', 'Pacific'
%======
%读取中国⼤陆的架构
300个吉祥公司名字大全% 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')
%==================【20200511】=======
不需要读取shpfile⽂件,利⽤matlab⾃带的海岸线绘制
close all; clear; clc
load coast;
%绘制全球海岸线
plot(long,lat,'color',[0,0,0],'LineWidth',1);hold on;
axis equal;axis tight;grid on;
set(gca,'fontname','Time New Romans','fontsize',15,...
'tickdir','out','ticklength',[0.02,0.02],...
'gridlinestyle','-.','linewidth',0.1,...
'xtick',[-180:60:180],'ytick',[-90:30:90],...
'yticklabel',{' ','60S','30S','0','30N','60N'});
xlabel('Longitude');
ylabel('Latitude');
⾃定义绘制指定范围地图(如绘制中国及周边海岸线):
close all; clear; clc
load coast;
%绘制中国岸线
plot(long,lat,'color',[0,0,0],'LineWidth',1);hold on;
axis equal;axis tight;grid on;
set(gca,'fontname','Time New Romans','fontsize',10,...
'tickdir','out','ticklength',[0.02,0.02],...
'gridlinestyle','-.','linewidth',0.1,...独显
'xtick',[70:20:140],'ytick',[0:10:60],...
'xticklabel',{'70E ','90E','110E','130E'},...
'yticklabel',{'0 ','10N','20N','30N','40N','50N','60N'});
xlabel('Longitude');
ylabel('Latitude');
%设置只显⽰中国范围
xlim([70 140]);
ylim([0 60]);
绘制地图主要是为了叠加显⽰⾃⼰的数据:举个例⼦
close all; clear; clc
load coast;
%绘制全球海岸线
plot(long,lat,'color',[0,0,0],'LineWidth',1);hold on;
axis equal;axis tight;grid on;
set(gca,'fontname','Time New Romans','fontsize',15,...
'tickdir','out','ticklength',[0.02,0.02],...
'gridlinestyle','-.','linewidth',0.1,...
'xtick',[-180:60:180],'ytick',[-90:30:90],...
'yticklabel',{' ','60S','30S','0','30N','60N'});
xlabel('Longitude');
ylabel('Latitude');
%在地图上叠加⾃⼰的数据
plot(long(100:1000),lat(200:1100),'color','red','LineWidth',2);
%=======20201217更新=====
参考【】
绘制世界地图:
wd = worldmap('World'); setm(wd, 'Origin', [0 180 0]);                          %[0 90 0]就是中国在中间,[0 180 0]就是太平洋在中间
% Worldmap with land areas, major lakes and rivers, and cities and
% populated places
wd = worldmap('World');
setm(wd, 'Origin', [0 180 0]);%太平洋在中间
%    setm(wd, 'Origin', [0 90 0]);%中国⼤陆在中间
朴宝剑正式入伍>周成海个人资料setm(gca,'MLabelParallel','south');
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(wd, land, 'FaceColor', [0.5 0.7 0.5])
lakes = shaperead('worldlakes', 'UseGeoCoords', true);
geoshow(lakes, 'FaceColor', 'blue')
rivers = shaperead('worldrivers', 'UseGeoCoords', true);
geoshow(rivers, 'Color', 'blue')
cities = shaperead('worldcities', 'UseGeoCoords', true);
geoshow(cities, 'Marker', '.', 'Color', 'red');