IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 游戏开发 -> 第五章 GEE的空间数据类型(Geometry、Feature、Feature collection) -> 正文阅读

[游戏开发]第五章 GEE的空间数据类型(Geometry、Feature、Feature collection)

一、Geometry

1.1 创建ee.Geometry.Point() ee.ee.Geometry.Multipoint 绘图工具......

var Geo = ee.Geometry.Point(116.3968,39.9186)
Map.centerObject(Geo)
print(Geo)
Map.addLayer(Geo)

var Geo2 = ee.Geometry.MultiPoint([[116.3921,39.9224],
                                  [116.4014,39.9227],
                                  [116.4017,39.9138],
                                  [116.3929,39.9135]])
Map.centerObject(Geo2)
print(Geo2)
Map.addLayer(Geo2)

var Geo = ee.Geometry.LineString([[116.3921,39.9224],
                                  [116.4014,39.9227],
                                  [116.4017,39.9138],
                                  [116.3929,39.9135],
                                  [116.3921,39.9224]])
Map.centerObject(Geo)
print(Geo)
Map.addLayer(Geo)

var Geo2 = ee.Geometry.MultiLineString([[
[116.39367078496434,39.92134494485143],
[116.39899228764989,39.92173989850053]],

[[116.39401410771825,39.91953471147776],
[116.39693235112645,39.92085124958646]],

[[116.39628862096288,39.91920557299557],
[116.39873479558446,39.91752694212849]]])
Map.centerObject(Geo2)
print(Geo2)
Map.addLayer(Geo2)

var Geo2 = ee.Geometry.Polygon([
[[116.39179060756112,39.922576684295926],
[116.39230559169198,39.913064366936894],
[116.40213320552255,39.91352520169099],
[116.40161822139169,39.92297163084022]],

[[116.39483759700204,39.91961451259886],
[116.39496634303475,39.91648763678902],
[116.39900038539315,39.916553467224674],
[116.39874289332772,39.91977908105491]]])
Map.centerObject(Geo2)
print(Geo2)
Map.addLayer(Geo2)

1.2 几何 Geometry.transform() geometry.centroid() geometry.simplify () geometry.bounds() geometry.buffer() geometry.union()

var China_Geo = ee.Geometry.Rectangle(65.9,19.8,134.5,50.9)
var China_Planr = ee.Geometry(China_Geo,null,false)
var China_Planr2 = China_Geo.transform("EPSG:4326",ee.ErrorMargin(100))

Map.addLayer(China_Geo,{color:"FF0000"},"geodesic polygon")
Map.addLayer(China_Planr,{color:"000000"},"planar polygon")
Map.addLayer(China_Planr2,{color:"0000CD"},"planar2 polygon")

var China_Geo = ee.Geometry.Rectangle(65.9,19.8,134.5,50.9)
var China_Certer = China_Geo.centroid()

Map.addLayer(China_Geo,{color:"FF0000"},"China_Geo")
Map.addLayer(China_Certer)

var TGR = ee.FeatureCollection("users/xf2111905198/YunNan").geometry()
var TGR_Simple = TGR.simplify(50000)

Map.centerObject(TGR)
Map.addLayer(TGR)
Map.addLayer(TGR_Simple)

var TGR = ee.FeatureCollection("users/xf2111905198/YunNan").geometry()
var TGR_Bound = TGR.bounds()
var TGR_Hall = TGR.convexHull()

Map.centerObject(TGR)
Map.addLayer(TGR)
Map.addLayer(TGR_Bound)
Map.addLayer(TGR_Hall)

var TGR = ee.FeatureCollection("users/xf2111905198/YunNan").geometry()
var TGR_Buffer = TGR.buffer(2000)

Map.centerObject(TGR)
Map.addLayer(TGR)
Map.addLayer(TGR_Buffer)

var Polygon_1 = ee.Geometry.Polygon(
[[[152.71032334056088,18.862610207551867],
[-170.72717665943918,19.69222816299581],
[-171.07873915943918,40.62061002589569],
[153.41344834056088,40.08478212000696]]])

var Polygon_2 = ee.Geometry.Polygon(
[[[-176.52795790943912,45.620172046005735],
[-176.70373915943912,32.2945468815855],
[-142.60217665943918,32.2945468815855],
[-141.02014540943918,45.49709377875777]]])

var Polygon_union=Polygon_1.union(Polygon_2)
Map.centerObject(Polygon_union)
Map.addLayer(Polygon_1)
Map.addLayer(Polygon_2)
Map.addLayer(Polygon_union)

1.3 查询 geometry.geometries() geometry.coordinates() geometry.length() geometry.area() geometry.perimeter() geometry.distance()

var YunNan = ee.FeatureCollection("users/xf2111905198/YunNan").geometry()
var Area = YunNan.area()
var Perimeter = YunNan.perimeter()

Map.centerObject(YunNan)
Map.addLayer(YunNan)
print(YunNan,Area,Perimeter)

1.4 转换 geometry.toGeoJSON()

var Geo = ee.Geometry.Polygon([[116.3921,39.9224],
                                  [116.4014,39.9227],
                                  [116.4017,39.9138],
                                  [116.3929,39.9135]])
var GeoJson = Geo.toGeoJSON()

Map.centerObject(Geo)
Map.addLayer(Geo)
print(Geo,GeoJson)

?????????这个转换只是对图形的格式进行了转换,类似于将jpg格式转换成tif格式,这个转换的目的是因为目前GEE对Shp文件的数据支持仍然不完善,转换成GeoJSON格式储存和下载,然后再将其转换为Shp文件就可以避免出现乱码。

二、Feature

2.1 创建ee.Feature() 绘图工具

var Forbidden_City = ee.Geometry.Polygon(
[[[116.39239142238046,39.913146659084674],
[116.40209029017831,39.91354166001771],
[116.40170405208016,39.922988086896794],
[116.39183352290536,39.922593140447425]]])
var Feature_Fobidden_City = ee.Feature(Forbidden_City,{name:'故宫',location:'北京'})

Map.centerObject(Forbidden_City)
print(Feature_Fobidden_City)
Map.addLayer(Feature_Fobidden_City)

?

2.2 编辑Feature.select() Feature.transform() Feature.set/setMulti()

var Forbidden_City = ee.Geometry.Polygon(
[[[116.39239142238046,39.913146659084674],
[116.40209029017831,39.91354166001771],
[116.40170405208016,39.922988086896794],
[116.39183352290536,39.922593140447425]]])
var Feature_Fobidden_City = ee.Feature(Forbidden_City,{name:'故宫',location:'北京'})
//var Feature_Set = Feature_Fobidden_City.setMulti({'name':'Gugong','location':'Beijing'})
var Feature_Set = Feature_Fobidden_City.set('name','Gugong','location','Beijing')
print(Feature_Fobidden_City,Feature_Set)
Map.centerObject(Forbidden_City)
Map.addLayer(Feature_Fobidden_City)

2.3 几何 Feature.centroid/simplify/bounds/convexHull/buffer()...

var YunNan = ee.FeatureCollection("users/xf2111905198/YunNan").geometry()
var YunNan_Simple = YunNan.simplify(50000)
var YunNan_Centriod = YunNan.centroid()
var YunNan_Hull = YunNan.convexHull()
var YunNan_Bounds = YunNan.bounds()
var YunNan_Buffer = YunNan.buffer(50000)
Map.centerObject(YunNan)
Map.addLayer(YunNan)
Map.addLayer(YunNan_Simple)
Map.addLayer(YunNan_Centriod)
Map.addLayer(YunNan_Hull)
Map.addLayer(YunNan_Bounds)
Map.addLayer(YunNan_Buffer)

2.4 提取 Feature.geometry() Feature.get() Feature.Length/Area/Perimeter()

var YunNan = ee.FeatureCollection("users/xf2111905198/YunNan").first()
var YunNan_geometry = YunNan.geometry()
var YunNan_get = YunNan.get("省")
var YunNan_Feature = ee.Feature(YunNan)
var YunNan_Area = YunNan_Feature.area()
var YunNan_Perimeter = YunNan_Feature.perimeter()
print(YunNan,YunNan_geometry,YunNan_Feature,YunNan_get,YunNan_Area,YunNan_Perimeter)

三、Feature collection

3.1 创建 GEE自带? 上传 FushionTable ee.FeatureCollection() .randomPoints() 手绘

var Poly = ee.Geometry.Polygon(
[[116.39248531478768,39.91319513792091],
[116.40222709792977,39.91378763804685],
[116.40184085983162,39.92303655876662],
[116.39171283859139,39.922674524864675]])

var Random_Points = ee.FeatureCollection.randomPoints(Poly,30)
Map.centerObject(Poly)
Map.addLayer(Poly)
Map.addLayer(Random_Points)

3.2 编辑 .filterMetadata() .limit() .filterDate() .filterBounds() .filter() .select() .distinct() .union() .merge() .set() .remap() .sort() .makeArray()

var Production_Area = ee.FeatureCollection("WCMC/WDPA/current/polygons")
var Production_China = Production_Area.filterMetadata("ISO3","equals","CHN")

Map.centerObject(Production_China)
Map.addLayer(Production_China,{color:"FF0000"})

var China = ee.FeatureCollection("users/xf2111905198/China")
var Select = China.limit(6,"Shape_Area",false)

Map.centerObject(China)
Map.addLayer(China)
Map.addLayer(Select,{color:"FF0000"})

var L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT")
var Landsat_FilterDate = L8.filterDate("2019-03-01","2019-03-16").limit(50)
print(Landsat_FilterDate)

var China = ee.FeatureCollection("users/xf2111905198/China")
var Point = ee.Geometry.Point([106.92371845031437,29.430312117372274])
var Select = China.filterBounds(Point)

Map.centerObject(China)
Map.addLayer(Point)
Map.addLayer(China)
Map.addLayer(Select,{color:"FF0000"})

var China = ee.FeatureCollection("users/xf2111905198/China")

var Select = China.union()
print(China,Select)

Map.centerObject(China)
Map.addLayer(China)
Map.addLayer(Select,{color:"ff0000"})

3.3 转换 .geometry() .reduceToImage()

var China = ee.FeatureCollection("users/xf2111905198/China").limit(3)
var China_Geometry = China.geometry()

print(China,China_Geometry)

3.4 查询 .first() .toList() .aggregate_first()??.aggregate_array()?

var China = ee.FeatureCollection("users/xf2111905198/China")
var China_Biggest_Province = ee.Feature(China.sort("Shape_Area").first())
print(China_Biggest_Province)

Map.centerObject(China)
Map.addLayer(China_Biggest_Province)
var China = ee.FeatureCollection("users/xf2111905198/China")
var China_List = China.sort("Shape_Area").toList(10)
print(China_List)

var Area_No_1 = ee.Feature(China_List.get(0))
Map.centerObject(China)
Map.addLayer(Area_No_1)

3.5 统计 .aggregate_stats/_histogram/_count/_count_distinct .aggregate_max/_min/_sum/_mean/_product

var China = ee.FeatureCollection("users/xf2111905198/China")
var China_1 = China.sort("Shape_Area").aggregate_first("Shape_Area")
var China_3 = China.sort("Shape_Area").limit(3).aggregate_array("Shape_Area")
print(China_1)
print(China_3)

3.6 其它 .map()

var China = ee.FeatureCollection("users/xf2111905198/China")

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

var ChinaCenter = China.map(Add_Center)
print(ChinaCenter)

Map.centerObject(China,3)
Map.addLayer(China)
Map.addLayer(ChinaCenter,{color:"ff0000"})

  游戏开发 最新文章
6、英飞凌-AURIX-TC3XX: PWM实验之使用 GT
泛型自动装箱
CubeMax添加Rtthread操作系统 组件STM32F10
python多线程编程:如何优雅地关闭线程
数据类型隐式转换导致的阻塞
WebAPi实现多文件上传,并附带参数
from origin ‘null‘ has been blocked by
UE4 蓝图调用C++函数(附带项目工程)
Unity学习笔记(一)结构体的简单理解与应用
【Memory As a Programming Concept in C a
上一篇文章      下一篇文章      查看所有文章
加:2022-04-26 12:08:57  更:2022-04-26 12:11:00 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/23 13:42:07-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码