matlab自带的geoplot(lat,lon) 可以在地理坐标中绘制线条。使用 lat和lon分别指定以度为单位的经度和纬度坐标。
绘制京沪线所经城市线条:
Matlab
citys = [116.350009,39.853928; 116.683546,39.538304; 117.201509,39.085318; 116.838715,38.304676;...
116.359244,37.436492; 117.120128,36.652069; 117.086963,36.201784; 116.986212,35.581933;...
117.323759,34.810858; 117.283752,34.204224; 116.96419,33.647726; 117.388566,32.91682;...
118.333439,32.255904; 118.796624,32.059344; 119.424441,32.188141; 119.974092,31.811313;...
120.311889,31.491064; 120.642391,31.369189; 121.380857,31.112834];
lon = citys(:,1);
lat = citys(:,2);
geoplot(lat,lon,"R-o","LineWidth",2)
geobasemap streets
注意,绘制出的图长宽比例等等都是可以设定或手动调的,属于matlab绘图基本操作。
比赛时可能需要自己去找数据,在我b站的公开课有讲怎样找数据:
而如何查找经纬度数据也是绘制地理信息图时所需的技能,近期我也会出视频讲解。