0

How can I replace '-infinity' with 0 number using a function in Google Earth Engine? I'm gonna to replace string with 0 value in the list automatically.

https://code.earthengine.google.com/1bd2127a2d5f0994dfd593be190edd60

var x  = ee.List([0,1,2,3,4,5,6,'-infinity','-infinity']);

var y = ee.List([1,2,3,4,5,6,7,8]);

print('xvalues',x);
print('yvalues',y);

1 Answer 1

0

You need to use replaceAll:

x = x.replaceAll('-infinity', 0);

2

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.