ee.Feature.buffer

यह दी गई दूरी के हिसाब से, इनपुट को बफ़र करता है. अगर दूरी पॉज़िटिव है, तो ज्यामिति को बढ़ाया जाता है. वहीं, अगर दूरी नेगेटिव है, तो ज्यामिति को कम किया जाता है.

इस्तेमालरिटर्न
Feature.buffer(distance, maxError, proj)Feature
आर्ग्यूमेंटटाइपविवरण
this: featureएलिमेंटवह फ़ीचर जिसकी ज्यामिति को बफ़र किया जा रहा है.
distanceफ़्लोटबफ़रिंग की दूरी. यह नेगेटिव भी हो सकती है. अगर कोई प्रोजेक्शन तय नहीं किया गया है, तो यूनिट मीटर में होगी. अन्यथा, यूनिट प्रोजेक्शन के कोऑर्डिनेट सिस्टम में होगी.
maxErrorErrorMargin, डिफ़ॉल्ट: शून्यबफ़रिंग सर्कल का अनुमान लगाते समय और कोई भी ज़रूरी रीप्रोजेक्शन करते समय, ज़्यादा से ज़्यादा कितनी गड़बड़ी हो सकती है. अगर कोई जानकारी नहीं दी गई है, तो डिफ़ॉल्ट वैल्यू, दूरी का 1% होती है.
projप्रोजेक्शन, डिफ़ॉल्ट: शून्यअगर कोई प्रोजेक्शन तय किया गया है, तो बफ़रिंग इस प्रोजेक्शन में की जाएगी. साथ ही, दूरी को इस प्रोजेक्शन के कोऑर्डिनेट सिस्टम की यूनिट के तौर पर माना जाएगा. अन्यथा, दूरी को मीटर में माना जाएगा. साथ ही, बफ़रिंग स्फ़ेरिकल कोऑर्डिनेट सिस्टम में की जाएगी.

उदाहरण

कोड एडिटर (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