李旭分享 http://blog.sciencenet.cn/u/lixujeremy 代码与散打爱好者!

博文

Matlab:Save as GeoTiff Format

已有 21175 次阅读 2014-11-8 15:57 |个人分类:Matlab|系统分类:科研笔记| geotiffwrite

MatlabGeoTiff文件的支持正在增强,不过还没有达到IDL的能力。

函数geotiffread[A, R] = geotiffread(filename)A返回图像矩阵,R返回地理参考。A经过一番运算以后,还是按照R地理参考进行保存,若RProjected Coordinate System投影坐标系,以代码geotiffwrite(filename,A,R)运行返回错误结果:

Error usinggeotiffwrite>validateR (line 838)

The input, R, is a map.rasterref.MapCellsReference object indicating that you are working in a projected coordinate system. If so, then specify a projected coordinate system by setting the appropriate values for the 'CoordRefSysCode' or 'GeoKeyDirectoryTag' optional parameters.

大意:以投影坐标系作为地理参考,在保存之时geotiffwrite函数中应指明

CoordRefSysCode’或‘GeoKeyDirectoryTag’,两者二选其一。

示例:mm文件在投影坐标下(UTM zone 50N),经过一番运算得到m*依然试图以原地理参考保存geotiffwrite,这时须指定CoordRefSysCodeGeoKeyDirectoryTag。

查询EPSGProjected CS Type CodesCoordRefSysCode=32650GeoKeyDirectoryTag参数信息来自函数geotiffinfo,代码分别以两种方法保存为m1m2

两种方法所得结果的地理参考完全相同,如图 1


1

附测试数据及代码(tt.rar)。

% Method 2

geotiffwrite('m2.tif', image, geo, 'GeoKeyDirectoryTag', info.GeoTIFFTags.GeoKeyDirectoryTag);



https://blog.sciencenet.cn/blog-1148346-842075.html

上一篇:Matlab:AddData函数
下一篇:Matlab:Resize Image
收藏 IP: 114.255.218.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-23 21:44

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部