ee.FeatureCollection.distance

इससे एक DOUBLE इमेज बनती है. इसमें हर पिक्सल, कलेक्शन में मौजूद सबसे नज़दीकी पॉइंट, LineString या पॉलीगोनल बाउंड्री से, पिक्सल के सेंटर तक की दूरी को मीटर में दिखाता है.

ध्यान दें कि दूरी, पॉलीगॉन के अंदर भी मेज़र की जाती है. ज्यामिति के 'searchRadius' मीटर के दायरे में न आने वाले पिक्सल को मास्क कर दिया जाएगा.

दूरी की गणना, गोले पर की जाती है. इसलिए, हर पिक्सल और सबसे नज़दीकी ज्यामिति के बीच अक्षांश के अंतर के हिसाब से, थोड़ी गड़बड़ी हो सकती है.

इस्तेमालरिटर्न
FeatureCollection.distance(searchRadius, maxError)इमेज
आर्ग्यूमेंटटाइपविवरण
यह: featuresFeatureCollectionपिक्सेल की दूरी की गणना करने के लिए, सुविधाओं की जानकारी पाने का कलेक्शन.
searchRadiusफ़्लोट, डिफ़ॉल्ट: 100000किनारों को ढूंढने के लिए, हर पिक्सल से ज़्यादा से ज़्यादा दूरी. अगर इस दूरी के अंदर किनारे नहीं मिलते हैं, तो पिक्सल को मास्क कर दिया जाएगा.
maxErrorफ़्लोट, डिफ़ॉल्ट: 100रीप्रोजेक्शन में ज़्यादा से ज़्यादा गड़बड़ी, मीटर में. इसका इस्तेमाल सिर्फ़ तब किया जाता है, जब इनपुट पॉलीलाइन के लिए रीप्रोजेक्शन की ज़रूरत होती है. अगर '0' दिया जाता है, तो प्रोजेक्शन की ज़रूरत होने पर यह कार्रवाई पूरी नहीं होगी.

उदाहरण

कोड एडिटर (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
             .filter('country_lg == "Belgium"');

// Generate an image of distance to nearest power plant.
var distance = fc.distance({searchRadius: 50000, maxError: 50});

// Display the image and FeatureCollection on the map.
Map.setCenter(4.56, 50.78, 7);
Map.addLayer(distance, {max: 50000}, 'Distance to power plants');
Map.addLayer(fc, {color: 'red'}, 'Power plants');

Python सेटअप

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"'
)

# Generate an image of distance to nearest power plant.
distance = fc.distance(searchRadius=50000, maxError=50)

# Display the image and FeatureCollection on the map.
m = geemap.Map()
m.set_center(4.56, 50.78, 7)
m.add_layer(distance, {'max': 50000}, 'Distance to power plants')
m.add_layer(fc, {'color': 'red'}, 'Power plants')
m