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

    %% Write Data to KML File that Includes HTML Format Tags
%  
%%
% Define a point by latitude and longitude.
lat =  42.299827;
lon = -71.350273;
%%
% Specify the description text used with the placemark, including HTML tags
% for formatting.
description = sprintf('%s<br>%s</br><br>%s</br>', ...
       '3 Apple Hill Drive', 'Natick, MA. 01760', ...
       'https://www.mathworks.com');
name = 'The MathWorks, Inc.';
iconDir = fullfile(matlabroot,'toolbox','matlab','icons');
iconFilename = fullfile(iconDir, 'matlabicon.gif');
%%
% Define the name of the KML file you want to create.
filename = 'MathWorks.kml';
%%
% Write the data to a KML file, using the |Description| parameter to
% include the names of the cities in the placemarks.
kmlwritepoint(filename, lat, lon, ...
       'Description', description, 'Name', name, 'Icon', iconFilename);