0

我在 Matlab 中使用将 xy 坐标和关联的 z 值写入 .txt 文件的代码。但是,我一直在将这些 .txt 文件转换为 .shp 点文件并在 ArcMap 10 中匹配 .shp 多边形文件。如何更新附加的代码段以输出 .shp 文件而不是 .txt 文件,以便我可以跳过处理步?提前致谢。

[flout] = strread(fileName, '%s', 'delimiter','.')
outfilename = [outputdir 'Coords_' char(flout(1)) '.txt'];
fid2 = fopen(outfilename, 'wt');
fprintf(fid2, 'x,y,z,\n');     % Adds x,y,z, as a header
fclose(fid2);
dlmwrite(outfilename,Listpos4,'-append','delimiter',',', 'precision', '%.5f');
4

1 回答 1

2

您实际上需要创建三个文件,而不仅仅是 .shp。还有索引 (.shx) 和属性 (.dbf) 文件。这些格式并不难(维基百科有 .shp/.shx 的基本格式),但它们都是二进制格式。

使用 ArcPy 编写 python 脚本来导入 .txt 文件并将其导出为 .shp 可能比尝试编写自己的 shapefile 更容易。

于 2012-06-20T05:28:06.967 回答