I have a point feature which I've used to reduce values from an image collection.
The values are obtained as a new feature's property by mapping over the images with this code (specifically getting ndvi values):
var my_vals = images.map(function (img){
var ndviImg = img.normalizedDifference(['B5', 'B4']);
return ee.Feature(area, ndviImg.reduceRegion(ee.Reducer.mean(), point));
});
I need these values to be put into an array so I can do additional calculation on them. However, the function Feature.getArray() returns an empty array.
var myArray = my_vals.getArray("nd");
print(my_vals); // returns "[]"
However I know that the values do exist within properties, because if I run the following code I can print out a list of the properties.
var myList = my_vals.aggregate_array("nd");
print(myList) // this prints a list of my values
My goal is to do divide one list of these values by another. As far as I am aware I need the values in an array in order to be able to do this (I could not find a way to do this with the object that .aggregate_array() returns).
Does anybody know why this may be, or a better way to be able to get these values in a way I can programatically do math using them?
Apologies for the beginner question here, this is an issue I've been struggling with for a while.
Thanks!