FeatureCollection
GEE之FeatureCollection入门操作1
FeatureCollection
FeatureCollection 区域选择,点选。
FilterMetadata
官方函数:
Shortcuts to filter a collection by metadata. This is equivalent to this.filter(ee.Filter.metadata(...)).
Returns the filtered collection.
Arguments:
this:collection (Collection):
The Collection instance.
name (String):
The name of a property to filter.
operator (String):
The name of a comparison operator. Possible values are: "equals", "less_than", "greater_than",
"not_equals", "not_less_than", "not_greater_than", "starts_with",
"ends_with", "not_starts_with", "not_ends_with", "contains",
"not_contains".
value (Object):
- The value to compare against.
Returns: Collection
用法
输入参数有3个,第一个是选择的属性名字,第二个是判断符号(等于,小于等),第三个是目标值。 比如
filterMetadata('flag','equals','false')
//option
"equals", "less_than", "greater_than","not_equals", "not_less_than", "not_greater_than",
"starts_with","ends_with", "not_starts_with", "not_ends_with", "contains","not_contains".
就是选择 flag等于false的feature
如果点集FeatureCollection ,还可以用filterBounds() 去选择区域;跟ImageCollection 同理。
如果有一个点集和矢量集合,而直接在GEE中运行会内存不足,则可以通过filterMetadata选择矢量集合中单个feature,从而可以进行循环;然后求geometry属性,选择Bounds区域 ,从点集合中选择出对应feature中的点集。
var eft = table.filterMetadata('flag','equals',4);
var roi = eft.geometry();
var cepo = table2.filterBounds(roi);
这样就可以大区域变小区域,进行循环,提取数值等。