I have written functions that processes all Landsat imagery and calculates NDVI. However, I have 59 GPS points, and I want a NDVI time series output per GPS point. After running my code, it seems that the resulting NDVI values are not per point, but a single value per image. I am guessing that some sort of bounding-box was automatically created and used for the calculation, instead of using the GPS points. Thus, I need to iterate my function over all 59 points, and save output into a table.
The GPS file is a ESRI points shape file.
What is the best way to do this?
Here is some of my code:
// import GPS locations from asset
GPS = GPS.geometry();
// Calculates the median NDVI and add value to image properties.
var meanNDVI = ndviLandsatCol.map(function(img) {
var obs = img.reduceRegion({
geometry: GPS,
reducer: ee.Reducer.median(),
scale: 30
});
return img.set('NDVI', obs.get('NDVI'));
});
The ndviLandsatCol
variable is a pre-processed image collection with NDVI added as a band.
I am still new to coding, and Google Earth Engine. Can someone advise on how to iterate this process over all my GPS points? How should I read in the GPS file, dictionary? And how can I save this into a .CSV without plotting the points and downloading accompanying file.
Any help would be appreciated.