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

    %% Write Line Data to KML File Using geoshape Vector
% 
%%
% Read line features into a geoshape vector.
tracks = gpxread('sample_tracks', 'Index', 1:2);
%%
% Define the name of the KML file you want to create.
filename = 'tracks.kml';
%%
% Write the line data to the file, using several optional parameters to
% specify the color and width of the lines, and their names and
% descriptions.
colors = {'red', 'green'};
description = tracks.Metadata.Name;
name = {'track1', 'track2'};

kmlwrite(filename, tracks, 'Color', colors, 'LineWidth', 2, ...
         'Description', description, 'Name', name);