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

    %% Write Polygon Data to KML File Using geoshape Vector
% 
%%
% Read polygon data from file, returned in a structure.
S = shaperead('usastatelo','UseGeoCoords',true);
%%
% Convert the structure to a geoshape vector.
S = geoshape(S);
%%
% Write the polygon data to a KML file, using optional parameters to
% specify the colors of the polygon faces and edges.
filename = 'usastatelo.kml';
colors = polcmap(length(S));
kmlwrite(filename,S,'Name',S.Name,'FaceColor',colors,'EdgeColor','k')