ee.initialize
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Initialisez la bibliothèque. Si cette méthode n'a pas été appelée au moment où un constructeur d'objet est utilisé, elle le sera alors. Si cette méthode est appelée une deuxième fois avec une baseurl ou une tileurl différente, elle ne désinitialise pas, par exemple, les algorithmes précédemment chargés, mais les écrase et permet de pointer vers d'autres serveurs.
Si initialize() est appelé en mode asynchrone pour la première fois (en transmettant un rappel de réussite), tous les futurs appels en mode asynchrone ajouteront leurs rappels à une file d'attente et tous les rappels seront exécutés ensemble.
Si un appel en mode synchrone est effectué après un certain nombre d'appels asynchrones, il bloquera et exécutera tous les rappels fournis précédemment avant de renvoyer une réponse.
Dans la plupart des cas, un jeton d'autorisation doit être défini avant l'initialisation de la bibliothèque, soit avec ee.data.authorize(), soit avec ee.data.setAuthToken().
En Python, cette méthode est nommée ee.Initialize, avec un I majuscule. Notez que certains paramètres diffèrent entre JavaScript et Python. En plus de opt_url et project ci-dessous, Python est également compatible avec les éléments suivants : credentials (un objet google.oauth2.Credentials ou "persistent" pour utiliser les identifiants stockés (par défaut)), http_transport (un client httplib2.Http).
Utilisation | Renvoie |
---|
ee.initialize(baseurl, tileurl, successCallback, errorCallback, xsrfToken, project) | |
Argument | Type | Détails |
---|
baseurl | Chaîne, facultative | Point de terminaison de l'API REST Earth Engine.
(Nom de l'argument Python : opt_url) |
tileurl | Chaîne, facultative | Point de terminaison REST des tuiles Earth Engine. Ce champ est facultatif et la valeur par défaut est "baseurl". (JavaScript uniquement) |
successCallback | Fonction, facultatif | Rappel facultatif à appeler en cas d'initialisation réussie. Si aucune valeur n'est spécifiée, l'initialisation est effectuée de manière synchrone. (JavaScript uniquement) |
errorCallback | Fonction, facultatif | Rappel facultatif à appeler avec une erreur si l'initialisation échoue. (JavaScript uniquement) |
xsrfToken | Chaîne, facultative | Chaîne à transmettre dans le paramètre "xsrfToken" des XHR de l'API EE. (JavaScript uniquement) |
project | Chaîne, facultative | Numéro ou ID de projet client facultatif à utiliser lors des appels d'API. (Nom de l'argument Python : project) |
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eee.initialize()\u003c/code\u003e function initializes the Earth Engine library, setting the API endpoint and optional tile server.\u003c/p\u003e\n"],["\u003cp\u003eInitialization can be performed synchronously or asynchronously with success and error callbacks.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization should typically be handled before initialization using \u003ccode\u003eee.data.authorize()\u003c/code\u003e or \u003ccode\u003eee.data.setAuthToken()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eee.initialize()\u003c/code\u003e offers parameters for customization, like base URL, tile URL, and project ID.\u003c/p\u003e\n"],["\u003cp\u003eThe Python equivalent is \u003ccode\u003eee.Initialize()\u003c/code\u003e, with minor parameter differences compared to JavaScript.\u003c/p\u003e\n"]]],[],null,["# ee.initialize\n\n\u003cbr /\u003e\n\nInitialize the library. If this hasn't been called by the time any object constructor is used, it will be called then. If this is called a second time with a different baseurl or tileurl, this doesn't do an un-initialization of e.g.: the previously loaded Algorithms, but will overwrite them and let point at alternate servers.\n\n\u003cbr /\u003e\n\nIf initialize() is first called in asynchronous mode (by passing a success callback), any future asynchronous mode calls will add their callbacks to a queue and all the callbacks will be run together.\n\nIf a synchronous mode call is made after any number of asynchronous calls, it will block and execute all the previously supplied callbacks before returning.\n\nIn most cases, an authorization token should be set before the library is initialized, either with ee.data.authorize() or ee.data.setAuthToken().\n\nIn Python, this method is named ee.Initialize, with a capital I. Note that some parameters differ between JavaScript and Python. In addition to opt_url and project below, Python also supports: credentials - a google.oauth2.Credentials object or 'persistent' to use stored credentials (the default); http_transport - a httplib2.Http client.\n\n| Usage | Returns |\n|--------------------------------------------------------------------------------------------------------------------|---------|\n| `ee.initialize(`*baseurl* `, `*tileurl* `, `*successCallback* `, `*errorCallback* `, `*xsrfToken* `, `*project*`)` | |\n\n| Argument | Type | Details |\n|-------------------|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `baseurl` | String, optional | The Earth Engine REST API endpoint. (Python argument name: opt_url) |\n| `tileurl` | String, optional | The Earth Engine REST tile endpoint, this is optional and defaults to baseurl. (JavaScript only) |\n| `successCallback` | Function, optional | An optional callback to be invoked when the initialization is successful. If not provided, the initialization is done synchronously. (JavaScript only) |\n| `errorCallback` | Function, optional | An optional callback to be invoked with an error if the initialization fails. (JavaScript only) |\n| `xsrfToken` | String, optional | A string to pass in the \"xsrfToken\" parameter of EE API XHRs. (JavaScript only) |\n| `project` | String, optional | Optional client project ID or number to use when making API calls. (Python argument name: project) |"]]