0

I have a list of features which I am going to use map.function to extract specific value from features but inside function when I am using .getinfo()[0] to return first value give me an error: "Internal error: function argument not initialized."

Let me know if anyone is familiar with this problem.

structure of my features

Here is the sample code:

var map_m = function(i) {
  i=ee.Number(i)
  var feature = ALL.get(i).getInfo()[0]
  var ff=feature
  
  return ff
}

0

Since you did not provide what ALL is, let me make assumptions and proceed.

var ALL =ee.List([[1,2,3], [5,6,7]]);
var map_m = function(i) { 
  i=ee.Number(i);
  var feature = ALL.get(i).getInfo()[0] ;
  var ff=feature;
  return ff 
  }
print(map_m(1));

First things first. Make sure you end every line with ;. Use the last line of code to debug. I had no problem running the lines you provided. Please provide additional information to debug. Make sure when you pass argument to map_m, it should be within the limits, in my case, 0 or 1. Did you call the function and pass the argument?

1
  • Thanks for responding Aman Jain. you are right. Its working. would you pleas check whats is wrong with following code.
    – zahir nik
    Jun 27 '20 at 12:57

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.