การดำเนินการที่เลื่อนเวลา
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เอกสารไคลเอ็นต์กับเซิร์ฟเวอร์อธิบายวิธีที่ออบเจ็กต์ที่อ้างอิงในสคริปต์อาจเป็นฝั่งไคลเอ็นต์หรือฝั่งเซิร์ฟเวอร์ สคริปต์ที่สมบูรณ์จะมีไม่เพียงออบเจ็กต์ที่คุณต้องการใช้เท่านั้น แต่ยังมีคําสั่งชุดหนึ่งที่บอก Earth Engine ว่าต้องทําอย่างไรกับออบเจ็กต์เหล่านั้น เอกสารนี้อธิบายวิธีส่งคำสั่งเหล่านั้นไปยัง Google เพื่อประมวลผล และวิธีส่งผลลัพธ์กลับไปยังไคลเอ็นต์เพื่อแสดง
เมื่อคุณเขียนสคริปต์ใน Earth Engine (JavaScript หรือ Python) โค้ดดังกล่าวจะไม่ทำงานบนเซิร์ฟเวอร์ Earth Engine ของ Google โดยตรง แต่ไลบรารีไคลเอ็นต์จะเข้ารหัสสคริปต์เป็นชุดออบเจ็กต์ 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())
คำสั่งพิมพ์แรกจะแสดงโครงสร้าง JSON ที่ไลบรารีไคลเอ็นต์ใช้อธิบายรูปภาพนั้นแก่เซิร์ฟเวอร์ที่ Google
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 จะส่งคำขอไปยัง Google และแสดงผลลัพธ์การตอบกลับ POST จากเซิร์ฟเวอร์ Google หากต้องการดูการตอบกลับในรูปแบบ 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()
ในออบเจ็กต์เซิร์ฟเวอร์จะทริกเกอร์คำขอ ระบบจะไม่ประมวลผลในเซิร์ฟเวอร์จนกว่าจะมีการขอผลลัพธ์นั้นอย่างชัดเจน โปรดทราบว่า print()
ในเครื่องมือแก้ไขโค้ด JavaScript เป็นฟังก์ชันฝั่งไคลเอ็นต์พิเศษที่รวมการเรียกใช้ getInfo()
แบบอะซิงโครนัส สำหรับ Python เราจะเรียกใช้โดยตรง
อีกตัวอย่างหนึ่งของคําขอคือการแสดงในเครื่องมือแก้ไขโค้ดหรือองค์ประกอบแผนที่ของ geemap เมื่อส่งคำขอนี้ไปยัง Google ระบบจะแสดงเฉพาะชิ้นส่วนแผนที่ที่จําเป็นในการแสดงผลลัพธ์ในเครื่องมือแก้ไขโค้ดหรือองค์ประกอบแผนที่ของ 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."]]