Stacking several Geo-tiff into 3d array.

4 views (last 30 days)
Justin
Justin on 9 Oct 2014
Commented: Chad Greene on 13 Oct 2014
I have several geotiff from different sources, and I cant figure out how to stack the data properly based on georeferences. I'm hoping someone will point me in right direction, especially which function to use.
I have an access to mapping toolbox.

Answers (1)

Chad Greene
Chad Greene on 13 Oct 2014
Can you explain the step you're getting hung up on? If all of your images are the same size and resolution with corners pinned in the same places, it may be as simple as
A(:,:,1) = geotiffread('filename1.tif');
A(:,:,2) = geotiffread('filename2.tif');
.
.
.
A(:,:,N) = geotiffread('filenameN.tif');
That could even be done in a loop if you want to stack several images.
If you have multiple images that only partly overlap,, Aslak Grinsted's geotiffreadregion may be helpful. I have written a slightly more user-friendly version of geotiffreadregion with full documentation which I'd be happy to send you if you're interested. A third option, if you know your grid points in map x/y or lat/lon, is to use geotiffinterp.
  2 Comments
Justin
Justin on 13 Oct 2014
Edited: Justin on 13 Oct 2014
Some geotiffs are sightly rotated and at different zoom level. The data wont align up if I stack them like you suggested. I am looking for a way to assign coordinate for each pixel data then re-project it onto "global map" so I can stack them up and do some spatial analysis.
Hopefully this makes some more sense, since georeferenced data handling is new to me. I'm still learning.
Chad Greene
Chad Greene on 13 Oct 2014
I see. You may be able to load one image, then get the lat/lon of each pixel in that image with pix2latlon, then get values for those those lat/lons for every other image using geotiffinterp.

Sign in to comment.

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!