標記特定像素
主要功能
標記大于1000m的像素點,標記等于1000m的像素點
代碼
// Collection.distance example.
// Computes the distance to the nearest feature in a collection.
// Construct a FeatureCollection from a list of geometries.
var fc = ee.FeatureCollection([
ee.Geometry.Point(-72.94411, 41.32902),
ee.Geometry.Point(-72.94411, 41.33402),
ee.Geometry.Point(-72.94411, 41.33902),
// The geometries do not need to be the same type.
ee.Geometry.LineString(
-72.93411, 41.30902, -72.93411, 41.31902, -72.94411, 41.31902)
]);
// Compute distance from the dfeatures, to a max of 1000 meters.
var distance = fc.distance(1000, 100);
Map.setCenter(-72.94, 41.32, 13);
Map.addLayer(distance, {min: 0, max: 1000, palette: ['yellow', 'red']});
Map.addLayer(fc);
步驟分析
- 創(chuàng)建ee對象,使用自定義坐標來創(chuàng)建的了點和線的混合要素集合。
- 計算與要素距離在設置范圍中的部分。
- 添加圖層,設置顯示方式。
主要方法
- ee.feature.distance()
Returns the minimum distance between the geometries of two features.
Arguments:
this:left (Element): The feature containing the geometry used as the left operand of the operation.
right (Element): The feature containing the geometry used as the right operand of the operation.
maxError (ErrorMargin, default: null): The maximum amount of error tolerated when performing any necessary reprojection.
proj (Projection, default: null): The projection in which to perform the operation. If not specified, the operation will be performed in a spherical coordinate system, and linear distances will be in meters on the sphere.
計算兩個地理要素之間的最小距離。
輸入?yún)?shù): 左操作數(shù)(計算結果)、右操作數(shù)(計算使用的要素)、容差、投影坐標系。
返回值:浮點型地理要素距離計算結果。