www.gusucode.com > map 案例源码 matlab代码程序 > map/CreatePolygonThatSpansThe180DegreeMeridianExample.m
%% Create Polygon That Spans the 180 Degree Meridian % %% % Specify latitude and longitude coordinates that define the vertices of % the polygon. For this example, specify longitude values that span the 180 % degree meridian. lat = [0 1 1 0 0]; lon = [179.5 179.5 -179.5 -179.5 179.5]; h = 5000; alt = ones(1,length(lat)) * h; filename = 'cross180.kml'; kmlwritepolygon(filename,lat,lon,alt,'EdgeColor','r','FaceColor','w') %% % By default, the polygon contains a seam at the 180 degree mark. To remove % this seam, set |PolygonCutMeridian| to |0|. filename = 'noseam.kml'; kmlwritepolygon(filename,lat,lon,alt,'EdgeColor','r', ... 'FaceColor','w','PolygonCutMeridian',0); %% % To display a ramp without a seam, wrap the longitude values to the range % |[0 360]|, and set |CutPolygon| to |false|. Use the |Extrude| parameter to % connect the polygon to the ground for better visibility. filename = 'ramp.kml'; lon360 = wrapTo360(lon); altramp = [0 0 h h 0]; kmlwritepolygon(filename,lat,lon360,altramp,'EdgeColor','r', ... 'FaceColor','w','CutPolygons',false,'Extrude',true);