お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
遅延実行
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
クライアントとサーバーのドキュメントでは、スクリプトで参照されるオブジェクトをクライアントサイドまたはサーバーサイドにする方法について説明しています。完全なスクリプトには、使用するオブジェクトだけでなく、それらをどのように処理するかを Earth Engine に指示する一連の手順も含まれています。このドキュメントでは、これらの指示が Google に送信されて処理される方法と、結果がクライアントに送り返されて表示される仕組みについて説明します。
Earth Engine でスクリプト(JavaScript または Python)を記述しても、そのコードは Google の Earth Engine サーバーで直接実行されません。代わりに、クライアント ライブラリがスクリプトを一連の JSON オブジェクトにエンコードし、オブジェクトを Google に送信してレスポンスを待ちます。各オブジェクトは、特定の出力(クライアントに表示する画像など)を取得するために必要な一連のオペレーションを表します。たとえば、次のコードについて考えてみます。
コードエディタ(JavaScript)
var image = ee.Image('CGIAR/SRTM90_V4');
var operation = image.add(10);
print(operation.toString());
print(operation);
Python の設定
Python API とインタラクティブな開発で geemap
を使用する方法については、
Python 環境のページをご覧ください。
import ee
import geemap.core as geemap
Colab(Python)
image = ee.Image('CGIAR/SRTM90_V4')
operation = image.add(10)
print(operation)
print(operation.getInfo())
最初の print ステートメントは、クライアント ライブラリが Google のサーバーにその画像を記述するために使用する JSON 構造を出力します。
ee.Image({
"type": "Invocation",
"arguments": {
"image1": {
"type": "Invocation",
"arguments": {
"id": "CGIAR/SRTM90_V4"
},
"functionName": "Image.load"
},
"image2": {
"type": "Invocation",
"arguments": {
"value": 10
},
"functionName": "Image.constant"
}
},
"functionName": "Image.add"
})
2 番目の print ステートメントは、リクエストを Google に送信し、Google サーバーからの POST レスポンスを出力します。レスポンスの JSON をすべて表示するには、コンソールの右側にある、出力されたオブジェクトの横にある JSON
リンクをクリックします。
{
"type": "Image",
"bands": [
{
"id": "elevation",
"data_type": {
"type": "PixelType",
"precision": "int",
"min": -32758,
"max": 32777
},
"crs": "EPSG:4326",
"crs_transform": [
0.0008333333535119891,
0,
-180,
0,
-0.0008333333535119891,
60
]
}
]
}
リクエストがない限り、Google に送信されて処理されることはありません。この例では、サーバー オブジェクトに対する getInfo()
呼び出しの結果を出力すると、リクエストがトリガーされます。その結果が明示的にリクエストされるまで、サーバーで処理は行われません。JavaScript Code Editor の print()
は、非同期の getInfo()
呼び出しをラップする特別なクライアントサイド関数です。Python の場合は、直接呼び出します。
何かをリクエストする別の例として、Code Editor または geemap 地図要素に表示する方法があります。このリクエストが Google に送信されると、Code Editor または geemap 地図要素に結果を表示するために必要なタイルのみが返されます。具体的には、地図の位置とズームレベルによって、どのデータが処理され、地図に表示できる画像に変換されるかが決まります。パンまたはズームすると、他のタイルは遅延計算されます。このオンデマンド システムでは、並列処理と効率的な処理が可能になりますが、地図に表示される画像は、地図のズームレベルと地図境界の位置に応じて異なる入力から生成されます。計算への入力がリクエストからどのように決定されるかについては、スケールのドキュメントをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[[["\u003cp\u003eEarth Engine code execution involves encoding scripts into JSON objects by the client library and sending them to Google servers for processing, with results returned to the client for display.\u003c/p\u003e\n"],["\u003cp\u003eProcessing on Google servers is triggered only when there's an explicit request, such as printing an object's information or displaying it on a map.\u003c/p\u003e\n"],["\u003cp\u003eEarth Engine employs a lazy processing system where only the necessary data for the current view is computed, improving efficiency and allowing for parallelization.\u003c/p\u003e\n"],["\u003cp\u003eThe displayed image on the map depends on the zoom level and map bounds, resulting in different inputs being used for computation at various scales.\u003c/p\u003e\n"],["\u003cp\u003eFurther details on how inputs are determined for computations based on requests can be found in the Scale documentation.\u003c/p\u003e\n"]]],[],null,["# Deferred Execution\n\nThe [Client vs. Server](/earth-engine/guides/client_server) doc describes how objects referenced\nin your script can be either client-side or server-side. The complete script contains\nnot only the objects you want to use, but also a set of instructions that tell Earth Engine\nwhat to do with them. This doc describes how those instructions are sent to Google for\nprocessing and how the results are sent back to the client for display.\n\nWhen you write a script in Earth Engine (either JavaScript or Python), that code does\nNOT run directly on Earth Engine servers at Google. Instead, the\n[client library](https://github.com/google/earthengine-api) encodes the\nscript into a set of [JSON](http://www.json.org/) objects, sends the objects\nto Google and waits for a response. Each object represents a set of operations\nrequired to get a particular output, an image to display in the client, for example.\nConsider the following code:\n\n### Code Editor (JavaScript)\n\n```javascript\nvar image = ee.Image('CGIAR/SRTM90_V4');\nvar operation = image.add(10);\nprint(operation.toString());\nprint(operation);\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\nimage = ee.Image('CGIAR/SRTM90_V4')\noperation = image.add(10)\nprint(operation)\nprint(operation.getInfo())\n```\n\nThe first print statement will output the JSON structure that the client library\nuses to describe that image to the server at Google: \n\n```gdscript\nee.Image({\n \"type\": \"Invocation\",\n \"arguments\": {\n \"image1\": {\n \"type\": \"Invocation\",\n \"arguments\": {\n \"id\": \"CGIAR/SRTM90_V4\"\n },\n \"functionName\": \"Image.load\"\n },\n \"image2\": {\n \"type\": \"Invocation\",\n \"arguments\": {\n \"value\": 10\n },\n \"functionName\": \"Image.constant\"\n }\n },\n \"functionName\": \"Image.add\"\n})\n \n```\n\nThe second print statement will send the request to Google and output the\n[POST](https://en.wikipedia.org/wiki/POST_(HTTP)) response from Google\nservers. To see the response in all its JSON glory, click the `JSON` link\non the right side of the console, next to the printed object: \n\n```carbon\n{\n \"type\": \"Image\",\n \"bands\": [\n {\n \"id\": \"elevation\",\n \"data_type\": {\n \"type\": \"PixelType\",\n \"precision\": \"int\",\n \"min\": -32758,\n \"max\": 32777\n },\n \"crs\": \"EPSG:4326\",\n \"crs_transform\": [\n 0.0008333333535119891,\n 0,\n -180,\n 0,\n -0.0008333333535119891,\n 60\n ]\n }\n ]\n}\n \n```\n\nNothing is sent to Google for processing until there is a request for it. In this\nexample, printing the result of a `getInfo()` call on a server object triggers a\nrequest. No processing is done on the server until that result is explicitly\nrequested. Note that `print()` in the JavaScript Code Editor is a special\nclient-side function that wraps an asynchronous `getInfo()` call; for Python we\ncall it directly.\n\nAnother example of requesting something is displaying it on the Code Editor or geemap map\nelement. When this request is sent to Google, only the tiles\nnecessary to display the result in the Code Editor or geemap map element are returned.\nSpecifically, the position of the map and the zoom level determine which data get processed\nand turned into images that can be displayed on the map. If you pan or zoom, note that\nother tiles are computed lazily. This on-demand system allows for parallelization and\nefficient processing, but also means that the image displayed on the map is produced from\ndifferent inputs depending on the zoom level and location of the map bounds. Learn more about\nhow inputs to a computation are determined from the request in the\n[Scale](/earth-engine/guides/scale) doc."]]