การดึงข้อมูลรูปภาพ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การรับข้อมูลรูปภาพจาก Earth Engine
หากต้องการนำข้อมูลรูปภาพจาก Earth Engine ไปยัง Google ไดรฟ์, Cloud Storage หรือชิ้นงาน Earth Engine ให้ใช้ Export
แล้ว Earth Engine จะจัดการงานทั้งหมด หากงานส่งออกมีปัญหาการปรับขนาด (เช่น ใช้เวลานานกว่า 1 วัน แสดงข้อผิดพลาดเกี่ยวกับหน่วยความจำหรือการหมดเวลา) หรือคุณคุ้นเคยกับเฟรมเวิร์กอย่าง Apache Beam, Spark หรือ Dask อยู่แล้ว คุณอาจเลือกใช้วิธีการดึงข้อมูลตามที่อธิบายไว้ที่นี่ เวิร์กโฟลว์ที่ติดตั้งใช้งานในเฟรมเวิร์กเหล่านี้สามารถปรับขนาดได้โดยใช้เครื่องมือของ Google Cloud เช่น Dataflow หรือ Dataproc
โดยเฉพาะอย่างยิ่ง คู่มือนี้จะอธิบายวิธีการส่งคําขอข้อมูลรูปภาพด้วยตนเองโดยใช้ getPixels
หรือ computePixels
"ข้อมูลรูปภาพ" ในที่นี้หมายถึงอาร์เรย์มิติข้อมูลที่มีค่าพิกเซลที่มีการปรับขนาดและการฉายที่สอดคล้องกัน ระบุภูมิภาค สเกล การฉาย และ/หรือมิติข้อมูลในคำขอ หน้า ImageFileFormat จะแสดงรายการรูปแบบเอาต์พุตที่เป็นไปได้ ปลายทางเอาต์พุต ได้แก่ Cloud Storage หรือไดเรกทอรีที่ต่อเชื่อมในเครื่อง คำขอที่ส่งด้วยตนเองจะเพิ่มความซับซ้อน แต่สามารถปรับขนาดให้เหมาะกับปริมาณงานที่มากขึ้นได้
การดึงข้อมูลรูปภาพจากชิ้นงานที่มีอยู่
ใช้ getPixels
เพื่อรับข้อมูลรูปภาพจากเนื้อหา Earth Engine ที่มีอยู่ คุณส่งรหัสชิ้นงานไปยังคําขอโดยตรง จึงไม่สามารถคํานวณพิกเซลก่อนดึงข้อมูลได้ ระบบจะแสดงผลบล็อกพิกเซลในภูมิภาค สเกล การฉาย และรูปแบบที่ระบุ ตัวอย่างต่อไปนี้แสดงการดึงข้อมูลอนุกรมเวลาของ NDVI จากคอลเล็กชันภาพ MODIS โดยใช้ getPixels
การดึงข้อมูลรูปภาพจากรูปภาพที่คำนวณแล้ว
ใช้ computePixels
เพื่อรับข้อมูลจากรูปภาพที่คำนวณแล้ว เช่น รูปภาพที่เกิดจากการนำภาพมารวมกัน เมื่อใช้
computePixels
คุณจะส่งออบเจ็กต์ ee.Image
ที่คำนวณแล้วผ่านพารามิเตอร์ expression
ระบบจะแสดงผลบล็อกพิกเซลที่คำนวณแล้วในภูมิภาค สเกล การฉายภาพ และรูปแบบที่ระบุ ตัวอย่างต่อไปนี้แสดงการดึงข้อมูลหลายช่วงสเปกตรัมจากภาพรวม Sentinel-2 ที่ไม่มีเมฆ
การส่งคำขอแบบขนานด้วยตนเอง
แม้ว่าคุณจะส่งคำขอเพื่อวัตถุประสงค์ใดก็ได้ในปริมาณเท่าใดก็ได้ แต่คุณอาจต้องส่งคำขอสำหรับเวิร์กโฟลว์ขนาดใหญ่แบบขนานกัน หากต้องการส่งคำขอจำนวนมากพร้อมกัน คุณควรใช้ปลายทางแบบปริมาณมากของ Earth Engine
จำนวนคำขอแบบขนานที่คุณมีได้จะกำหนดโดยโควต้าคำขอแบบโต้ตอบพร้อมกัน ดูรายละเอียดเกี่ยวกับกรณีที่ควรใช้ปลายทางที่มีปริมาณสูงได้ที่หน้าปริมาณสูงของ Earth Engine
หลายเธรด
คุณสามารถใช้ชุดข้อความเพื่อส่งคำขอพร้อมกันได้ แนวทางนี้แสดงอยู่ในโน้ตบุ๊กตัวอย่าง
getPixels
และ computePixels
Apache Beam
คุณสามารถใช้ไปป์ไลน์ Apache Beam เพื่อประมวลผลคำขอแบบขนานได้ ไปป์ไลน์เหล่านี้สามารถเรียกใช้แบบในเครื่องหรือเป็นงาน Google Dataflow โปรดดูตัวอย่างที่การฝึกอบรม Geo for Good นี้ หรือการสาธิตเรื่องคน โลก และ AI นี้ หรือจะใช้ไลบรารีการประมวลผลแบบขนานอื่นๆ เช่น Dask และ Apache Spark ก็ได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis guide describes alternative methods for extracting image data from Earth Engine using \u003ccode\u003egetPixels\u003c/code\u003e and \u003ccode\u003ecomputePixels\u003c/code\u003e for increased scalability beyond the standard \u003ccode\u003eExport\u003c/code\u003e function.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetPixels\u003c/code\u003e is used to retrieve raw image data from existing Earth Engine assets without any prior computation.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ecomputePixels\u003c/code\u003e allows for extracting data from computed images, such as composites, by passing an \u003ccode\u003eee.Image\u003c/code\u003e object.\u003c/p\u003e\n"],["\u003cp\u003eFor large-scale workflows, manual parallelization through multi-threading or utilizing frameworks like Apache Beam, Spark, or Dask is recommended to enhance processing efficiency.\u003c/p\u003e\n"],["\u003cp\u003eEarth Engine's high-volume endpoint and concurrent interactive request quota should be considered for managing numerous parallel requests.\u003c/p\u003e\n"]]],[],null,["# Image Data Extraction\n\nGetting image data from Earth Engine\n------------------------------------\n\n\nTo get image data from Earth Engine to Google Drive, Cloud Storage, or an Earth Engine asset,\nyou can use [`Export`](/earth-engine/guides/exporting) and the job\nis handled entirely by Earth Engine. If your export jobs have scaling issues (e.g.\ntake longer than a day, return memory or timeout errors) or you're already familiar\nwith a framework like [Apache Beam](https://beam.apache.org/),\n[Spark](https://spark.apache.org/) or [Dask](https://www.dask.org/),\nyou may prefer the data extraction methods described here. Workflows implemented in these\nframeworks can be scaled using Google Cloud tools such as\n[Dataflow](https://cloud.google.com/dataflow) or\n[Dataproc](https://cloud.google.com/dataproc).\n\n\nSpecifically, this guide describes methods for manually making requests\nfor image data using\n[`getPixels`](/earth-engine/apidocs/ee-data-getpixels) or\n[`computePixels`](/earth-engine/apidocs/ee-data-computepixels).\nHere, \"image data\" means multi-dimensional arrays of pixel values with consistent\nscale and projection. The region, scale, projection and/or dimensions are specified\nin the request. The\n[ImageFileFormat page](/earth-engine/reference/rest/v1/ImageFileFormat) lists\npossible output formats. Output destinations include Cloud Storage or any locally mounted\ndirectory. Manual requests add complexity, but can scale to larger workloads.\n\nGetting image data from existing assets\n---------------------------------------\n\nUse [`getPixels`](/earth-engine/apidocs/ee-data-getpixels)\nto get image data from existing Earth Engine assets. You\npass the asset ID directly to the request, so you can't do any computation on the pixels\nprior to extracting them. A block of pixels in the specified region, scale, projection\nand format is returned. The following example demonstrates getting time series of NDVI\nfrom a MODIS image collection using `getPixels`. \n\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_getPixels.ipynb) | [View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_getPixels.ipynb) |\n\nGetting image data from computed images\n---------------------------------------\n\n\nUse [`computePixels`](/earth-engine/apidocs/ee-data-computepixels)\nto get image data from a computed image, for example a composite. With\n[`computePixels`](/earth-engine/apidocs/ee-data-computepixels),\nyou pass a computed `ee.Image` object through the `expression`\nparameter. A block of computed pixels in the specified region, scale, projection and\nformat is returned. The following example shows getting patches of multispectral data\nfrom a cloud-free Sentinel-2 composite. \n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Run in Google Colab](https://colab.research.google.com/github/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_computePixels.ipynb) | [View source on GitHub](https://github.com/google/earthengine-community/blob/master/guides/linked/Earth_Engine_training_patches_computePixels.ipynb) |\n\nManual parallelization of requests\n----------------------------------\n\n\nThough you can make requests for any purpose in any volume, you may want to parallelize\nrequests for larger workflows. To make many such requests in parallel, you should use\nthe [Earth Engine high volume endpoint](/earth-engine/cloud/highvolume).\nThe number of parallel requests you can have is set by your\n[concurrent\ninteractive request quota](/earth-engine/guides/usage#concurrent_interactive_requests). See the [Earth\nEngine high volume page](/earth-engine/cloud/highvolume) for details on when to use the high volume endpoint.\n\n### Multi-threading\n\nYou can use threads to make concurrrent requests. This approach is demonstrated in the\n`getPixels` and `computePixels` example notebooks.\n\n### Apache Beam\n\n\nYou can use [Apache Beam](https://beam.apache.org/) pipelines to parallelize\nrequests. These pipelines can be run locally or as Google Dataflow jobs. For examples, see\n[this Geo for Good training](https://earthoutreachonair.withgoogle.com/events/geoforgood22?talk=day1-trackthree-talk2) or\n[this People, Planet and AI demonstration](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/people-and-planet-ai/land-cover-classification). Alternatively, other parallelization\nlibraries include [Dask](https://www.dask.org/) and\n[Apache Spark](https://spark.apache.org/)."]]