公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.FeatureCollection.getDownloadURL
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
获取下载网址。当用户访问该网址时,系统会以多种格式之一下载 FeatureCollection。
返回下载网址;如果指定了回调,则返回 undefined。
用法 | 返回 |
---|
FeatureCollection.getDownloadURL(format, selectors, filename, callback) | 对象|字符串 |
参数 | 类型 | 详细信息 |
---|
此:featurecollection | FeatureCollection | FeatureCollection 实例。 |
format | 字符串,可选 | 下载格式,可以是以下值之一:“csv”“json”“geojson”“kml”“kmz”(“json”输出 GeoJSON)。如果未指定,则默认为“csv”。 |
selectors | List<String>|String,可选 | 用于选择要下载的属性的要素属性名称。如果未指定,则包含所有媒体资源。 |
filename | 字符串,可选 | 要下载的文件的名称;默认情况下,系统会附加扩展名。如果未指定,则默认为“表格”。 |
callback | 函数(可选) | 可选的回调。如果未提供,则会同步进行调用。 |
示例
代码编辑器 (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
// Get a download URL for the FeatureCollection.
var downloadUrl = fc.getDownloadURL({
format: 'CSV',
selectors: ['capacitymw', 'fuel1'],
filename: 'belgian_power_plants'
});
print('URL for downloading FeatureCollection as CSV', downloadUrl);
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
'country_lg == "Belgium"')
# Get a download URL for the FeatureCollection.
download_url = fc.getDownloadURL(**{
'filetype': 'CSV',
'selectors': ['capacitymw', 'fuel1'],
'filename': 'belgian_power_plants',
})
print('URL for downloading FeatureCollection as CSV:', download_url)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],["The `FeatureCollection.getDownloadURL` method generates a URL for downloading a FeatureCollection in various formats (CSV, JSON, GeoJSON, KML, KMZ). Users can specify the `format`, `selectors` (properties to include), and `filename`. If a `callback` function is used, the method returns `undefined`. If not, it will return the download URL synchronously. If format and filename are not specified, they default to CSV and \"table\" respectively, all properties are included.\n"],null,[]]