How to write lat,lon,data into geotiff with matlab?

조회 수: 17 (최근 30일)
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2020년 12월 22일
편집: Yoni Verhaegen -WE-1718- 2021년 1월 11일
I have the following (attachment):
- 2D latitude file (240x446)
- 2D longitude file (240x446)
- 2D surface elevation change data (240x446)
How can I write these into a 2D grid geotiff file? I tried the following, but it only works for lat, lon arrays (1x240 and 1x446)...
% WRITE TO GEOTIFF
R = maprasterref( ...
'RasterSize', size(Z_2017_2018), ...
'XWorldLimits', [double(min(y(:))) double(max(y(:)))], ...
'YWorldLimits', [double(min(x(:))) double(max(x(:)))], ...
'ColumnsStartFrom', 'north', ...
'RowsStartFrom', 'west', ...
'RasterInterpretation', 'postings');
key = struct( ...
'GTModelTypeGeoKey',[], ...
'GTRasterTypeGeoKey',[], ...
'ProjectedCSTypeGeoKey',[]);
key.GTModelTypeGeoKey = 1;
key.GTRasterTypeGeoKey = 2;
key.ProjectedCSTypeGeoKey = 3413; % Greenland Polar Stereographic
geotiffwrite('gmb_GrIS_2017_2018.tif',Z_2017_2018,R,'GeoKeyDirectoryTag',key)

답변 (2개)

Nitin Kapgate
Nitin Kapgate 2021년 1월 11일
You can refer to a similar question answered here. The provided solution makes use of georasterref and geotiffwrite function to write the lattitude and longitude data to the GeoTiff file.

Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2021년 1월 11일
편집: Yoni Verhaegen -WE-1718- 2021년 1월 11일
For those searching for the same question: I wasn't able to write the file into a GEOTIFF in Matlab. I resolved the problem this way:
data(:,1)=lat(:);
data(:,2)=lon(:);
data(:,3)=Z_2018_2019(:);
index=find(isnan(data(:,3)));
data(index,:)=[];
csvwrite('data_smb_2018_2019.csv',data)
In that case, I have a XYZ file that I could import in GIS software. There, I converted it into a GEOTIFF file.

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by