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

    %% Write Geographic Data to KML File Using geostruct
% 
%%
% Read geographic data (locations of major European cities) from a shape
% file, including the names of the cities. This returns a structure.
latlim = [ 30; 75];
lonlim = [-25; 45];
cities = shaperead('worldcities.shp','UseGeoCoords', true, ...
                   'BoundingBox', [lonlim, latlim]);
%%
% Convert the structure to a geopoint vector.
cities = geopoint(cities);
%%
% Define the name of the KML file you want to create.
filename = 'European_Cities.kml';
%%
% Write the geographic data to a KML file. Use the optional Name
% parameter to include the names of the cities in the placemarks. Remove
% the default Description table.
kmlwrite(filename, cities, 'Name', cities.Name, 'Description',{});