Google EarthエンジンのFeatureCollection(gee)

目次

基本構造

FeatureCollection.geometry()

ランダムポイントを生成します:FeatureCollection.randomPoints()

FeatureCollection中限界()、ソート()

FeatureCollectionのFilterBounds()、filterMetadata()

FeatureCollectionのFirst()、select()

FeatureCollection.union()

FeatureCollection.merge()

FeatureCollectionでGet、set、setMulti

ラスターへのベクター:FeatureCollection.reduceToImage()

FeatureCollection.toList()

機能コレクション属性統計コマンド:機能コレクション.aggregate_array()など。

Feature Collection.map()


 

基本構造

FeatureCollection.geometry()

ランダムポイントを生成します:FeatureCollection.randomPoints()

FeatureCollection中限界()、ソート()

パラメータで、trueは昇順を意味し、falseは降順を意味します

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

print("fc_sichuan",fc_sichuan)
print("fc_sichuan.limit(1)",fc_sichuan.limit(1))
print("subFeature_asc",fc_sichuan.limit(3,'subFeature',true))
print("sort_asc",fc_sichuan.sort('subFeature',true).limit(3))

FeatureCollectionのFilterBounds()、filterMetadata()

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

Map.centerObject(fc_sichuan)

Map.addLayer(fc_sichuan)
Map.addLayer(fc_sichuan.filterBounds(ee.Geometry.Point([104.091,30.598])),{color:'FF0000'})
Map.addLayer(fc_sichuan.filterMetadata('name','equals','绵阳市'),{color:'FFF000'})

FeatureCollectionのFirst()、select()

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");
print(fc_sichuan.first())
print(fc_sichuan.limit(3).select(['name','adcode']))

FeatureCollection.union()

ユニオン:ユニオン。その効果は、単一のフィーチャを形成し、すべての属性を消去することです。

FeatureCollection.merge()

マージ:2つのデータセットをマージします

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");
var chengdu=fc_sichuan.filterMetadata('name','equals','成都市')
var deyang=fc_sichuan.filterMetadata('name','equals','德阳市')

Map.centerObject(fc_sichuan)

Map.addLayer(fc_sichuan,{},"fc_sichuan")
Map.addLayer(chengdu,{color:'FF0000'},"chengdu")
Map.addLayer(deyang,{color:'FFF000'},"deyang")
Map.addLayer(chengdu.merge(deyang),{color:'00ff00'},"merge")

print(chengdu)
print(deyang)
print(chengdu.merge(deyang))

FeatureCollectionでGet、set、setMulti

setを使用する場合、属性が存在しない場合は追加し、存在する場合は更新します。

var fc =ee.FeatureCollection(ee.Geometry.Point([95.169, 34.513]));
      
print(fc)
print(fc.set('create','lijiang'))
print(fc.set('create','lijiang').get('create'))
print(ee.FeatureCollection(fc.set('create','lijiang')).set('create','xiaoming'))
print(fc.setMulti({"create":"lijiang","age":22}))

ラスターへのベクター:FeatureCollection.reduceToImage()

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

var sichuan_toImage=fc_sichuan.reduceToImage(['subFeature'],ee.Reducer.first())

Map.centerObject(fc_sichuan)
Map.addLayer(fc_sichuan,{},"fc_sichuan")
Map.addLayer(sichuan_toImage,{"min":1,"max":30,"palette":["ff9c07","f0ff1b","1aff0b"]},"sichuan_toImage")

print("fc_sichuan",fc_sichuan)
print("sichuan_toImage",sichuan_toImage)

FeatureCollection.toList()

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

print("fc_sichuan",fc_sichuan)
print(fc_sichuan.toList(5))
print(fc_sichuan.toList(5).get(0))

機能コレクション属性統計コマンド:機能コレクション.aggregate_array()など。

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

print(fc_sichuan)
print(fc_sichuan.aggregate_array("subFeature"))
print(fc_sichuan.aggregate_stats("subFeature"))
print("aggregate_first",fc_sichuan.aggregate_first("subFeature"))
print("aggregate_max",fc_sichuan.aggregate_max("subFeature"))
print("aggregate_count",fc_sichuan.aggregate_count("subFeature"))

以下は、GEEの機能収集に関連する属性統計コマンドです。

Feature Collection.map()

var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");

function Add_Center (feature){
  return feature.centroid()
}

print("fc_sichuan",fc_sichuan.limit(3))
print("fc_sichuan.map(Add_Center)",fc_sichuan.map(Add_Center).limit(3))

Map.centerObject(fc_sichuan)
Map.addLayer(fc_sichuan)
Map.addLayer(fc_sichuan.map(Add_Center),{color:'ff0000'})

 

おすすめ

転載: blog.csdn.net/qq_40323256/article/details/110203913