How can I write a GeoTiff file with corresponding coordinates?

조회 수: 39(최근 30일)
Yoni Verhaegen -WE-1718-
Yoni Verhaegen -WE-1718- 2019년 8월 2일
답변: Ehsan Jalilvand 2019년 10월 24일
I have the following:
  • a latitude array 'lat' (1x1128 single)
  • a longitude array 'lon' (1x968)
  • a value matrix 'value' (1128x968 double)
How can I write this into a GeoTiff file so that values have the corresponding coordinates of lat and lon, i.e. a lat,lon,value grid?

채택된 답변

Ehsan Jalilvand
Ehsan Jalilvand 2019년 10월 24일
First use the following lines to create the referencing matrix (R):
% load the value matrix and lat and lon arrays
value = Value_matrix;
lat = lat_array;
lon = lon_array;
% Create the referencing matrix (R)
R = georasterref('RasterSize',size(value), ...
'LatitudeLimits',[min(lat) max(lat)],'LongitudeLimits',[min(lon) max(lon)]);
then choose a name for your file and Write your GeoTIFF file:
filename = datafile('value.tif');

추가 답변(1개)

Sai Sri Pathuri
Sai Sri Pathuri 2019년 8월 6일
You may use geotiffwrite function to write the data into GeoTIFF file. To have a grid of latitude, longitude and value data, first combine the matrices into a single matrix with first element as 0, latitudes in first row, longitudes in first column, remaining rows and columns are occupied by value matrix.
grid_matrix(2:969,:)=[lon',value']; %Take transpose of lon and value matrices
Then write into GeoTIFF file using geotiffwrite function
Refer the following links for documentation

Community Treasure Hunt

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

Start Hunting!

Translated by