通过数据集名称加载数据
主要功能
通过数据集名称加载数据
代码
// Display an image given its ID.
var image = ee.Image('CGIAR/SRTM90_V4');
// Center the Map.
Map.setCenter(-110, 40, 5);
// Display the image.
Map.addLayer(image, {min: 0, max: 3000}, 'SRTM');
步骤分析
- 创建ee影像对象,通过影像数据集名称来筛选数据
- 地图对象设置显示中心,缩放等级
- 添加图层,设置显示参数
主要方法
- ee.Image()
An object to represent an Earth Engine image. This constructor accepts a variety of arguments:
- A string: an EarthEngine asset id,
- A string and a number - an EarthEngine asset id and version,
- A number or EEArray: creates a constant image,
- A list: creates an image out of each list element and combines them into a single image,
- An ee.Image: returns the argument,
- Nothing: results in an empty transparent image.
Arguments:
args (Image|List<Object>|Number|Object|String, optional):
Constructor argument.
Returns: Image
创建一个ee对象构造器,可以接受多种输入参数:
- 字符串参数,一个ee的asset id
- 字符串参数和一个数字,一个ee的asset id和版本号
- 一个数字或者一个ee的数组,创建一个常量图层
- 一个列表
- 一个ee影像对象,返回参数
- 空值,返回一个透明图层
- Map.setCenter()
Centers the map view at a given coordinates with the given zoom level.
Returns the map.
Arguments:
lon (Number):
The longitude of the center, in degrees.
lat (Number):
The latitude of the center, in degrees.
zoom (Number, optional):
The zoom level, from 1 to 24.
Returns: ui.Map
设置Map对象的中心值,经纬度,缩放等级
- 经纬度,十进制数值,东经为正,西经为负,北纬为正,南纬为负
- 缩放等级,从1到24级,1级为全球,24级为缩放最大
- Map.addLayer()
Adds a given EE object to the map as a layer.
Returns the new map layer.
Arguments:
eeObject (Collection|Feature|Image|MapId):
The object to add to the map.
visParams (FeatureVisualizationParameters|ImageVisualizationParameters, optional):
The visualization parameters. For Images and ImageCollection, see ee.data.getMapId for valid parameters. For Features and FeatureCollections, the only supported key is "color", as a CSS 3.0 color string or a hex string in "RRGGBB" format.
name (String, optional):
The name of the layer. Defaults to "Layer N".
shown (Boolean, optional):
A flag indicating whether the layer should be on by default.
opacity (Number, optional):
The layer's opacity represented as a number between 0 and 1. Defaults to 1.
Returns: ui.Map.Layer
添加一个已有的ee对象到Map对象中作为一个图层
输入参数:
- ee对象(Collection|Feature|Image|MapId)
- 显示参数
- 名称,赋予图层一个别名
- 默认是否显示,使用一个布尔值,默认为显示
- 透明度,1为不透明,0为透明