0

i need run this code in my nodeJS application:

//Dates of Interest
var start = ee.Date("2014-10-01");
var finish = ee.Date("2018-05-01");
///--------------------- Landsat Collection ---------------------------------------///
var landsat = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate(start, finish)
.filterBounds(roi);
// Year-Month-Day Extract function
function ymdList(imgcol){
 var iter_func = function(image, newlist){
 var date = ee.Number.parse(image.date().format("YYYYMMdd"));
 newlist = ee.List(newlist);
 return ee.List(newlist.add(date).sort())
 };
 return imgcol.iterate(iter_func, ee.List([]));
}
var ymd = ymdList(landsat);
print(ee.List(ymd).reduce(ee.Reducer.frequencyHistogram()));

But I do not know which function to use in place of "print ()", can anyone help me?

Kersten
10k3 gold badges40 silver badges60 bronze badges
asked Jul 5, 2018 at 21:35

1 Answer 1

2

The typical way of logging a value in nodejs is console.log( myValue ). To evaluate a variable that hasn’t been computed yet, which the Earth Engine code editor does automatically when you print, you may want to define your own print function instead:

var print = function (o) {
 if (o instanceof ee.ComputedObject) {
 o = o.getInfo();
 }
 console.log(o);
};
Kersten
10k3 gold badges40 silver badges60 bronze badges
answered Jul 6, 2018 at 22:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.