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
//MERGE
//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
//CREATING BUFFER AROUND a feature
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();
//Map.addLayer(geometry)
//var merge = ee.FeatureCollection.merge(coastal_saltmarsh)