2

I would like to know how to pair more than two lists.

I know this is easy to do using .zip function, but how do I pair a third or more lists?

var list1 = ee.List(['20190101T160509_20190101T160509_T17RNJ',
                     '20190104T160649_20190104T161509_T17RLH',
                     '20190104T160649_20190104T161509_T17RMJ',
                     '20190104T160649_20190104T161509_T17RMK']);
var list2 = ee.List(['17RNJ','17RLH','17RMJ','17RMK']);
var list3 = ee.List([1,2,3,4]);

var paired = list1.zip(list2);
print(paired);
2

I would make a sequence of index numbers and then map over that list:

var paired = ee.List.sequence(0,list1.length().subtract(1),1).map(function(i){
  return [list1.get(i),list2.get(i),list3.get(i)]
})

print(paired)
0

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.