Pengumuman: Semua project nonkomersial yang terdaftar untuk menggunakan Earth Engine sebelum
15 April 2025 harus
memverifikasi kelayakan nonkomersial untuk mempertahankan akses Earth Engine.
ee.FeatureCollection.draw
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menggambar kumpulan vektor untuk visualisasi. Tidak dimaksudkan untuk digunakan sebagai input ke algoritma lain.
Penggunaan | Hasil |
---|
FeatureCollection.draw(color, pointRadius, strokeWidth) | Gambar |
Argumen | Jenis | Detail |
---|
ini: collection | FeatureCollection | Koleksi yang akan digambar. |
color | String | String hex dalam format RRGGBB yang menentukan warna yang akan digunakan untuk menggambar fitur. |
pointRadius | Bilangan bulat, default: 3 | Radius penanda titik dalam piksel. |
strokeWidth | Bilangan bulat, default: 2 | Lebar garis dan batas poligon dalam piksel. |
Contoh
Code Editor (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);
Penyiapan Python
Lihat halaman
Lingkungan Python untuk mengetahui informasi tentang Python API dan penggunaan
geemap
untuk pengembangan interaktif.
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
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 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```"]]