Change only coordinates of a georeferenced tif file from utm to degree

5 visualizaciones (últimos 30 días)
I want to open a bathymetry as tif file and only changed the UtM coordinates into degree. The problem is that in info are important information for the tif and I don't know how to put this information in geotiffwrite. So the new tif file changed more than only the coordinate transformation. Is it possible to change only the coordinates?
cheers Jonas
Code:
infilename = 'helgoland_bathy.tif';
[A,R] = readgeoraster(infilename);
info = geotiffinfo(infilename);
geoTags = info.GeoTIFFTags.GeoKeyDirectoryTag;
x =R.XWorldLimits;
y=R.YWorldLimits;
utmzone=['32 U';'32 U'];
[LatN, LonN]=utm2deg(x,y,utmzone);
R.XWorldLimits = LonN';
R.YWorldLimits =LatN';
geotiffwrite('testtiforiginal_grad.tif',A,R,'GeoKeyDirectoryTag',geoTags);
sfsdfds

Respuestas (1)

KSSV
KSSV el 9 de Jul. de 2022
You may use the following file exchange function to convert utm to degree.
  3 comentarios
Jonas Müller
Jonas Müller el 9 de Jul. de 2022
ok but how can i write all information from the old tiff to the new one. Also the infromation in the info variable? Something like this:
infilename = 'helgoland_bathy.tif';
[A,R] = readgeoraster(infilename);
info = geotiffinfo(infilename);
geoTags = info.GeoTIFFTags.GeoKeyDirectoryTag;
x =R.XWorldLimits;
y=R.YWorldLimits;
utmzone=['32 U';'32 U'];
[LatN, LonN]=utm2deg(x,y,utmzone);
R.XWorldLimits = LonN';
R.YWorldLimits =LatN';
geotiffwrite('testtiforiginal_grad.tif',A,R,info);

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by