सूचना: जिन गैर-व्यावसायिक प्रोजेक्ट के लिए Earth Engine को
15 अप्रैल, 2025 से पहले रजिस्टर किया गया है उन्हें ऐक्सेस बनाए रखने के लिए,
गैर-व्यावसायिक इस्तेमाल से जुड़ी ज़रूरी शर्तों की पुष्टि करनी होगी. अगर आपने 26 सितंबर, 2025 तक पुष्टि नहीं की, तो आपके ऐक्सेस को होल्ड पर रखा जा सकता है.
ee.Algorithms.If
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह किसी शर्त के आधार पर, अपने किसी एक इनपुट को चुनता है. यह if-then-else कंस्ट्रक्ट की तरह काम करता है.
| इस्तेमाल | रिटर्न |
|---|
ee.Algorithms.If(condition, trueCase, falseCase) | ऑब्जेक्ट |
| आर्ग्यूमेंट | टाइप | विवरण |
|---|
condition | ऑब्जेक्ट, डिफ़ॉल्ट: null | वह शर्त जिसके आधार पर यह तय किया जाता है कि कौनसा नतीजा दिखाया जाएगा. अगर यह बूलियन नहीं है, तो इसे इन नियमों के हिसाब से बूलियन के तौर पर माना जाता है:
- शून्य या NaN के बराबर संख्याएं गलत होती हैं.
- खाली स्ट्रिंग, सूचियां, और डिक्शनरी फ़ॉल्स होती हैं.
- शून्य गलत है.
- बाकी सभी बातें सही हैं.
|
trueCase | ऑब्जेक्ट, डिफ़ॉल्ट: null | अगर शर्त पूरी होती है, तो यह नतीजा दिखेगा. |
falseCase | ऑब्जेक्ट, डिफ़ॉल्ट: null | शर्त के गलत होने पर, दिखने वाला नतीजा. |
उदाहरण
कोड एडिटर (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*"
print(ee.Algorithms.If(False, '*true*', '*false*').getInfo())
# The string "*true*"
print(ee.Algorithms.If(True, '*true*', '*false*').getInfo())
# Consider using remap rather than If for tasks like numbers for classes.
print(ee.Algorithms.If(ee.String('Tree').compareTo('Tree'), 0, 1).getInfo())
print(ee.Algorithms.If(ee.String('NotTree').compareTo('Tree'), 0, 1).getInfo())
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (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"]]