ee.FeatureCollection.randomPoints

지정된 도형에서 균일하게 무작위인 점을 생성합니다. 도형이 2차원 (다각형 또는 다중 다각형)인 경우 반환된 점은 구체의 지정된 영역에 균등하게 분포됩니다. 도형이 1차원 (유도선)인 경우 반환된 점은 도형의 가장자리에 따라 균일하게 보간됩니다. 도형의 차원이 0인 경우 (점) 반환된 점은 입력 점으로부터 균일하게 샘플링됩니다. 혼합된 측정기준의 다중 도형이 주어지면 가장 큰 측정기준을 가진 구성요소 도형에서 점이 샘플링됩니다.

사용반환 값
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