上次我們我計算了山西省的生物量,但是又有新的問題出現了,問題在于有很多feature上組成的featurecollection,大概又8000多個,這就導緻無法進行下一步的計算,直接超限額了。
方法1:
當我們面對這個問題,有兩個解決方案,一個是在Arcgis中進行融合這些面,融合成為一個面,這樣就成為一個融合衆多不同面的巨大的featurecollection
方法2: 我們在GEE中适用一個函數即可:
union(maxError)
Merges all geometries in a given collection into one and returns a collection containing a single feature with only an ID of 'union_result' and a geometry.
将給定集合中的所有幾何體合并成一個集合,并傳回一個隻包含一個ID為'union_result'的單一特征和一個幾何體的集合。
Arguments:
this:collection (FeatureCollection):
The collection being merged.被合并的集合。
maxError (ErrorMargin, default: null):
The maximum error allowed when performing any necessary reprojections. If not specified, defaults to the error margin requested from the output.
Returns: FeatureCollection
代碼:
//這是原始的衆多矢量圖
var shanxi = ee.FeatureCollection('projects/ee-shiyan/assets/WXrh').geometry();
print("shanxi",shanxi)
//這是合并後的矢量集合
var shanxi1 = ee.FeatureCollection('projects/ee-shiyan/assets/WXrh').union();
print("shanxi1",shanxi1)
第一個的矢量結果:
第二個是合成後的集合
當然還是矢量太多了,這樣遠遠超過了GEE的運算,雖然可以計算,但是計算series的時序分析計算依舊逾時了,是以建議不要使用超過5000個小的矢量來進行線上運算。