www.gusucode.com > map 案例源码 matlab代码程序 > map/ReadAndDisplayWaypointsAndTrackLogExample.m
%% Read and Display Waypoints and Track Log % %% % Read waypoints and track log from the |sample_mixed.gpx| file. % Copyright 2015 The MathWorks, Inc. wpt = gpxread('sample_mixed'); trk = gpxread('sample_mixed', 'FeatureType', 'track'); %% % Compute latitude limits and longitude limits with a .05 buffer. lat = [trk.Latitude wpt.Latitude]; lon = [trk.Longitude wpt.Longitude]; [latlim, lonlim] = geoquadline(lat, lon); [latlim, lonlim] = bufgeoquad(latlim, lonlim, .05, .05); %% % Display the waypoints and the track log. fig = figure; pos = fig.Position; fig.Position = [300 300 1.25*pos(3) 1.25*pos(4)]; usamap(latlim, lonlim) geoshow(trk.Latitude, trk.Longitude); %% % Display the names of each point in a legend and mark the positions of % each point. h1 = geoshow(wpt(1)); h2 = geoshow(wpt(2), 'Marker', 'd'); names = wpt.Name; legend([h1 h2], names{:});