I am trying to do something similar, I have a feature collection which i want to map over an function, which access image in an asset. The image asset id is a combination of variable inside the function. which i am not able to concatenate because they are in computed object formats not strings. Also i get this error 'Actual value for parameter 'id' must be a constant.' My image lies in subset folders in earth engine assets
year=2019
def getarea(feature):
dist_bounds=ee.FeatureCollection('projects/remotesensing/assets/District_Boundaries')
dist=dist_bounds.filterBounds(feature.geometry()).aggregate_array('District').get(0)
state=dist_bounds.filterBounds(feature.geometry()).aggregate_array('STATE').get(0)
result_image=ee.Image('projects/remotesensing/assets/CropImages/'+'/'+(dist)+(str((year))))
clipped_image = result_image.clip(feature.geometry())
area=clipped_image.reduceRegion(
reducer= ee.Reducer.sum().group(
groupField= 1,
groupName= 'class',
),
geometry= feature.geometry(),
scale= 10,
maxPixels= 1e10
).get('groups');
props = {
'crop': feature.get('crop_name'),
'area': area
}
return ee.Feature(feature.geometry(), props)