I need to convert all the polygons of a FeatureCollection in editable polygons (like the polygons you can draw with the drawing tools) so I can modify each of their shape if needed. The polygons represent burned areas during 1 year of a fire season.

var table = ee.FeatureCollection("users/cecilianaval/Poligonos_SC_BAMS_2018");

//Center and display the table, zoom = 8
Map.centerObject(table, 8)
Map.addLayer(table, {}, 'BAMS_2018');

Code Editor script

  • Your script imports a personal asset but it is not shared publicly. In the future, please share the imported asset or mock up an example that reproduces the issue - thanks!. Feb 28 '20 at 19:06

You can use the ui.Map.DrawingTools module to do this.

  1. Convert the ee.FeatureCollection to an ee.Geometry.
  2. Transfer the resulting geometry to the client using evaluate().
  3. Add client-side geometry as a new layer of the drawing tools.

Note: when you convert the feature collection to a geometry, all properties of the features are lost, which limits the utility of this operation.

// Here is my feature collection.
var fc = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point(-122.0888, 37.2145)),
  ee.Feature(ee.Geometry.Point(-121.8087, 37.013)),
  ee.Feature(ee.Geometry.Point(-122.0613, 37.0306))

// Convert the feature collection to a geometry object.
var fcGeom = fc.geometry();

// Get the drawing tools.
var drawingTools = Map.drawingTools();

// Transfer the feature collection geometry to the client.
fcGeom.evaluate(function(geomList) {
  // Add the geometry as a layer of the drawing tools.
  drawingTools.addLayer([geomList], 'myGeometry', 'red');

// Center the map on the feature collection.
Map.centerObject(fc, 9);

Code Editor script

For further reference on the ui.Map.DrawingTools module, please see this guide and tutorial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.