一、Image
1.1 创建
var Image1 = ee.Image(10)
var Image2 = ee.Image.constant(20)
var Image3 = Image1.add(Image2)
print(Image1,Image2,Image3)
var Image_Lon_Lat = ee.Image.pixelLonLat()
print(Image_Lon_Lat)
Map.addLayer(Image_Lon_Lat,{bands:['longitude'],min:-180,max:180},'Longitude')
Map.addLayer(Image_Lon_Lat,{bands:['latitude'],min:-60,max:60},'Latitude')
Map.setCenter(0,0,3)
1.2 编辑
var DEM = ee.Image("CGIAR/SRTM90_V4")
var Image_Cropland = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3").select('landcover').eq(11)
var Image_Masked = DEM.mask(Image_Cropland)
print(DEM,Image_Cropland,Image_Masked)
Map.setCenter(106.4,34.78,4)
Map.addLayer(DEM,{"opacity":1,"bands":["elevation"],"min":0,"max":1400,"palette":["2dff07","ff0b0b"]},"DEM")
Map.addLayer(Image_Cropland,{"opacity":1,"bands":["landcover"],"palette":["ffffff","fbff2d"]},"Image_Cropland")
Map.addLayer(Image_Masked,{"opacity":1,"bands":["elevation"],"min":0,"max":1400,"palette":["2dff07","ff0b0b"]},"Image_Masked")
var DEM = ee.Image("USGS/SRTMGL1_003")
var CQ = ee.FeatureCollection("users/xf2111905198/China").filterBounds(ee.Geometry.Point([106.8,29.3]))
var CQ_DEM = DEM.clip(CQ)
Map.setCenter(106.8,29.3,7)
Map.addLayer(CQ_DEM,{min:0,max:2000})
var Glob_Cover = ee.Image("ESA/GLOBCOVER_L4_200901_200912_V2_3")
var Land_Cover = Glob_Cover.select("landcover")
var Land_Cover_Quality = Glob_Cover.select("qa")
print(Glob_Cover,Land_Cover,Land_Cover_Quality)
Map.setCenter(107.56,34.79,4)
Map.addLayer(Land_Cover)
Map.addLayer(Land_Cover_Quality)
var L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT")
var L8_One = ee.Image(L8.filterBounds(ee.Geometry.Point(106.4958,29.5856)).first())
var L8_Slice = L8_One.slice(2,5)
print(L8_One,L8_Slice)
var L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT")
var L8_One = ee.Image(L8.filterBounds(ee.Geometry.Point(106.4958,29.5856)).first())
var L8_B5 = L8_One.select("B5")
var L8_B4 = L8_One.select("B4")
var L8_B4_5 = L8_B5.addBands(L8_B4)
print(L8_B4,L8_B5,L8_B4_5)
var L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT")
var L8_One = ee.Image(L8.filterBounds(ee.Geometry.Point(106.4958,29.5856)).first())
var L8_Reproject = L8_One.reproject("EPSG:3857",null,100)
print(L8_One.select("B1").projection(),L8_Reproject.projection())
Map.setCenter(106.58365,29.56972,15)
Map.addLayer(L8_One,{"band":["B5","B4","B3"],"min":10586,"max":18154},"30m")
Map.addLayer(L8_Reproject,{"band":["B5","B4","B3"],"min":10586,"max":18154},"100m")
var L8 = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT")
var L8_One = ee.Image(L8.filterBounds(ee.Geometry.Point(106.4958,29.5856)).first()).slice(2,5).unitScale(0,32468)
var L8_HSV = L8_One.rgbToHsv()
var L8_RGB = L8_HSV.hsvToRgb()
print(L8_One,L8_HSV,L8_RGB)
Map.setCenter(106.5,29.5,9)
Map.addLayer(L8_One,{},"Origin")
Map.addLayer(L8_HSV,{},"HSV")
Map.addLayer(L8_RGB,{},"RGB")
1.3 地形
var OldIMAGE = ee.Image('CGIAR/SRTM90_V4')
var NewlMAGE = OldIMAGE.derivative()
Map.setCenter(106.4448,29.5684,10)
Map.addLayer(NewlMAGE,{bands:['elevation_x'],min:-90,max:900},'Slope from Left to Right')
Map.addLayer(NewlMAGE,{bands:['elevation_y'],min:-90,max:900},'Slope from Top to Bottom')
var DEM = ee.Image('CGIAR/SRTM90_V4');
var Terrain = ee.Terrain.products(DEM)
Map.setCenter(106.371,29.6188)
Map.addLayer(DEM,{min:0,max:2000,palette:'000099,dddd00'},'Elevation');
Map.addLayer(Terrain,{bands:['slope'],min:0,max:90,palette:'000000,ff0000'},'Slope')
Map.addLayer(Terrain,{bands:['aspect'],palette:'00ff00,0000ff,00ff00'},'Aspect')
Map.addLayer(Terrain,{bands:['hillshade'],min:0,max:255},'Hillshading')
1.4 纹理
var DEM = ee.Image('CGIAR/SRTM90_V4');
var GLCM = DEM.glcmTexture(5,ee.Kernel.circle(5,'pixels',true ))
var Texture = GLCM.select(0)
print(GLCM,Texture )
Map.setCenter(106.1201,29.4977,10)
Map.addLayer(DEM,{min:0,max:1500,palette:["050dff","ddd3cd","0bff34","e4ff09","ff9007","ff1c05"]},'Original')
Map.addLayer(Texture,{min:0.0067,max:0.0115,palette:["050dff","ddd3cd","0bff34","e4ff09","ff9007","ff1c05"]},'Texture')
二、Image Collection
var L8_1 = ee.Image("LANDSAT/LC08/C01/T1_RT/LC08_127040_20130422")
var L8_2 = ee.Image("LANDSAT/LC08/C01/T1_RT/LC08_127039_20130422")
var Collection = ee.ImageCollection([L8_1,L8_2])
Map.setCenter(106.4925,29.574,7)
Map.addLayer(L8_1,{"bands":["B5","B4","B3"],"max":35000})
Map.addLayer(L8_2,{"bands":["B5","B4","B3"],"max":35000})
Map.addLayer(Collection,{"bands":["B5","B4","B3"],"max":35000})