- 一种 ee.Geometry。
- GeoJSON 几何图形。
- GeoJSON 要素。
- 计算对象:如果指定了属性,则重新解释为几何图形;如果未指定属性,则重新解释为要素。
用法 | 返回 |
---|---|
ee.Feature(geometry, properties) | 功能 |
参数 | 类型 | 详细信息 |
---|---|---|
geometry | ComputedObject|Feature|Geometry|Object | 几何图形或地图项。 |
properties | 对象,可选 | 元数据属性的字典。如果第一个参数是 Feature(而非几何图形),则不使用此参数。 |
示例
代码编辑器 (JavaScript)
// Create the simplest possible feature. print(ee.Feature(null)); // Empty feature // Demonstrate how to set a feature's id. print(ee.Feature(null, {'id': 'yada'}).id()); // null print(ee.Feature(null, {'system:index': 'abc123'}).id()); // abc123 // The simplest possible feature with a geometry. var feature = ee.Feature(ee.Geometry.Point([-114.318, 38.985])); Map.addLayer(feature); Map.centerObject(feature, 10);
import ee import geemap.core as geemap
Colab (Python)
# Create the simplest possible feature. display(ee.Feature(None)) # Empty feature # Demonstrate how to set a feature's id. display(ee.Feature(None, {'id': 'yada'}).id()) # None display(ee.Feature(None, {'system:index': 'abc123'}).id()) # abc123 # The simplest possible feature with a geometry. feature = ee.Feature(ee.Geometry.Point([-114.318, 38.985])) m = geemap.Map() m.add_layer(feature) m.center_object(feature, 10) m