ee.FeatureCollection.draw
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
วาดคอลเล็กชันเวกเตอร์เพื่อการแสดงภาพ ไม่ได้มีไว้เพื่อใช้เป็นอินพุตสำหรับอัลกอริทึมอื่นๆ
การใช้งาน | การคืนสินค้า |
---|
FeatureCollection.draw(color, pointRadius, strokeWidth) | รูปภาพ |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
ดังนี้ collection | FeatureCollection | คอลเล็กชันที่จะวาด |
color | สตริง | สตริงเลขฐานสิบหกในรูปแบบ RRGGBB ที่ระบุสีที่จะใช้ในการวาดฟีเจอร์ |
pointRadius | จำนวนเต็ม ค่าเริ่มต้น: 3 | รัศมีของเครื่องหมายจุดในหน่วยพิกเซล |
strokeWidth | จำนวนเต็ม ค่าเริ่มต้น: 2 | ความกว้างของเส้นและเส้นขอบรูปหลายเหลี่ยมเป็นพิกเซล |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (JavaScript)
// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
.filter('country_lg == "Belgium"');
// Paint FeatureCollection to an image for visualization.
var fcVis = fc.draw({color: '800080', pointRadius: 5, strokeWidth: 3});
Map.setCenter(4.56, 50.78, 8);
Map.addLayer(fcVis);
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap
เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
import ee
import geemap.core as geemap
Colab (Python)
# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
'country_lg == "Belgium"'
)
# Paint FeatureCollection to an image for visualization.
fc_vis = fc.draw(color='800080', pointRadius=5, strokeWidth=3)
m = geemap.Map()
m.set_center(4.56, 50.78, 8)
m.add_layer(fc_vis)
m
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003e\u003ccode\u003edraw()\u003c/code\u003e visualizes FeatureCollections as images for display purposes, not for algorithmic input.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts color, point radius, and stroke width parameters to customize the visualization.\u003c/p\u003e\n"],["\u003cp\u003eUse \u003ccode\u003edraw()\u003c/code\u003e with FeatureCollections to create image overlays for maps, as demonstrated with the power plants example.\u003c/p\u003e\n"]]],["The `FeatureCollection.draw()` method visualizes a feature collection as an image. It accepts a `FeatureCollection`, a `color` (hex string), `pointRadius` (integer, default 3), and `strokeWidth` (integer, default 2). The method returns an image and is intended for visualization, not algorithmic input. The examples demonstrate how to apply this method using the power plants of Belgium. It can be done in JavaScript or python (colab or not) and the visualization will be an image.\n"],null,["# ee.FeatureCollection.draw\n\nPaints a vector collection for visualization. Not intended for use as input to other algorithms.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|--------------------------------------------------------------------|---------|\n| FeatureCollection.draw`(color, `*pointRadius* `, `*strokeWidth*`)` | Image |\n\n| Argument | Type | Details |\n|--------------------|---------------------|-----------------------------------------------------------------------------------------|\n| this: `collection` | FeatureCollection | The collection to draw. |\n| `color` | String | A hex string in the format RRGGBB specifying the color to use for drawing the features. |\n| `pointRadius` | Integer, default: 3 | The radius in pixels of the point markers. |\n| `strokeWidth` | Integer, default: 2 | The width in pixels of lines and polygon borders. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// FeatureCollection of power plants in Belgium.\nvar fc = ee.FeatureCollection('WRI/GPPD/power_plants')\n .filter('country_lg == \"Belgium\"');\n\n// Paint FeatureCollection to an image for visualization.\nvar fcVis = fc.draw({color: '800080', pointRadius: 5, strokeWidth: 3});\nMap.setCenter(4.56, 50.78, 8);\nMap.addLayer(fcVis);\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\n# FeatureCollection of power plants in Belgium.\nfc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"'\n)\n\n# Paint FeatureCollection to an image for visualization.\nfc_vis = fc.draw(color='800080', pointRadius=5, strokeWidth=3)\nm = geemap.Map()\nm.set_center(4.56, 50.78, 8)\nm.add_layer(fc_vis)\nm\n```"]]