ee.FeatureCollection.randomPoints

यह दिए गए ज्यामिति में, एक जैसे रैंडम पॉइंट जनरेट करता है. अगर ज्यामिति दो-आयामी (पॉलीगॉन या मल्टी-पॉलीगॉन) है, तो दिखाए गए पॉइंट, गोले के दिए गए क्षेत्र पर समान रूप से डिस्ट्रिब्यूट किए जाते हैं. अगर ज्यामिति एक-आयामी (लाइनस्ट्रिंग) है, तो दिखाए गए पॉइंट को ज्यामिति के किनारों के साथ एक जैसा इंटरपोलेशन किया जाता है. अगर ज्यामिति का डाइमेंशन शून्य (पॉइंट) है, तो इनपुट पॉइंट से, दिखाए गए पॉइंट का सैंपल एक जैसा लिया जाता है. अगर अलग-अलग डाइमेंशन की कई ज्यामितियां दी गई हैं, तो सबसे ज़्यादा डाइमेंशन वाली कॉम्पोनेंट ज्यामितियों से पॉइंट सैंपल किए जाते हैं.

इस्तेमालरिटर्न
ee.FeatureCollection.randomPoints(region, points, seed, maxError)FeatureCollection
आर्ग्यूमेंटटाइपविवरण
regionज्यामितिवह क्षेत्र जिसके लिए पॉइंट जनरेट करने हैं.
pointsपूर्णांक, डिफ़ॉल्ट: 1,000जनरेट किए जाने वाले पॉइंट की संख्या.
seedलंबी, डिफ़ॉल्ट: 0रैंडम नंबर जनरेटर के लिए सीड.
maxErrorErrorMargin, ज़रूरी नहींज़रूरी रीप्रोजेक्ट करने के दौरान, गड़बड़ी की ज़्यादा से ज़्यादा सीमा.

उदाहरण

कोड एडिटर (JavaScript)

// An ee.Geometry to constrain the geographic bounds of random points.
var region = ee.Geometry.Rectangle(
    {coords: [-113.5, 40.0, -110.2, 41.9], geodesic: false});

// Generate 50 random points with the region.
var randomPoints = ee.FeatureCollection.randomPoints(
    {region: region, points: 50, seed: 0, maxError: 1});

print('Random points from within the defined region', randomPoints);
Map.setCenter(-111.802, 40.979, 7);
Map.addLayer(region, {color: 'yellow'}, 'Region');
Map.addLayer(randomPoints, {color: 'black'}, 'Random points');

Python सेटअप

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

import ee
import geemap.core as geemap

Colab (Python)

# An ee.Geometry to constrain the geographic bounds of random points.
region = ee.Geometry.Rectangle(
    coords=[-113.5, 40.0, -110.2, 41.9], proj='EPSG:4326', geodesic=False
)

# Generate 50 random points with the region.
random_points = ee.FeatureCollection.randomPoints(
    region=region, points=50, seed=0, maxError=1
)

display('Random points from within the defined region', random_points)
m = geemap.Map()
m.set_center(-111.802, 40.979, 7)
m.add_layer(region, {'color': 'yellow'}, 'Region')
m.add_layer(random_points, {'color': 'black'}, 'Random points')
m