www.gusucode.com > map 案例源码 matlab代码程序 > map/InspectAnExampleOfVectorMapDataExample.m

    %% Inspect an Example of Vector Map Data
% This example shows how to display vector map data and examine vector data
% values.
%%
% Load vector data set MAT-file of world coastlines and look at the
% variables created in the workspace. The variables |coastlat| and
% |coastlon| are vectors which together form a vector map of the coastlines
% of the world.

% Copyright 2015 The MathWorks, Inc.

load coastlines
whos
%%
% View a map of this vector data. The example presents the map using a
% Mercator projection. A map projection displays the surface of a sphere
% (or a spheroid) in a two-dimensional plane. Points on the sphere are
% geometrically projected to a plane surface. There are many possible ways
% to project a map, all of which introduce various types of distortions.
axesm mercator
framem
plotm(coastlat,coastlon)
%%
% Inspect the first 20 coordinate values of the coastline vector data set.
[coastlat(1:20) coastlon(1:20)]
%%
% To see where these coastline vector points fall on the map, plot them in
% red. As you might have deduced by looking at the first column of the
% data, there is only one continent that lies below -80 latitude:
% Antarctica.
plotm(coastlat(1:20), coastlon(1:20),'r')