ee.FeatureCollection.randomPoints

نقاطی را ایجاد می کند که در هندسه داده شده به طور یکنواخت تصادفی هستند. اگر هندسه دو بعدی (چند ضلعی یا چندضلعی) باشد، نقاط برگشتی به طور یکنواخت در ناحیه داده شده از کره توزیع می شوند. اگر هندسه یک بعدی باشد (رشته های خطی)، نقاط برگشتی به طور یکنواخت در امتداد لبه های هندسه درون یابی می شوند. اگر ابعاد هندسه صفر (نقاط) باشد، نقاط برگشتی به طور یکنواخت از نقاط ورودی نمونه برداری می شوند. اگر چند هندسه بعد مختلط داده شود، نقاط از هندسه اجزا با بالاترین بعد نمونه برداری می شود.

استفاده برمی گرداند
ee.FeatureCollection.randomPoints(region, points , seed , maxError ) مجموعه ویژگی ها
استدلال تایپ کنید جزئیات
region هندسه منطقه ای برای ایجاد امتیاز.
points عدد صحیح، پیش فرض: 1000 تعداد امتیاز برای ایجاد.
seed طولانی، پیش فرض: 0 دانه ای برای مولد اعداد تصادفی.
maxError ErrorMargin، اختیاری است حداکثر مقدار خطای قابل تحمل هنگام انجام هر گونه بازطراحی ضروری.

نمونه ها

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

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

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

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

import ee
import geemap.core as geemap

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

# 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