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

    %% Write Concord Orthophotos to Single GeoTIFF File
% 
%%
% Read the two adjacent orthophotos and combine them. 

% Copyright 2015 The MathWorks, Inc.

X_west = imread('concord_ortho_w.tif');
X_east = imread('concord_ortho_e.tif');
X = [X_west X_east]; 
%% 
% Construct referencing objects for the orthophotos and for their
% combination.
R_west = worldfileread('concord_ortho_w.tfw', 'planar', size(X_west));
R_east = worldfileread('concord_ortho_e.tfw', 'planar', size(X_east));
R = R_west;
R.XLimWorld = [R_west.XLimWorld(1) R_east.XLimWorld(2)];
R.RasterSize = size(X);
%%
% Write the combined image to a GeoTIFF file. Use the code number, 
% 26986, indicating the PCS_NAD83_Massachusetts Projected Coordinate 
% System.
coordRefSysCode = 26986;
filename = 'concord_ortho.tif';
geotiffwrite(filename, X, R, 'CoordRefSysCode', coordRefSysCode);
%%
% Display the  map.
figure
mapshow(filename)