问题
On Google Earth Engine, suppose I have a Number on the server side. How can I get it as an integer on the client side?
var x = ee.Number(42)
typeof(x) // yields "object", i.e. server side
var y = ??? // what function of x will get me a local 42 in y?
回答1:
This seems to work, although it is not recommended by the documentation:
var x = ee.Number(42) // server side variable
var z = x.getInfo() // local string
var y = parseInt(z)
来源:https://stackoverflow.com/questions/60892701/how-can-i-copy-a-value-from-server-to-client-in-google-earth-engine