我怎么改变栅格数据的投影在MATLAB ?
46个视图(30天)
显示旧的评论
答案(2)
马修·库珀
2021年5月17日
我建议使用gdal,可以从Matlab使用系统调用命令或shell转义字符。这是一个例子,假装你想reproject数据从北美兰伯特正形圆锥投影到极北部极射赤面投影:
ras_in =“MyRaster_Lambert.tif”;
ras_out =“MyRaster_Stereo.tif”;
func =“/道路/ / gdalwarp”;
选择=“-s_srs ESRI: 102009 -t_srs EPSG: 3413 - r双线性- GTiff有限公司“TFW = YES”;
(函数选择ras_in命令=' 'ras_out];
状态=系统(命令);
你要替换的路径gdalwarp路径,它存在于你的系统。我的是/usr/local/bin/gdalwarp.您可以定制这个通过定义路径变量或添加到您的matlab搜索路径的路径。在“选择”变量,包括一些常见gdalwarp选项可能会有用,但看看gdal documention理解什么是可用的。
相同的命令使用shell转义字符看起来像这样:
! /道路/ / gdalwarp -s_srs ESRI: 102009 -t_srs EPSG: 3413 - r双线性- GTiff公司MyRaster_Lambert TFW = YES。tif MyRaster_Stereo.tif
您可以运行上面的命令在matlab中直接编辑/终端。
执行reprojection Matlab是可能的但相当困难,需要仔细考虑,超出了这个答案的范围。在其最简单的形式,你需要插入原始数据到新的坐标,但是你需要考虑适当的插值方法是什么以及如何影响原始数据之间的映射和投影的投影数据。
最后一个点。Matlab将不允许您更改的R。RasterInterpretation property between 'Cells' and 'Postings'. This has important implications for all of the other functions in the mapping toolbox. Make sure you understand which interpretation is correct. If you need to modify the interpretation before reading the data into matlab, you can use something like this:
! /道路/ / gdal_translate (AREA_OR_POINT MyRaster_Stereo =区域。tif MyRaster_Stereo_asCells.tif