Google Earth Engine(GEE)——让点的个数等于number返回的布尔类型值为真?
【摘要】 问题是这样的,有时候我们明明看到结果是一致的,但是为啥运算出来的东西却不一样呢?我们可以具体看看到底是为啥,有朋友闻到了这样的问题,我们可以具体看看这个问题:这个结果是 True 我该怎么做?修正前的代码:var points=ee.Geometry.MultiPoint([[35.13382554493316, 42.01690078898458], [35.12772087020976...
问题是这样的,有时候我们明明看到结果是一致的,但是为啥运算出来的东西却不一样呢?我们可以具体看看到底是为啥,有朋友闻到了这样的问题,我们可以具体看看这个问题:
这个结果是 True 我该怎么做?
修正前的代码:
这里我们所需要用到的就是我么判断是否相等的算法,具体算法见如下
ee.Algorithms.IsEqual(left, right)
Returns whether two objects are equal.返回两个对象是否相等。
Arguments:
left (Object, default: null)
right (Object, default: null)
Returns: Boolean
修正后代码:
当然除了用上面判断是否相等之外,还可以使用下面的函数来进行判断:条件,真假的情况是什么都可以的。
ee.Algorithms.If(condition, trueCase, falseCase)
Selects one of its inputs based on a condition, similar to an if-then-else construct.
Arguments:
condition (Object, default: null):
The condition that determines which result is returned. If this is not a boolean, it is interpreted as a boolean by the following rules:
-
Numbers that are equal to 0 or a NaN are false.
-
Empty strings, lists and dictionaries are false.
-
Null is false.
-
Everything else is true.
trueCase (Object, default: null):
The result to return if the condition is true.
falseCase (Object, default: null):
The result to return if the condition is false.
Returns: Object
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)