How can I copy a value from server to client in Google Earth Engine?

别说谁变了你拦得住时间么 提交于 2020-05-28 06:58:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!