ee.FeatureCollection.limit

선택적으로 지정된 속성으로 먼저 정렬하여 컬렉션을 지정된 요소 수로 제한합니다.

제한된 컬렉션을 반환합니다.

사용반환 값
FeatureCollection.limit(max, property, ascending)컬렉션
인수유형세부정보
다음과 같은 경우: collection컬렉션컬렉션 인스턴스입니다.
max숫자컬렉션을 제한할 숫자입니다.
property문자열, 선택사항정렬하는 경우 정렬 기준이 되는 속성입니다.
ascending불리언, 선택사항오름차순으로 정렬할지 내림차순으로 정렬할지입니다. 기본값은 true (오름차순)입니다.

코드 편집기 (JavaScript)

// FeatureCollection of global power plants.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants');

print('First 5 features (power plants)', fc.limit(5));

print('Smallest 5 power plants by capacity in ascending order',
      fc.limit({max: 5, property: 'capacitymw'}));

print('Largest 5 power plants by capacity in descending order',
      fc.limit({max: 5, property: 'capacitymw', ascending: false}));

Python 설정

Python API 및 geemap를 사용한 대화형 개발에 관한 자세한 내용은 Python 환경 페이지를 참고하세요.

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of global power plants.
fc = ee.FeatureCollection('WRI/GPPD/power_plants')

print('First 5 features (power plants):', fc.limit(5).getInfo())

print('Smallest 5 power plants by capacity in ascending order:',
      fc.limit(**{'maximum': 5, 'opt_property': 'capacitymw'}).getInfo())

print('Largest 5 power plants by capacity in descending order:',
      fc.limit(**{'maximum': 5, 'opt_property': 'capacitymw',
                  'opt_ascending': False}).getInfo())