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

5 次查看(过去 30 天)
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

回答(1 个)

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

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by