ee.Geometry.Point.buffer

返回按给定距离缓冲的输入。如果距离为正数,则几何图形会展开;如果距离为负数,则几何图形会收缩。

用法返回
Point.buffer(distance, maxError, proj)几何图形
实参类型详细信息
this:geometry几何图形要缓冲的几何图形。
distance浮点数缓冲的距离,可以为负数。如果未指定投影,则单位为米。否则,单位为投影的坐标系。
maxErrorErrorMargin,默认值:null在近似缓冲圆和执行任何必要重投影时允许的最大误差量。如果未指定,则默认为距离的 1%。
proj投影,默认值:null如果指定了此属性,则缓冲将在此投影中执行,并且距离将被解释为此投影的坐标系的单位。否则,距离将被解释为米,并且缓冲将在球形坐标系中执行。

示例

代码编辑器 (JavaScript)

// Define a Point object.
var point = ee.Geometry.Point(-122.082, 37.42);

// Apply the buffer method to the Point object.
var pointBuffer = point.buffer({'distance': 100});

// Print the result to the console.
print('point.buffer(...) =', pointBuffer);

// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(point,
             {'color': 'black'},
             'Geometry [black]: point');
Map.addLayer(pointBuffer,
             {'color': 'red'},
             'Result [red]: point.buffer');

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请访问 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

# Define a Point object.
point = ee.Geometry.Point(-122.082, 37.42)

# Apply the buffer method to the Point object.
point_buffer = point.buffer(distance=100)

# Print the result.
display('point.buffer(...) =', point_buffer)

# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(point, {'color': 'black'}, 'Geometry [black]: point')
m.add_layer(point_buffer, {'color': 'red'}, 'Result [red]: point.buffer')
m