ee.Feature.buffer

ورودی بافر شده با فاصله معین را برمی گرداند. اگر فاصله مثبت باشد، هندسه منبسط می شود و اگر فاصله منفی باشد، هندسه منقبض می شود.

استفاده برمی گرداند
Feature. buffer (distance, maxError , proj ) ویژگی
استدلال تایپ کنید جزئیات
این: feature عنصر ویژگی که هندسه آن بافر می شود.
distance شناور فاصله بافر که ممکن است منفی باشد. اگر هیچ طرح ریزی مشخص نشده باشد، واحد متر است. در غیر این صورت واحد در سیستم مختصات پروجکشن قرار دارد.
maxError ErrorMargin، پیش فرض: null حداکثر مقدار خطای قابل تحمل هنگام تقریب دایره بافر و انجام هرگونه بازپخش ضروری. اگر مشخص نشده باشد، به طور پیش فرض 1٪ از فاصله را تعیین می کند.
proj Projection، پیش فرض: null در صورت مشخص شدن، بافر در این طرح انجام می شود و فاصله به عنوان واحدهای سیستم مختصات این طرح تفسیر می شود. در غیر این صورت فاصله به صورت متر تعبیه می شود و بافر در یک سیستم مختصات کروی انجام می شود.

نمونه ها

ویرایشگر کد (جاوا اسکریپت)

// 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);

راه اندازی پایتون

برای اطلاعات در مورد API پایتون و استفاده از geemap برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.

import ee
import geemap.core as geemap

کولب (پایتون)

# 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