ee.Feature.buffer

Retorna a entrada armazenada em buffer por uma determinada distância. Se a distância for positiva, a geometria será expandida. Se for negativa, ela será contraída.

UsoRetorna
Feature.buffer(distance, maxError, proj)Recurso
ArgumentoTipoDetalhes
isso: featureElementoO recurso cuja geometria está sendo armazenada em buffer.
distancePonto flutuanteA distância do buffer, que pode ser negativa. Se nenhuma projeção for especificada, a unidade será metros. Caso contrário, a unidade estará no sistema de coordenadas da projeção.
maxErrorErrorMargin, padrão: nullA quantidade máxima de erro tolerada ao aproximar o círculo de buffer e realizar qualquer reprojeção necessária. Se não for especificado, o padrão será 1% da distância.
projProjeção, padrão: nuloSe especificado, o buffer será realizado nessa projeção, e a distância será interpretada como unidades do sistema de coordenadas dessa projeção. Caso contrário, a distância será interpretada como metros, e o buffer será realizado em um sistema de coordenadas esféricas.

Exemplos

Editor de código (JavaScript)

// Polygon feature of Serengeti National Park.
var feature = ee.FeatureCollection('WCMC/WDPA/202307/polygons')
                  .filter('ORIG_NAME == "Serengeti National Park"')
                  .first();

// Cast the resulting object as an ee.Feature so that the call to the buffer
// method is unambiguous (first() and buffer() are shared by multiple classes).
feature = ee.Feature(feature);

// Generate buffered features out and in from the original boundary.
var bufferOut = feature.buffer(10000);  // 10 km out
var bufferIn = feature.buffer(-10000);  // 10 km in

// Display the features on the map.
Map.addLayer(bufferOut, {color: 'red'}, 'Buffer out');
Map.addLayer(feature, {color: 'blue'}, 'No buffer');
Map.addLayer(bufferIn, {color: 'yellow'}, 'Buffer in');
Map.setCenter(34.8407, -2.398, 8);

Configuração do Python

Consulte a página Ambiente Python para informações sobre a API Python e como usar geemap para desenvolvimento interativo.

import ee
import geemap.core as geemap

Colab (Python)

# Polygon feature of Serengeti National Park.
feature = (
    ee.FeatureCollection('WCMC/WDPA/202307/polygons')
    .filter('ORIG_NAME == "Serengeti National Park"')
    .first()
)

# Cast the resulting object as an ee.Feature so that the call to the buffer
# method is unambiguous (first() and buffer() are shared by multiple classes).
feature = ee.Feature(feature)

# Generate buffered features out and in from the original boundary.
buffer_out = feature.buffer(10000)  # 10 km out
buffer_in = feature.buffer(-10000)  # 10 km in

# Display the features on the map.
m = geemap.Map()
m.add_layer(buffer_out, {'color': 'red'}, 'Buffer out')
m.add_layer(feature, {'color': 'blue'}, 'No buffer')
m.add_layer(buffer_in, {'color': 'yellow'}, 'Buffer in')
m.set_center(34.8407, -2.398, 8)
m