I have an image collection of which I want to sample the pixels located at three different locations. For this I use a feature collection. When using the .sampleRegions
function it is possible to include the properties from the features using the property argument. However, I was wondering if it is also possible to include a property (namely the system:time_start) of the images in the sampled pixels (besides the bands)? I need the date of the pixels as I am exporting the results of the sampling to analyse it and the date is not included in the ID of the image.
Here I include a part of my script:
// Function to extract pixels from an imagecollection at location of stations
var sample = function(image){
var sample = image.sampleRegions({
collection: Stations
})
return sample
}
var sd = '2016-03-01'
var ed = '2020-12-31'
var WAPOR_ET = ee.ImageCollection("FAO/WAPOR/2/L1_AETI_D").filterDate(sd,ed)
var WAPOR_ET_sample = WAPOR_ET.map(sample).flatten()
Export.table.toDrive(WAPOR_ET_sample, 'WAPOR_ET')
This does not provide any timestamp to the sampled pixels. I have tried some things to include the date but so far without any results. So, is there any way to include a property such as a timestamp from an image in the sampled features? And if so how should I do this?
question from:
https://stackoverflow.com/questions/65938401/how-to-include-an-image-property-to-a-created-feature-when-using-sampleregion-i 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…