在 Matlab 中将 GPS 数据绘制到路线图上
Plotting GPS data onto a roadmap in Matlab
我有纬度、经度和速度数据。我想将其绘制到路线图上并获得 3D 图。路线图可以像 google 地图一样。我查看了 openstreetmap,它们也很漂亮。我想把这个情节放在一个图中。
也是看了meshc
,surfc
之后,如果下面有路线图,上面有其他数据就好了。它看起来就像旅行在地图上的投影。
我在 link here 中找到了使用 google 地图绘制图形的函数。通过使用它并在 matlab 中使用 plot3
命令,我能够绘制出速度。然而,该图是二维的,并且是从顶部看的。每当我使用 3D rotate
并旋转图形以查看速度时,google 地图就会消失。
对于那些想帮助我解决这个问题的人,我提供了一个 matlab .mat 格式的示例数据。列为:[lon lat speed]
。可在 this link 下载。
此外,如果你们中的任何人都可以指出一种方法来保存路线图数据库的至少一部分(区域),以便我们可以直接从那里调用地图,那将是非常好的。但是,如果那是不可能的,并且这些地图只能在线获取,那也没关系。
下面是我使用上述工具箱所做的代码。我只是按照 link 中的示例添加了速度作为第三个维度。
提前致谢!
load X.mat
lonlat = [];
lonlat(:,1) = X(:, 1);
lonlat(:,2) = X(:, 2);
speed = X(:, 3);
figure
plot(lonlat(:, 1), lonlat(:, 2), 'r', 'LineWidth', 2);
% Put a begin and end marker
line(lonlat(1, 1), lonlat(1, 2), 'Marker', 'o', ...
'Color', 'b', 'MarkerFaceColor', 'b', 'MarkerSize', 10);
line(lonlat(end, 1), lonlat(end, 2), 'Marker', 's', ...
'Color', 'b', 'MarkerFaceColor', 'b', 'MarkerSize', 10);
hold on
plot3(lonlat(:,1),lonlat(:,2), speed);
plot_google_map('maptype', 'roadmap');
我是 plot_google_map 的作者。我尝试使用我的功能来支持 3d 案例。您可以替换以下行:
h = image(lonVect,latVect,uniImag, 'Parent', axHandle);
与:
h = surf(lonVect,latVect,zeros(length(latVect), length(lonVect)), uniImag, 'EdgeColor', 'none', 'FaceLighting', 'flat', 'EdgeLighting', 'none', 'Parent', axHandle);
这在理论上可以满足您的要求,但会导致图形响应非常缓慢,我不确定它是否真的可用,因为 MATLAB 图形中的 3D 导航非常不自然。
如果你觉得这个模式可用,请告诉我,我会把它添加到主代码中。
我有纬度、经度和速度数据。我想将其绘制到路线图上并获得 3D 图。路线图可以像 google 地图一样。我查看了 openstreetmap,它们也很漂亮。我想把这个情节放在一个图中。
也是看了meshc
,surfc
之后,如果下面有路线图,上面有其他数据就好了。它看起来就像旅行在地图上的投影。
我在 link here 中找到了使用 google 地图绘制图形的函数。通过使用它并在 matlab 中使用 plot3
命令,我能够绘制出速度。然而,该图是二维的,并且是从顶部看的。每当我使用 3D rotate
并旋转图形以查看速度时,google 地图就会消失。
对于那些想帮助我解决这个问题的人,我提供了一个 matlab .mat 格式的示例数据。列为:[lon lat speed]
。可在 this link 下载。
此外,如果你们中的任何人都可以指出一种方法来保存路线图数据库的至少一部分(区域),以便我们可以直接从那里调用地图,那将是非常好的。但是,如果那是不可能的,并且这些地图只能在线获取,那也没关系。
下面是我使用上述工具箱所做的代码。我只是按照 link 中的示例添加了速度作为第三个维度。
提前致谢!
load X.mat
lonlat = [];
lonlat(:,1) = X(:, 1);
lonlat(:,2) = X(:, 2);
speed = X(:, 3);
figure
plot(lonlat(:, 1), lonlat(:, 2), 'r', 'LineWidth', 2);
% Put a begin and end marker
line(lonlat(1, 1), lonlat(1, 2), 'Marker', 'o', ...
'Color', 'b', 'MarkerFaceColor', 'b', 'MarkerSize', 10);
line(lonlat(end, 1), lonlat(end, 2), 'Marker', 's', ...
'Color', 'b', 'MarkerFaceColor', 'b', 'MarkerSize', 10);
hold on
plot3(lonlat(:,1),lonlat(:,2), speed);
plot_google_map('maptype', 'roadmap');
我是 plot_google_map 的作者。我尝试使用我的功能来支持 3d 案例。您可以替换以下行:
h = image(lonVect,latVect,uniImag, 'Parent', axHandle);
与:
h = surf(lonVect,latVect,zeros(length(latVect), length(lonVect)), uniImag, 'EdgeColor', 'none', 'FaceLighting', 'flat', 'EdgeLighting', 'none', 'Parent', axHandle);
这在理论上可以满足您的要求,但会导致图形响应非常缓慢,我不确定它是否真的可用,因为 MATLAB 图形中的 3D 导航非常不自然。
如果你觉得这个模式可用,请告诉我,我会把它添加到主代码中。