ee.FeatureCollection.draw

绘制用于可视化的矢量集合。不适合用作其他算法的输入。

用法返回
FeatureCollection.draw(color, pointRadius, strokeWidth)图片
参数类型详细信息
此:collectionFeatureCollection要绘制的集合。
color字符串一种格式为 RRGGBB 的十六进制字符串,用于指定绘制地图项时要使用的颜色。
pointRadius整数,默认值:3点标记的半径(以像素为单位)。
strokeWidth整数,默认值:2线条和多边形边框的宽度(以像素为单位)。

示例

代码编辑器 (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

// Paint FeatureCollection to an image for visualization.
var fcVis = fc.draw({color: '800080', pointRadius: 5, strokeWidth: 3});
Map.setCenter(4.56, 50.78, 8);
Map.addLayer(fcVis);

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"'
)

# Paint FeatureCollection to an image for visualization.
fc_vis = fc.draw(color='800080', pointRadius=5, strokeWidth=3)
m = geemap.Map()
m.set_center(4.56, 50.78, 8)
m.add_layer(fc_vis)
m