I extract riverbanks out of Landsat images at Google Earth Engine. After the vectorization of my raster image I receive a shapefile of the riverbank with many unwanted vertices. How can I smooth the vector layer? The vectorization code is:
// This function takes vectorized polygons and extracts a polyline
var simplifyAndExtractRiverbanks = function(vectors){
// Simplify vectors
var processedVectors = vectors.map(function(f) {
var coords = f.geometry()
.simplify({maxError: exportResolutionMeters})
.coordinates();
// Buffer the geometry by a pixel to avoid rasterizing the
//boundary polygon
var bufferDistance = ee.Number(
exportResolutionMeters).multiply(-1);
return f
.setGeometry(
ee.Geometry.MultiLineString(coords)
.intersection(geometry.buffer(bufferDistance)));
});
return processedVectors;
var riverbankVector = simplifyAndExtractRiverbanks(vectors);
// Export of shapefiles
Export.table.toDrive({
collection: riverbankVector,
description: 'Extracted_Riverbank_Vector_2020',
folder: 'earthengine',
fileNamePrefix: 'riverbank2020',
fileFormat: 'SHP'});
For the exportResolutionMeters I chose 30.