Questions about 'geotiffwrite'

22 views (last 30 days)
rui gao
rui gao on 28 Jun 2019
Commented: Peter on 14 Nov 2019
Hello, any suggestions would be appreciated.
I use matlab to read '*.tif' (DEM), and do some data processing. After the processing, I want to output the matrix with the same format as the previous file. The code below works for some area, but for some other areas, it doesn't work, and it shows the hint below (after the code).
Does this relate to the projected coordinate system? Or should I re-project the DEM data, and process the data in matlab after that?
% input
[t,R] = geotiffread(filename);
info = geotiffinfo(filename);
geoTags = info.GeoTIFFTags.GeoKeyDirectoryTag;
% ... I did some change for the matrix, t. T denotes the modified t
% output
geotiffwrite(output_tif_name,T,R,'GeoKeyDirectoryTag',geoTags);
Error using geotiffwrite (line 257)
Expected the 'GeoKeyDirectoryTag.ProjectedCSTypeGeoKey' field value to indicate a numeric value for a known projected
coordinate system.
  2 Comments
rui gao
rui gao on 29 Jun 2019
It seems that re-projecting the DEM data (raster) is a way.
Let me check whether matlab can solve this. I don't understand the principle behind the function.
Peter
Peter on 14 Nov 2019
This type of approach used to work in previous versions of matlab, as I used it often and worked fine. But after a recent matlab update it does not work. Hopefully matlab will fix it.
In my case from the file I read, generated in Global Mapper software, I have
uas_info.GeoTIFFTags.GeoKeyDirectoryTag.ProjectedCSTypeGeoKey
ans = 6348
but then get the same error as the orginal post, when I try to write with this value.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!