www.gusucode.com > map 案例源码 matlab代码程序 > map/WriteSDTSDEMTerrainDataToGeoTIFFFileExample.m
%% Write SDTS DEM terrain data to GeoTIFF File % This example shows how to write the Mount Washington SDTS DEM terrain % data to GeoTIFF. The data are referenced to Universal Transverse Mercator % (UTM), Zone 19, in the North American Datum of 1927. This corresponds to % the GeoTIFF PCS_NAD27_UTM_zone_19N code number 26719. Set the raster % interpretation to 'postings' because the data is USGS DEM. This % corresponds to the GeoTIFF raster type PixelIsPoint. %% % Read SDTS DEM data. % Copyright 2015 The MathWorks, Inc. [Z, refmat] = sdtsdemread('9129CATD.ddf'); R = refmatToMapRasterReference(refmat, size(Z), 'postings'); key.GTModelTypeGeoKey = 1; % Projected Coordinate System (PCS) key.GTRasterTypeGeoKey = 2; % PixelIsPoint key.ProjectedCSTypeGeoKey = 26719; filename = '9129.tif'; geotiffwrite(filename, Z, R, 'GeoKeyDirectoryTag', key); %% % Plot the outline of the state of New Hampshire in UTM. S = shaperead('usastatelo', 'UseGeoCoords', true, 'Selector',... {@(name) any(strcmp(name,{'New Hampshire'})), 'Name'}); proj = geotiffinfo(filename); [x, y] = projfwd(proj, [S.Lat], [S.Lon]); figure mapshow(x,y) %% % Display the GeoTIFF DEM file. hold on h = mapshow(filename, 'DisplayType', 'surface'); demcmap(get(h,'ZData'))