ঘোষণা :
15 এপ্রিল, 2025 এর আগে আর্থ ইঞ্জিন ব্যবহার করার জন্য নিবন্ধিত সমস্ত অবাণিজ্যিক প্রকল্পগুলিকে অবশ্যই আর্থ ইঞ্জিন অ্যাক্সেস বজায় রাখার জন্য
অ-বাণিজ্যিক যোগ্যতা যাচাই করতে হবে।
ee.Algorithms.If
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি শর্তের উপর ভিত্তি করে এটির একটি ইনপুট নির্বাচন করে, একটি if-then-else নির্মাণের অনুরূপ।
ব্যবহার | রিটার্নস | ee.Algorithms.If( condition , trueCase , falseCase ) | অবজেক্ট |
যুক্তি | টাইপ | বিস্তারিত | condition | অবজেক্ট, ডিফল্ট: নাল | শর্ত যা নির্ধারণ করে কোন ফলাফল ফেরত দেওয়া হবে। এটি একটি বুলিয়ান না হলে, নিম্নলিখিত নিয়ম দ্বারা এটি একটি বুলিয়ান হিসাবে ব্যাখ্যা করা হয়:- 0 বা একটি NaN এর সমান সংখ্যা মিথ্যা।
- খালি স্ট্রিং, তালিকা এবং অভিধান মিথ্যা.
- নাল মিথ্যা।
- বাকি সব সত্য।
|
trueCase | অবজেক্ট, ডিফল্ট: নাল | শর্ত সত্য হলে ফলাফল ফেরত দিতে হবে। |
falseCase | অবজেক্ট, ডিফল্ট: নাল | শর্ত মিথ্যা হলে ফলাফল ফেরত দিতে হবে। |
উদাহরণ
কোড এডিটর (জাভাস্ক্রিপ্ট)
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));
পাইথন সেটআপ
পাইথন এপিআই এবং ইন্টারেক্টিভ ডেভেলপমেন্টের জন্য geemap
ব্যবহার করার জন্য পাইথন এনভায়রনমেন্ট পৃষ্ঠাটি দেখুন।
import ee
import geemap.core as geemap
Colab (পাইথন)
# 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 সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003e\u003ccode\u003eee.Algorithms.If\u003c/code\u003e selects one of two input values based on a given condition, similar to an if-then-else statement.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003econdition\u003c/code\u003e input determines the output, treating non-boolean values as true or false based on specific rules (e.g., 0 is false, empty strings are false).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003etrueCase\u003c/code\u003e and \u003ccode\u003efalseCase\u003c/code\u003e represent the values returned when the condition is true or false, respectively.\u003c/p\u003e\n"],["\u003cp\u003eWhile \u003ccode\u003eee.Algorithms.If\u003c/code\u003e is versatile, using \u003ccode\u003eremap\u003c/code\u003e might be more efficient for tasks like assigning numerical values to classes.\u003c/p\u003e\n"]]],["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"],null,["# ee.Algorithms.If\n\nSelects one of its inputs based on a condition, similar to an if-then-else construct.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------------------------------|---------|\n| `ee.Algorithms.If(`*condition* `, `*trueCase* `, `*falseCase*`)` | Object |\n\n| Argument | Type | Details |\n|-------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `condition` | Object, default: null | The condition that determines which result is returned. If this is not a boolean, it is interpreted as a boolean by the following rules: - Numbers that are equal to 0 or a NaN are false. - Empty strings, lists and dictionaries are false. - Null is false. - Everything else is true. |\n| `trueCase` | Object, default: null | The result to return if the condition is true. |\n| `falseCase` | Object, default: null | The result to return if the condition is false. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint(ee.Algorithms.If(false, '*true*', '*false*')); // The string \"*false*\"\nprint(ee.Algorithms.If(true, '*true*', '*false*')); // The string \"*true*\"\n\n// Consider using remap rather than If for tasks like numbers for classes.\nprint(ee.Algorithms.If(ee.String('Tree').compareTo('Tree'), 0, 1));\nprint(ee.Algorithms.If(ee.String('NotTree').compareTo('Tree'), 0, 1));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# The string \"*false*\"\nprint(ee.Algorithms.If(False, '*true*', '*false*').getInfo())\n\n# The string \"*true*\"\nprint(ee.Algorithms.If(True, '*true*', '*false*').getInfo())\n\n# Consider using remap rather than If for tasks like numbers for classes.\nprint(ee.Algorithms.If(ee.String('Tree').compareTo('Tree'), 0, 1).getInfo())\nprint(ee.Algorithms.If(ee.String('NotTree').compareTo('Tree'), 0, 1).getInfo())\n```"]]