TransWikia.com

Replace String With Number In List, Google Earth Engine?

Geographic Information Systems Asked by AmirHossein Ahrari on February 27, 2021

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);

One Answer

You need to use replaceAll:

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

Correct answer by Anatoly Sukhanov on February 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP