Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 如何将随机数组(无空间引用)写入geotiff格式?_Arrays_Matlab_Geospatial_Geotiff - Fatal编程技术网

Arrays 如何将随机数组(无空间引用)写入geotiff格式?

Arrays 如何将随机数组(无空间引用)写入geotiff格式?,arrays,matlab,geospatial,geotiff,Arrays,Matlab,Geospatial,Geotiff,以下MATLAB脚本在300x400数组中生成随机位置,并使用1-12的值对这些位置进行编码如何将此非空间数组转换为geotiff?我希望使用geotiff输出执行一些试验分析。任何投影坐标系(如UTM)都适用于该分析 我尝试使用以下实现,但未成功: out = geotiffwrite('C:\path\to\file\test.tif', m) 这将产生以下错误: >> test Error using geotiffwrite Too many output argument

以下MATLAB脚本在300x400数组中生成随机位置,并使用1-12的值对这些位置进行编码如何将此非空间数组转换为geotiff?我希望使用geotiff输出执行一些试验分析。任何投影坐标系(如UTM)都适用于该分析

我尝试使用以下实现,但未成功:

out = geotiffwrite('C:\path\to\file\test.tif', m)
这将产生以下错误:

>> test
Error using geotiffwrite
Too many output arguments.
编辑:

我遇到的主要问题是
geotiffwrite()
函数缺少输入。我不知道如何处理这个问题。例如,我没有
A
R
变量,因为数组没有空间引用。只要每个像素在某个地方都有地理参照,我就不在乎空间参照是什么。其目的是创建一个示例数据集,我可以使用MATLAB空间函数进行实验



我相信你的问题有一个非常简单的答案。调用
geotiffwrite
时,跳过
out
-变量。即使用:

geotiffwrite('C:\path\to\file\test.tif', m)
而不是

out = geotiffwrite('C:\path\to\file\test.tif', m)
这是使用
geotifwrite
的工作代码示例,取自。如您所见,这里没有输出变量:

basename = 'boston_ovr';
imagefile = [basename '.jpg'];
RGB = imread(imagefile);
worldfile = getworldfilename(imagefile);
R = worldfileread(worldfile, 'geographic', size(RGB));
filename = [basename '.tif'];
geotiffwrite(filename, RGB, R)
figure
usamap(RGB, R)
geoshow(filename)
更新: 根据文档,您至少需要3个输入参数。正确的语法是:

geotiffwrite(filename,A,R)
geotiffwrite(filename,X,cmap,R)
geotiffwrite(...,Name,Value)
从文件:

out = geotiffwrite('C:\path\to\file\test.tif', m)
geotiffwrite(文件名,A,R)
写入地理参考图像或数据网格,
A
,在空间上由
R
引用到输出文件
filename


请访问以了解如何使用该函数。

当我省略了
out
变量时,我收到了一个“输入参数不足”错误。太好了,谢谢您的输入。遗憾的是,关于如何将数组(无空间引用)写入geotiff格式,geotiffwrite()指令没有提供太多信息。@Aaron,为什么要这样做?您确定
geotiff
是您想要的吗?请参阅问题的更新。其目的是创建一个示例数据集,我可以使用Matlab空间函数进行实验。