在Google Earth Engine平台中,最常用的Shp、CSV导出方式如下:
Export.table.toDrive()
(1)描述:导出相应文件到google网盘
(2)代码:Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices)
变量 | 类型 | 详情 |
---|---|---|
collection | 功能集合 | 要导出的要素集合。 |
description | 字符串,可选 | 任务的人类可读名称。可以包含字母、数字、-、_(无空格)。默认值为“myExportTableTask”。 |
folder | 字符串,可选 | 导出内容将驻留的 Google 云端硬盘文件夹。注意:(a) 如果文件夹名称存在于任何级别,则输出将写入其中,(b) 如果存在重复的文件夹名称,则输出将写入最近修改的文件夹,(c) 如果文件夹名称不存在,则将在根目录下创建一个新文件夹,以及 (d) 带有分隔符的文件夹名称(例如“path/to/file”)被解释为文本字符串, 不是系统路径。默认为云端硬盘根目录。 |
fileNamePrefix | 字符串,可选 | 文件名前缀。可以包含字母、数字、-、_(无空格)。默认为说明。 |
fileFormat | 字符串,可选 | 输出格式:“CSV”(默认)、“GeoJSON”、“KML”、“KMZ”、“SHP”或“TFRecord”。 |
selectors | 列表,可选 | 要包含在导出中的属性列表;具有逗号分隔名称的单个字符串或字符串列表。 |
maxVertices | 数字,可选 | 每个几何图形的最大未切割顶点数;具有更多顶点的几何图形将被切割成小于此大小的块。 |
(3)示例
1)导出SHP
// Export the image sample feature collection to Drive as a shapefile.
Export.table.toDrive({
collection: samp,
description: 'image_sample_demo_shp',
folder: 'earth_engine_demos',
fileFormat: 'SHP'
});
2)导出CSV
// Export the image sample feature collection to Drive as a CSV file.
Export.table.toDrive({
collection: samp,
description: 'image_sample_demo_csv',
folder: 'earth_engine_demos',
fileFormat: 'CSV'
});
3)导出GeoJSON
// Export a subset of collection properties: three bands and the geometry
// as GeoJSON.
Export.table.toDrive({
collection: samp,
description: 'image_sample_demo_prop_subset',
folder: 'earth_engine_demos',
fileFormat: 'GeoJSON',
selectors: ['B8', 'B11', 'B12', '.geo']
});
此外,还可使用下列函数导出到不同位置
Export.table.toAsset();
Export.table.toAsset(collection, description, assetId, maxVertices)
Export.table.toBigQuery;
Export.table.toBigQuery(collection, description, table, overwrite, append, selectors, maxVertices)
Export.table.toCloudStorage;
Export.table.toCloudStorage(collection, description, bucket, fileNamePrefix, fileFormat, selectors, maxVertices)
Export.table.toFeatureView
Export.table.toFeatureView(collection, description, assetId, maxFeaturesPerTile, thinningStrategy, thinningRanking, zOrderRanking)
导出Shapefile(.shp)格式的矢量数据具有以下意义:
1.方便与其他GIS软件兼容:Shapefile是一种常见的GIS数据格式,几乎所有的GIS软件都支持导入和使用Shapefile。
2.保存矢量数据的几何信息:Shapefile是矢量数据的一种标准文件格式,它可以存储点、线、面等几何对象的坐标信息。
3.方便空间分析和地图制图:Shapefile格式的矢量数据可以用于进行空间分析和地图制图。通过导出为Shapefile,可以进行进一步的地理处理、统计分析、图层叠加等操作。
4.支持多种属性字段:Shapefile格式不仅可以存储几何信息,还可以包含其他属性字段。