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

5 vues (au cours des 30 derniers jours)
Jonas Müller
Jonas Müller le 9 Juil 2022
Commenté : Jonas Müller le 9 Juil 2022
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

Réponses (1)

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

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by