Google Earth Engine(gee)中的Feature
程序员文章站
2022-05-26 19:13:38
...
目录
Feature.centroid/simplify/bounds/convexHull/buffer()
Feature.union/intersection/difference/symmetricDifference()
Feature中计算面积:area()、周长:perimeter()
ee.Feature()
var geometry_tianfu= ee.Geometry.Polygon([[[104.06431420192233, 30.65820626544307],
[104.06455023631564, 30.656581911340815],
[104.06714661464206, 30.656581911340815],
[104.06733973369113, 30.658372391028514]]])
var properties_tianfu= {
"name": "天府广场",
"location": "成都",
"system:index": "0"
}
var feature_tianfu =ee.Feature( geometry_tianfu,properties_tianfu);
print(feature_tianfu)
Map.centerObject(feature_tianfu)
Map.addLayer(feature_tianfu)
Feature.select()
提取出想要的属性,并给属性名改名
var geometry_tianfu= ee.Geometry.Polygon([[[104.06431420192233, 30.65820626544307],
[104.06455023631564, 30.656581911340815],
[104.06714661464206, 30.656581911340815],
[104.06733973369113, 30.658372391028514]]])
var properties_tianfu= {
"name": "天府广场",
"location": "成都",
"system:index": "0"
}
var feature_tianfu =ee.Feature( geometry_tianfu,properties_tianfu);
print(feature_tianfu)
print(feature_tianfu.select(["name"]))
print(feature_tianfu.select(["name"],["名称"]))
Feature中的set、setMulti
var geometry_tianfu= ee.Geometry.Polygon([[[104.06431420192233, 30.65820626544307],
[104.06455023631564, 30.656581911340815],
[104.06714661464206, 30.656581911340815],
[104.06733973369113, 30.658372391028514]]])
var properties_tianfu= {
"name": "天府广场",
"location": "成都",
"system:index": "0"
}
var feature_tianfu =ee.Feature( geometry_tianfu,properties_tianfu);
print(feature_tianfu)
print(feature_tianfu.set('location','chengdu'))
print(feature_tianfu.setMulti({'name':'chengdu','location':"tianfuguangchang"}))
Feature.transform()
print("myGeometry",myGeometry)
var feature=ee.Feature(myGeometry)
print("feature",feature)
var feature_transform=feature.transform('EPSG:3857',ee.ErrorMargin(100))
print("feature_transform",feature_transform)
print(ee.Geometry(feature.geometry()).projection())
print(ee.Geometry(feature_transform.geometry()).projection())
Feature.centroid/simplify/bounds/convexHull/buffer()
Feature.union/intersection/difference/symmetricDifference()
var feature1 =ee.Feature(ee.Geometry.Polygon(
[[[103.43534679370603, 31.17014003162498],
[102.90800304370603, 30.45777180538538],
[103.71549816089353, 29.911716302186857],
[104.48454112964353, 30.329839651564306],
[104.03410167651853, 31.014908583940628]]]))
var feature2 = ee.Feature(ee.Geometry.Polygon(
[[[104.44608898120603, 31.04785765490257],
[103.91325206714353, 30.63281369239727],
[104.30326671558103, 29.959319376777437],
[105.34147472339353, 30.044947475833734]]]));
Map.centerObject(feature1)
Map.addLayer(feature1,{color:"00ffff"},"feature1")
Map.addLayer(feature2,{color:"32CD32"},"feature2")
Map.addLayer(feature1.union((feature2)),{},"union")
Map.addLayer(feature1.intersection((feature2)),{},"intersection")
Map.addLayer(feature1.difference((feature2)),{},"difference")
Map.addLayer(feature1.symmetricDifference((feature2)),{},"symmetricDifference")
Feature中计算面积:area()、周长:perimeter()
- area():面积函数
- perimeter():周长函数
print(sichuan)
print(sichuan.first())
print("面积",ee.Feature(sichuan.first()).area())
print("周长",ee.Feature(sichuan.first()).perimeter())
推荐阅读
-
Google Earth Engine——windowns下搭建GEE本地python开发环境
-
google earth engine(GEE)如何在看某一点的经纬度、波段信息
-
使用google earth engine(GEE)提取2000年到2019年长江下游水体(河流、湖泊)数据
-
google earth engine(GEE)导出影像集合Collection方法
-
Google Earth Engine(GEE)对指定地点Sentinel-2 Level1C数据进行NDVI指数的计算
-
Google Earth Engine(gee)中的List
-
Google Earth Engine(gee)中的Dictionary
-
Google Earth Engine(gee)中的Date和DateRange
-
Google Earth Engine(gee)中的String和Number
-
Google Earth Engine(GEE)对指定地点Sentinel-2 Level1C数据的读取及云量处理