File Exchange

image thumbnail

geotiff reader

version (2.37 KB) by Yushin Ahn
This code read geotiff file, subset in pixel (or map coordinates) capability


Updated 16 Nov 2010

View License

GEOTIFF_READ: read geotiff using imread and assign map info from infinfo.

I = GEOTIFF_READ('filename');
Reads whole images
I = GEOTIFF_READ('filename','pixel_subset', [minx maxx miny maxy]);
I = GEOTIFF_READ('filename','map_subset' , [minx maxx miny maxy]);
extract subset of the specified.

% output:
I.z, image data
I.x, x coordinate in map
I.y, y coordinate in map, misc. info

imshow(I.z, 'xdata', I.x, 'ydata', I.y);
shows image with map coordinate

% Version by Yushin Ahn
% Glacier Dynamics Laboratory,
% Byrd Polar Resear Center, Ohio State University
% Referenced enviread.m (Ian Howat)

Cite As

Yushin Ahn (2020). geotiff reader (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Anyone ever manage to fix the error Holger Hoffman noted below?
I can get past the error by commenting out this sub-section portion - but now I want to use it. Here's my error:

Index exceeds the number of array elements (31760).

Error in GEOTIFF_READ (line 129)
tmp(i-sub(3)+1,:,j) = t(R);

Lin Yan

Those "Tinfo." should be changed to "Tinfo(1)." to handle images with multiple bands.

Hi, - I get:

>> geotiffread(name)
Index exceeds matrix dimensions.

Error in geotiffread (line 120)
tmp(i-sub(3)+1,:,j) = t(R);


I have problem to display the matrix I.z with the image function from matlab. (I do not have imshow). The matrix I.z is ordered differently from the one obtained with A=imread(filename) and displayed with image(A).
I tried to change the way the file is read without not much success. Any suggestion


MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux