I am working with BFAST Monitor in Google Earth Engine, and I would like to run the algorithm over a FeatureCollection containing individual points of interest. Like this:

var norway = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level0").filter(ee.Filter.eq('ADM0_NAME', "Norway"));
var myPoints = ee.FeatureCollection.randomPoints(norway, 10);

var engine = require('users/andreim/geeMonitor:monitor.js');

var roi =  myPoints;//ee.Geometry.Point(-60.00, -14.33);// region of interest as a Feature
var historyStart = "2000-01-01"; // The starting date of the stable period.
var historyEnd = "2018-12-31"; // The end date of the stable period.
var monitoringStart = "2019-01-01"; // The starting date of the monitoring period.
var monitoringEnd = "2020-01-01"; // End date of monitoring period. 
var h = 0.25; //numeric scalar from interval (0,1) specifying the bandwidth relative to the sample size in MOSUM/ME monitoring processes
var period = 2; // maximum time, relative to the history period, that should be monitored. The default is 10 times the history period.
var alpha = 0.05; //Significance level of the monitoring (and ROC, if selected) procedure, i.e., probability of type I error.
var magnitudeThreshold = 0; //Threshold for magnitude level for which a change should be considered. Default is 0.
var harmonics = 1; //Order of the harmonic term.

var result = engine.bfastMonitor(roi,historyStart,historyEnd,monitoringStart,monitoringEnd,h,period,alpha,magnitudeThreshold,harmonics);

In mirror to this question about LandTrendr, I tried to apply a reducer over the result, like this:

var myReduced = result.reduceRegions({
  collection: myPoints,
  reducer: ee.Reducer.first(),
  scale: 30,
  tileScale : 16

But I got the error result.reduceRegions is not a function.

Is this a casting issue?

  • By using print(result); I found out that the object is composed of four image collections
  • By using print(typeof(result)); I found out that result does not have a native GEE type, as it just returns Object.

So, I tried to cast result to a list (ee.List(result)) or an ImageCollection (ee.ImageCollection(result)) to turn the object into something that I could work with, but it kept returning the same error ___ is not a function.

So, how do I run BFAST Monitor over a FeatureCollection?


You need to select the ImageCollection that you are interested in using the . operator. Then filter the ImageCollection to get the layer (Image) you want, e.g. the break timing:

result = result.bfastResults.filter(ee.Filter.eq("system:index", "1")).first();

And then your reduceRegions function works correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.