Earth Engine은 공유 컴퓨팅 리소스를 보호하고 모든 사용자에게 안정적인 성능을 보장하기 위해
비상업적 할당량 등급을 도입했습니다. 비상업적 프로젝트는 기본적으로 커뮤니티 등급을 사용하지만 언제든지 프로젝트의 등급을 변경할 수 있습니다.
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ee.Algorithms.If
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
는 if-then-else 구조와 유사하게 조건에 따라 입력 중 하나를 선택합니다.
| 사용 | 반환 값 |
|---|
ee.Algorithms.If(condition, trueCase, falseCase) | 객체 |
| 인수 | 유형 | 세부정보 |
|---|
condition | 객체, 기본값: null | 반환되는 결과를 결정하는 조건입니다. 불리언이 아닌 경우 다음 규칙에 따라 불리언으로 해석됩니다. - 0 또는 NaN과 같은 숫자는 false입니다.
- 빈 문자열, 목록, 사전은 false입니다.
- Null은 false입니다.
- 그 외에는 모두 사실입니다.
|
trueCase | 객체, 기본값: null | 조건이 참인 경우 반환되는 결과입니다. |
falseCase | 객체, 기본값: null | 조건이 false인 경우 반환할 결과입니다. |
예
코드 편집기(JavaScript)
print(ee.Algorithms.If(false, '*true*', '*false*')); // The string "*false*"
print(ee.Algorithms.If(true, '*true*', '*false*')); // The string "*true*"
// Consider using remap rather than If for tasks like numbers for classes.
print(ee.Algorithms.If(ee.String('Tree').compareTo('Tree'), 0, 1));
print(ee.Algorithms.If(ee.String('NotTree').compareTo('Tree'), 0, 1));
Python 설정
Python API 및 geemap를 사용한 대화형 개발에 관한 자세한 내용은
Python 환경 페이지를 참고하세요.
import ee
import geemap.core as geemap
Colab(Python)
# The string "*false*"
display(ee.Algorithms.If(False, '*true*', '*false*'))
# The string "*true*"
display(ee.Algorithms.If(True, '*true*', '*false*'))
# Consider using remap rather than If for tasks like numbers for classes.
display(ee.Algorithms.If(ee.String('Tree').compareTo('Tree'), 0, 1))
display(ee.Algorithms.If(ee.String('NotTree').compareTo('Tree'), 0, 1))
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2026-04-20(UTC)
[null,null,["최종 업데이트: 2026-04-20(UTC)"],[],["The `ee.Algorithms.If` function selects one of two inputs based on a condition. It takes a `condition`, `trueCase`, and `falseCase`. If the `condition` is true, it returns `trueCase`; otherwise, it returns `falseCase`. Non-boolean conditions are evaluated: 0, NaN, empty collections, and null are false; everything else is true. Examples show using boolean values and string comparisons as conditions to determine the returned value. The `remap` function is suggested as an alternative for class-numbering tasks.\n"]]