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?

1
  • 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 Commented Apr 1, 2021 at 5:57

1 Answer 1

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.

0

Your Answer

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

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