I am accessing the properties of an image collection in GEE. I have created an image collection and assigned it to the variable "collection". When accessing the date range I used the following syntax
//Create Image Collection
var collection = ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA")
.filter(ee.Filter.eq("WRS_PATH", 118))
.filter(ee.Filter.eq("WRS_ROW", 56))
.filterDate("2020-05-16", "2021-06-17");
Map.addLayer(collection)
Map.centerObject(collection, 9)
print("Collection: ", collection);
//Get date range
var dates = collection.get("date_range");
print ("dates: ", dates)
var daterange = ee.DateRange(dates.get(0), dates.get(1));
print("daterange: ", daterange)
This gives an error "dates.get is not a function". However if I create the "dates" variable with...
var dates = ee.List(collection.get("date_range"));
it all works fine. I don't really understand why this is as the "dates" variable appears to return the same list either way.
Hope someone can explain