אם לא מספקים פונקציית קריאה חוזרת, הבקשה מתבצעת באופן סינכרוני. אם מציינים קריאה חוזרת (callback), הבקשה מתבצעת באופן אסינכרוני.
מומלץ להשתמש במצב אסינכרוני כי במצב סינכרוני כל הקוד האחר (לדוגמה, ממשק המשתמש של עורך הקוד של EE) מושהה בזמן ההמתנה לשרת. כדי לשלוח בקשה לא סנכרונית, עדיף להשתמש בפונקציה evaluate() במקום בפונקציה getInfo().
מחזירה את הערך המחושב של האובייקט הזה.
שימוש | החזרות |
---|---|
Dictionary.getInfo(callback) | אובייקט |
ארגומנט | סוג | פרטים |
---|---|---|
זה: computedobject | ComputedObject | המופע של ComputedObject. |
callback | פונקציה, אופציונלי | קריאה חוזרת אופציונלית. אם לא מספקים את הערך הזה, השיחה מתבצעת באופן סינכרוני. |
דוגמאות
עורך הקוד (JavaScript)
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image). var dict = ee.Dictionary({ B1: 182, B2: 219, B3: 443 }); // Request the server-side ee.Dictionary as a client-side object. print('Client-side object', dict.getInfo()); print('Using the client-side object', Object.keys(dict.getInfo()).length);
import ee import geemap.core as geemap
Colab (Python)
# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image). dic = ee.Dictionary({ 'B1': 182, 'B2': 219, 'B3': 443 }) # Request the server-side ee.Dictionary as a client-side object. print('Client-side object:', dic.getInfo()) print('Using the client-side object (e.g. fetch number of keys):', len(dic.getInfo().keys()))