Tabla de contenido
Genere puntos aleatorios: FeatureCollection.randomPoints ()
FeatureCollection 中 limit () 、 sort ()
FilterBounds (), filterMetadata () en FeatureCollection
Primero (), seleccione () en FeatureCollection
Obtener, configurar, configurarMulti en FeatureCollection
Vector a ráster: FeatureCollection.reduceToImage ()
estructura basica
FeatureCollection.geometry ()
Genere puntos aleatorios: FeatureCollection.randomPoints ()
FeatureCollection 中 limit () 、 sort ()
En el parámetro, verdadero significa orden ascendente, falso significa orden descendente
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))
FilterBounds (), filterMetadata () en FeatureCollection
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'})
Primero (), seleccione () en FeatureCollection
var fc_sichuan = ee.FeatureCollection("users/lcljv1066965/test/sichuan");
print(fc_sichuan.first())
print(fc_sichuan.limit(3).select(['name','adcode']))
FeatureCollection.union ()
union: Union. El efecto es formar una sola entidad y borrar todos los atributos.
FeatureCollection.merge ()
Fusionar: fusionar dos conjuntos de datos
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))
Obtener, configurar, configurarMulti en FeatureCollection
Al usar set, si el atributo no existe, agréguelo; si lo tiene, actualícelo
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}))
Vector a ráster: 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))
Comandos de estadísticas de atributos de la colección de características: Feature Collection.aggregate_array (), etc.
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"))
Los siguientes son los comandos de estadísticas de atributos relacionados con la colección de características en 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'})