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

    %% Read Entire Coarse Data Set and Display Levels
% 
%%
% Read the entire coarse data set. The example uses a coarse data set
% because the toolbox includes a sample coarse data set in the
% |toolbox/map/mapdata| folder. You can use similar code to read
% intermediate, full-resolution, or high resolution GSHHS data sets.

% Copyright 2015 The MathWorks, Inc.

filename = gunzip('gshhs_c.b.gz', tempdir);
shorelines = gshhs(filename{1});
delete(filename{1})
%%
% Display data as a coastline.
figure
worldmap world
geoshow([shorelines.Lat], [shorelines.Lon])
%%
% Display each level in a different color.
levels = [shorelines.Level];
land = (levels == 1);
lake = (levels == 2);
island = (levels == 3);
figure
worldmap world
geoshow(shorelines(land),  'FaceColor', [0 1 0])
geoshow(shorelines(lake),  'FaceColor', [0 0 1])
geoshow(shorelines(island),'FaceColor', [1 1 0])