www.gusucode.com > map 案例源码 matlab代码程序 > map/ReadWaypointsAndDisplayThemOverImageExample.m
%% Read Waypoints and Display Them Over Image % Read and display waypoints from the |boston_placenames.gpx| file and % overlay the points onto the |boston.tif| image. %% % Read waypoints from a GPX file. % Copyright 2015 The MathWorks, Inc. p = gpxread('boston_placenames'); %% % Read the image file. [A,R] = geotiffread('boston'); %% % Convert the length unit of the _X_ and _Y_ limits to meters for use with % the projection structure. proj = geotiffinfo('boston'); mstruct = geotiff2mstruct(proj); R.XWorldLimits = R.XWorldLimits * proj.UOMLengthInMeters; R.YWorldLimits = R.YWorldLimits * proj.UOMLengthInMeters; %% % Display the map. figure; axesm(mstruct) mapshow(A,R); %% % Display the names and positions of each point, overlaid over the image. for k=1:length(p) textm(p(k).Latitude, p(k).Longitude, p(k).Name, ... 'Color',[0 0 0],'BackgroundColor',[0.9 0.9 0],... 'Interpreter','none'); end geoshow(p); xlim(R.XWorldLimits) ylim(R.YWorldLimits)