Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
ee.FeatureCollection.draw
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Pinta una colección de vectores para la visualización. No está diseñado para usarse como entrada de otros algoritmos.
Uso | Muestra |
---|
FeatureCollection.draw(color, pointRadius, strokeWidth) | Imagen |
Argumento | Tipo | Detalles |
---|
esta: collection | FeatureCollection | Es la colección que se dibujará. |
color | String | Es una cadena hexadecimal en formato RRGGBB que especifica el color que se usará para dibujar los componentes. |
pointRadius | Número entero, valor predeterminado: 3 | Es el radio en píxeles de los marcadores de puntos. |
strokeWidth | Número entero, valor predeterminado: 2 | Es el ancho en píxeles de las líneas y los bordes de los polígonos. |
Ejemplos
Editor de código (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);
Configuración de Python
Consulta la página
Entorno de Python para obtener información sobre la API de Python y el uso de geemap
para el desarrollo interactivo.
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
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 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```"]]