how to plot multiple data sets on a single geoplot?
Show older comments
I have lat and long points of multiple vehicles running a similar path, I want to run a function that plots all of these individually using geoplot. Right now im catting the lat and long points together to create a single long list of points and plotting that, the result is ok but what I really want is to plot each of the data sets individually and have them be a different color. How do I plot these individually without using concat? Below is the part of my function that just deals with plotting this map. Thanks!
P = uigetdir('C:\');
S = dir(fullfile(P,'*.csv'));
S = natsortfiles(S);
N = numel(S);
C = cell(N,1);
C1 = cell(N,1);
file_info = dir(fullfile(P, '*.csv'));
full_file_names = fullfile(P, {file_info.name});
n_files = numel(file_info);
all_data = cell(1,n_files);
for ii = 1:n_files
all_data{ii} = readtable(full_file_names{ii});
end
all_data{:}
I = cat(1, all_data{:});
finallat = I(:,6);
finallong = I(:,7);
finallat1 = finallat ./10000000;
finallong1 = finallong ./10000000;
Lat2 = table2array(finallat1);
Long2 = table2array(finallong1);
LatLong = [Lat2, Long2];
[M2, ~, ~] = rmoutliers(LatLong, 1);
Lat1 = M2(:,1);
Long1 = M2(:,2);
TrackLat = [32.62709772, 32.62016989, 32.6202918700000, 32.6272036500000, 32.6273095900000, 32.6204138600000, 32.6205358400000, 32.6274155200000, ...
32.6275214500000, 32.6206578200000, 32.6207798100000, 32.6276273800000, 32.6277333100000, 32.6209017900000, 32.6210237700000, 32.6278392400000, ...
32.6279451700000, 32.6211457500000, 32.6212677300000, 32.6280510900000, 32.6281570200000, 32.6213897100000, 32.6215116900000, 32.6282629500000, ...
32.6283688700000, 32.6216336700000, 32.6217556500000, 32.6284748000000, 32.6285807200000, 32.6218776200000, 32.6219996000000, 32.6286866500000];
TrackLong = [-117.156731500000, -117.152719800000, -117.152434100000, -117.156436400000, -117.156141400000, -117.152148300000, -117.151862600000, ...
-117.155846300000, -117.155551200000, -117.151576800000, -117.151291000000, -117.155256100000, -117.154961100000, -117.151005300000, -117.150719500000, ...
-117.154666000000, -117.154370900000, -117.150433800000, -117.150148000000, -117.154075800000, -117.153780800000, -117.149862200000, -117.149576500000, ...
-117.153485700000, -117.153190600000, -117.149290700000, -117.149005000000, -117.152895500000, -117.152600400000, -117.148719200000, -117.148433400000, -117.152305300000];
land = readgeotable("tl_2019_us_coastline.shp");
gx = geoaxes;
geoplot(gx,land)
geoplot(gx,Lat1, Long1, "LineWidth", 1);
hold on
geoplot(gx, TrackLat, TrackLong)
gx.TitleHorizontalAlignment = "center";
gx.Title.String = "All Mapped Surveys";
gx.Title.FontWeight = 'normal';
gx.Title.FontSize = 14;
legend ('Vehicle Position', 'Mission Plan')
Accepted Answer
More Answers (0)
Categories
Find more on Geographic Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!