I'm working in GEE and trying to create a buffer around the coastal_saltmarsh Feature Collection imports(imported as table). However, GEE allows the use of buffer only on a Feature or Geometry(ee.Feature.buffer and ee.Geometry.buffer).

I wish to know if there is an algorithm to convert a Feature Collection to a Feature or one that can buffer a Feature Collection?

The following error message pops on running the script.

Buffer out: Layer error: Feature.buffer: Unable to use a collection in an algorithm that requires a feature or image. This may happen when trying to use a collection of collections where a collection of features is expected; use flatten, or map a function to convert inner collections to features. Use clipToCollection (instead of clip) to clip an image to a collection.

Here is the link to my GEE script.

Edited: GEE Script Below

var coastal_saltmarsh = ee.FeatureCollection("users/CarolPereira865/Saltmarsh"),
    table = ee.FeatureCollection("users/CarolPereira865/_dissolved_to_one_feature");

Map.addLayer(coastal_saltmarsh); //Layer 1     

//var merge = coastal_saltmarsh.merge(coastal_saltmarsh);
//Map.addLayer(merge); //Layer 2
//joining feature collection into one feature
//var joinedFeatures = merge.union();
//Map.addLayer(joinedFeatures) ;//Layer 3 
var Feature = ee.Feature(coastal_saltmarsh);
// Map.addLayer(Feature);

// Generate buffered features out and in from the original boundary.
 var bufferOut = Feature.buffer(1.9);  // 0.019 km out
//var bufferIn = feature.buffer(-1.9);  // 0.019 km in

// Display the features on the map.
Map.addLayer(bufferOut, {color: 'red'}, 'Buffer out');
//Map.addLayer(feature, {color: 'blue'}, 'No buffer');
//Map.addLayer(bufferIn, {color: 'yellow'}, 'Buffer in');
//Map.setCenter(34.8407, -2.398, 8);
//var geometry  =coastal_saltmarsh.geometry();


//var merge = ee.FeatureCollection.merge(coastal_saltmarsh)
  • Yes, I've just done that. Aug 15, 2022 at 21:54

1 Answer 1


You can convert the asset as geometry by .geometry converting into the geometry. Then you can add the buffer.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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