GEE影像数据集裁剪

影像数据集裁剪过滤

主要功能

对影像数据集进行要素裁剪,使用边界来获取特定区域数据。

代码

// Filter an image collection by date and region to make a
// median pixel composite.
//
// See also: ClippedComposite, which crops the output image
// instead of filtering the input collection.

// Filter to only include images intersecting Colorado or Utah.
var polygon = ee.Geometry.Polygon({
  coords: [[[-109.05, 37.0], [-102.05, 37.0], [-102.05, 41.0], // Colorado
            [-109.05, 41.0], [-111.05, 41.0], [-111.05, 42.0], // Utah
            [-114.05, 42.0], [-114.05, 37.0], [-109.05, 37.0]]],
  geodesic: false
});

// Create a Landsat 7 composite for Spring of 2000, and filter by
// the bounds of the FeatureCollection.
var collection = ee.ImageCollection('LANDSAT/LE07/C01/T1')
    .filterDate('2000-04-01', '2000-07-01')
    .filterBounds(polygon);

// Compute the median in each band, in each pixel.
var median = collection.median();

// Select the red, green and blue bands.
var result = median.select('B3', 'B2', 'B1');
Map.addLayer(result, {gain: [1.4, 1.4, 1.1]});
Map.setCenter(-110, 40, 5);

步骤分析

  1. 创建多边形对象,使用自定义要素坐标来定义
  2. 创建影像数据集对象,使用名称,日期,多边形来裁剪
  3. 计算影像数据集的中值
  4. 选择用于展示结果的三个波段
  5. 添加图层,定义图层增强
  6. 设置地图中心,缩放等级

主要方法

  1. ee.Geometry.Polygon()
    Constructs an ee.Geometry describing a polygon.
    For convenience, varargs may be used when all arguments are numbers. This allows creating geodesic EPSG:4326 Polygons with a single LinearRing given an even number of arguments, e.g. ee.Geometry.Polygon(aLng, aLat, bLng, bLat, ..., aLng, aLat).
    Arguments:
    coords (List|List>>|List):
    A list of rings defining the boundaries of the polygon. May be a list of coordinates in the GeoJSON 'Polygon' format, a list of ee.Geometry describing a LinearRing, or a list of number defining a single polygon boundary.
    proj (Projection, optional):
    The projection of this geometry. The default is the projection of the inputs, where Numbers are assumed to be EPSG:4326.
    geodesic (Boolean, optional):
    If false, edges are straight in the projection. If true, edges are curved to follow the shortest path on the surface of the Earth. The default is the geodesic state of the inputs, or true if the inputs are numbers.
    maxError (ErrorMargin, optional):
    Max error when input geometry must be reprojected to an explicitly requested result projection or geodesic state.
    evenOdd (Boolean, optional):
    If true, polygon interiors will be determined by the even/odd rule, where a point is inside if it crosses an odd number of edges to reach a point at infinity. Otherwise polygons use the left- inside rule, where interiors are on the left side of the shell's edges when walking the vertices in the given order. If unspecified, defaults to true.
    Returns: Geometry.Polygon

创建一个ee地理多边形对象。方便起见,也可以使用参数全部为数字形式,来定义一个多边形。默认的投影为EPSG:4326,需要输入一个环的坐标(经度1纬度1,经度2纬度2,经度3纬度3,。。。经度1纬度1)
输入参数:
拐点坐标,投影,geodesic,maxError,evenOdd

  1. ee.Collection.filterBounds()
    Shortcut to filter a collection by geometry. Items in the collection with a footprint that fails to intersect the bounds will be excluded when the collection is evaluated.
    This is equivalent to this.filter(ee.Filter.bounds(...)).
    Returns the filtered collection.
    Arguments:
    this:collection (Collection):
    The Collection instance.
    geometry (Feature|Geometry):
    The geometry to filter to.
    Returns: Collection

空间"相交"操作,选择重叠部分。
输入参数:影像数据集,地理要素对象。

你可能感兴趣的:(GEE影像数据集裁剪)