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

5 ビュー (過去 30 日間)
Jonas Müller
Jonas Müller 2022 年 7 月 9 日
コメント済み: Jonas Müller 2022 年 7 月 9 日
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