I have an image with land surface temperatures (LST) and polygons with administrative boundaries (adm3) and want to extract and export spatial statistics as a shapefile of said polyogns so that each feature contains the average raster value.
This works for the mean reducer
// Apply mean reducer
var means = LST.reduceRegions({
collection: adm3,
scale: 30,
reducer: ee.Reducer.mean()
});
// Create empty feature
var feature = ee.Feature(null, means);
// Wrap the Feature in a FeatureCollection for export.
var featureCollection = ee.FeatureCollection([feature]);
// Export the FeatureCollection.
Export.table.toDrive({
collection: featureCollection,
folder: 'GEE_VN',
description: 'adm3_LST_mean',
fileFormat: 'SHP'
});
However, when I want to apply a percentile reducer (10 and 90 percent), the export fails
var p10 = LST.reduceRegions({
collection: adm3,
scale: 30,
reducer: ee.Reducer.percentile([10])
});
This is the error message and I see that this is because the percentile reducer returns a dictionary, but I can't manage to address the 10p percentile correctly.
Error: Feature, argument 'metadata': Invalid type. Expected type: Dicationary<Object>. Actual type: FeatureCollection (Error code: 3)
Where do I have to convert the dictionary to a collection?