用matlab将地图上的点与地球曲率连接起来

时间:2018-05-25 06:47:20

标签: matlab

在matlab中,我想要一个带有一些点的地图,我希望有一条距离线连接那些也显示地球曲率的点。那可能吗?以下是一些示例代码:

landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('vperspec', 'Frame', 'on', 'Grid', 'off');
point1_lat = 25;
point1_lon = 110;
point2_lat = 45;
point2_lon = 130;
geoshow(landareas,'DefaultFaceColor',[0.9 0.9 0.9],'DefaultEdgeColor',[0.5 0.5 0.5]);
geoshow(point_lat,point_lon,'DisplayType','point','LineWidth',2, 'MarkerEdgeColor',[0.1172 0.5625 1.0000],'Marker','o', 'MarkerSize',12)
geoshow(point2_lat,point2_lon,'DisplayType','point','LineWidth',2, 'MarkerEdgeColor',[0.8594 0.0781 0.2344],'Marker','^', 'MarkerSize',12)

1 个答案:

答案 0 :(得分:2)

您可以使用“映射工具箱”中的track2函数获取该行的坐标列表,然后使用geoshow进行绘图。

例如

point1_lat = 25;
point1_lon = 110;
point2_lat = 45;
point2_lon = 130;
[lat,lon] = track2(point1_lat, point1_lon, point2_lat, point2_lon);
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('vperspec', 'Frame', 'on', 'Grid', 'off', 'Origin', [point1_lat+45, point1_lon]);
geoshow(landareas,'DefaultFaceColor',[0.9 0.9 0.9],'DefaultEdgeColor',[0.5 0.5 0.5]);
geoshow(point1_lat,point1_lon,'DisplayType','point','LineWidth',2, 'MarkerEdgeColor',[0.1172 0.5625 1.0000],'Marker','o', 'MarkerSize',12)
geoshow(point2_lat,point2_lon,'DisplayType','point','LineWidth',2, 'MarkerEdgeColor',[0.8594 0.0781 0.2344],'Marker','^', 'MarkerSize',12)
geoshow(lat,lon,'LineWidth',2,'Marker','none');

导致

enter image description here