1

i have a two-segment list;

var list =ee.List([
  [101,12155],
  [102,12157],
  [103,12158]])

I can print this list with:

print(list)

And get values for row (0) like this command:

print(list.get(0))

But, how can i get the second values of first rows from this list?

2
  • Hi @Mehmet and welcom on GIS.StackExchange. when you add code in your question, use the mkd code hilighting system. It's also available in the question text editor. I've edit your question accordingly Apr 1 at 5:57
  • Thanks, Pierrick...
    – Mehmet C
    Apr 1 at 8:36
2

If I understand your question correctly, we have two options:

1- Go with the ee.List

var list =ee.List([[101,12155], [102,12157], [103,12158]])
print(ee.List(list.get(0)).get(0))
//[101]
print(ee.List(list.get(0)).get(1))
//[12155]
print(ee.List(list.get(1)).get(0))
//[102]

2- Or go with ee.Array

var list =ee.Array([[101,12155], [102,12157], [103,12158]])

print(list.get([0,0]))
//[101]
print(list.get([0,1]))
//[12155]
print(list.get([1,0]))
//[102]

Hope it helps.

1
  • Thank you very much....
    – Mehmet C
    Apr 1 at 7:13

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.