I am doing a spatiotemporal analysis of LULC on google earth engine. For this, I have imported Landsat 5 tier 1 TOA reflectance images and filtered them by my preference. Following this I was able to extract the id values of the features in the filtered image collection, I need to create a dictionary in order to be able to assign the unique names from ID extracted by slicing the ID's and assign a value(id itself) to each pair.
The id obtained of images in an image collection is of the type: LANDSAT/LT05/C01/T1_TOA/LT05_148045_19890509 in this, key:19890509 value:LT05_148045_19890509
both of which can be obtained from slicing the obtained ID
I have filtered the image collection and tried to create a dictionary as follows but it creates an empty dictionary.
// Create a list of image objects.
var imageList = Collection.toList(100);
print('imageList', imageList);
// Extract the ID of each image object.
var dicty = ee.Dictionary({}); //def dict for names
var id_list = imageList.map(function(item) {
var list_nm = ee.Image(item).id();
var lst_nm_slice = ee.Image(item).id().slice(-8,-1);
dicty.lst_nm_slice = list_nm;
return dicty;
});//end of map function
I expect the output of dicty to be a dictionary of key-value pairs with each key value getting assigned dynamically in the aforementioned loop so that I can call the images by using the dictionary key value pairs.