Changeset 17004
- Timestamp:
- 12/04/13 09:11:36 (11 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/print/export_geotiff.m
r17003 r17004 1 function export_geotif (filename,ref)1 function export_geotiff(filename,ref) 2 2 %EXPORT_GEOTIF - export geotiff 3 3 % 4 % Usage: 5 % export_geotif(filename,ref); 4 6 % 5 % Usage: export_geotif('Articles/figures/figure','EPSG:3411'); 7 % This function must be called after plotmodel 8 % filname: no extension 9 % ref: UPS Greenland EPSG:3413 (http://www.spatialreference.org/ref/epsg/3413/) 10 % UPS Antarctica EPSG:3031 (http://www.spatialreference.org/ref/epsg/3031/) 6 11 % 12 % Example: 13 % export_geotif('Greenland','EPSG:3413'); 7 14 15 %Get axis limits and convert to strings 16 XLIM = xlim(); x0 = num2str(XLIM(1)); x1 = num2str(XLIM(2)); 17 YLIM = ylim(); y0 = num2str(YLIM(1)); y1 = num2str(YLIM(2)); 8 18 9 10 19 %first export the figure 20 export_fig([filename '.jpg']); 11 21 12 %call gdal on this: 13 system(sprintf('gdal_translate -a_srs %s -of GTiff -co "INTERLEAVE=PIXEL" -a_ullr %g %g %g %g %s.jpg %s.tif', ref, min(xlim), max(ylim),max(xlim),min(ylim),filename,filename)); 14 system(['rm -rf ' filename '.jpg']); 15 16 end 22 %call gdal on this: 23 system(['gdal_translate -a_srs ' ref ' -of GTiff -co "INTERLEAVE=PIXEL" -a_ullr ' x0 ' ' y1 ' ' x1 ' ' y0 ' ' filename '.jpg ' filename '.tif']); 24 system(['rm -rf ' filename '.jpg']);
Note:
See TracChangeset
for help on using the changeset viewer.