[Gdal-dev] .mat into 32 bit geotiff

Guillaume HUBY ghuby at geosys.com
Fri Apr 21 12:00:40 EDT 2006


> -----Message d'origine-----
> De : gdal-dev-bounces at lists.maptools.org 
> [mailto:gdal-dev-bounces at lists.maptools.org] De la part de 
> Diego Maldonado
> Envoyé : jeudi 20 avril 2006 02:22
> À : gdal-dev at lists.maptools.org
> Objet : [Gdal-dev] .mat into 32 bit geotiff
> 
> 
> 
> Hi! Could anyone tell me what is the best way to save a .mat 
> file, say, a 
> matrix created in MATLAB, as a 32-bit geotiff file?
> Thanks in advance.
> Diego
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org 
> http://lists.maptools.org/mailman/listinfo/gdal-dev
> 

You should try this in Matlab:

load <file>.mat;
imwrite(int32(yourmatrix), '<geotiff filename>.tif');

This way you write a tif file whithout meta data (except if you use the
mapping toolbox).
To georeference it, you can write a worldfile (<geotiff filename>.tfw). It
is just a textfile with 6 lines:
- Pixel size in x;
- Some rotation parameter (e.g. = 0.000000);
- Some rotation parameter (e.g. = 0.000000);
- Pixel size in y (negative);
- X upper left coordinate;
- Y upper left coordinate.

Hope that will help you ...
Guillaume.





More information about the Gdal-dev mailing list