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

5 Ansichten (letzte 30 Tage)
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

Antworten (1)

KSSV
KSSV am 9 Jul. 2022
You may use the following file exchange function to convert utm to degree.
  3 Kommentare
Jonas Müller
Jonas Müller am 9 Jul. 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);

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by