I am trying to export the ground elevation (elev_lowestmode) values from the GEDI L2A monthly raster data set (ee.ImageCollection("LARSE/GEDI/GEDI02_A_002_MONTHLY").
I need the elevation values and the corresponding lat and long as a CSV file. I've tried many ways to export them. I am getting the elevation values but not the lat and long. The due date of my project is expiring.
This is one of the codes I tried but didn't work. I'm getting only 25 elevation values and the code for getting lat an long showed many errors. so i haven't added that in this code https://code.earthengine.google.com/c000e3f6901b63d3a3affc67dc279bc8
return im.updateMask(im.select('quality_flag').eq(1))
.updateMask(im.select('degrade_flag').eq(0));
};
var gedi = ee.ImageCollection('LARSE/GEDI/GEDI02_A_002_MONTHLY')
.map(qualityMask)
.select('elev_lowestmode');
var gediVis = {
min: 1,
max: 60,
palette: 'darkred,red,orange,green,darkgreen',
};
// Map.setCenter(-74.803466, -9.342209, 10);
Map.addLayer(gedi, gediVis, 'elev_lowestmode');
// Define a function to clip imagecollection.
var ImageCollection = ee.ImageCollection('LARSE/GEDI/GEDI02_A_002_MONTHLY')
var clip_fn = function(image) {
var ClippedImage = image.clip(geometry);
return ClippedImage;
};
// Map the function over the collection.
var ImageCol_clip = ImageCollection.map(clip_fn);
// Clip the GEDI L2 dataset to the region of interest
var clippedGedi = gedi.map(function(img) {
return img.clip(geometry);
});
// Create the digital elevation model by taking the mean of all the images
var dem = clippedGedi.mean().int();
// Create a feature collection of pixels in the dem
var pixels = dem.reduceToVectors({
geometry: geometry,
scale: 1000,
geometryType: 'polygon',
eightConnected: false,
labelProperty: 'elevation',
});
Map.addLayer(ImageCol_clip);
// Clip the GEDI L2 dataset to the region of interest
var clippedGedi = gedi.map(function(img) {
return img.clip(geometry);
});
// Export the feature collection as a CSV file
Export.table.toDrive({
collection: pixels,
description: 'ALP elevation',
selectors: ('elevation'),
fileFormat: 'CSV'
});
I know this code needs a lot of modification but this is the best i could come up with as of now.