ee.Feature.buffer

指定された距離でバッファリングされた入力を返します。距離が正の値の場合、ジオメトリは拡大され、距離が負の値の場合、ジオメトリは縮小されます。

用途戻り値
Feature.buffer(distance, maxError, proj)機能
引数タイプ詳細
これ: feature要素ジオメトリがバッファリングされるフィーチャー。
distance浮動小数点数バッファリングの距離(負の値になる場合があります)。投影が指定されていない場合、単位はメートルです。それ以外の場合、単位は投影の座標系になります。
maxErrorErrorMargin、デフォルト: nullバッファリング円を近似して必要な再投影を行う際に許容される最大誤差。指定しない場合、デフォルトで距離の 1% になります。
projProjection、デフォルト: null指定すると、この投影でバッファリングが実行され、距離はこの投影の座標系の単位として解釈されます。それ以外の場合、距離はメートルとして解釈され、バッファリングは球座標系で実行されます。

コードエディタ(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);

Python の設定

Python API とインタラクティブな開発での geemap の使用については、 Python 環境のページをご覧ください。

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