Ignore:
Timestamp:
07/13/17 14:16:11 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG allow for kmz

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/kmlgroundoverlay.m

    r14244 r21782  
    2828
    2929%figure out  min and max for lat and long of this image:
    30 west=min(md.mesh.long);
    31 east=max(md.mesh.long);
    32 south=min(md.mesh.lat);
    33 north=max(md.mesh.lat);
     30if strcmpi(getfieldvalue(options,'coord',''),'latlon'),
     31        %need to plot with option 'coord','latlon'
     32        XLIM=xlim();
     33        YLIM=ylim();
     34        west=XLIM(1);
     35        east=XLIM(2);
     36        south=YLIM(1);
     37        north=YLIM(2);
     38else
     39        west=min(md.mesh.long);
     40        east=max(md.mesh.long);
     41        south=min(md.mesh.lat);
     42        north=max(md.mesh.lat);
     43end
    3444
    3545%print image at high resolution
    36 export_fig([kmlroot '/' kmlimagename],'-transparent','-zbuffer'); %zbuffer to avoid "Bad data returned by HARDCOPY. Not calling IMWRITE"
     46%export_fig([kmlroot '/' kmlimagename],'-transparent','-zbuffer'); %zbuffer to avoid "Bad data returned by HARDCOPY. Not calling IMWRITE"
     47export_fig([kmlroot '/' kmlimagename],'-transparent');
    3748%printmodel([kmlroot '/' kmlimagename],kmlimagetype,'trim','on','resolution',kmlresolution,'margin','off','frame','off');
    3849
     
    6172
    6273fclose(fid);
     74
     75if strcmpi(getfieldvalue(options,'kmz','on'),'on')
     76        disp('Converting to kmz...');
     77        system(['cat ' kmlroot '/' kmlfilename '| sed -e "s/' kmlimagename '\.png/files\/' kmlimagename '.png/g" > doc.kml']);
     78        system('mkdir files');
     79        system(['mv ' kmlroot '/' kmlimagename  '.png files/']);
     80        system(['zip -r  ' kmlfilename '.zip  files doc.kml']);
     81        system(['mv ' kmlfilename '.zip ' kmlfilename]);
     82        system(['rm -rf  files doc.kml']);
     83end
Note: See TracChangeset for help on using the changeset viewer.