要素緩沖區(qū)功能實(shí)現(xiàn)
主要功能
對(duì)指定要素執(zhí)行緩沖區(qū)分析宇弛。
獲取舊金山BART點(diǎn)位置枪芒,做2KM緩沖區(qū)谁尸,顯示結(jié)果。
代碼
// Feature buffer example.
// Display the area within 2 kilometers of San Francisco BART stations.
// Instantiate a FeatureCollection of BART locations in Downtown San Francisco
// (points).
var stations = [
ee.Feature(
ee.Geometry.Point(-122.42, 37.77), {'name': '16th St. Mission (16TH)'}),
ee.Feature(
ee.Geometry.Point(-122.42, 37.75), {'name': '24th St. Mission (24TH)'}),
ee.Feature(
ee.Geometry.Point(-122.41, 37.78),
{'name': 'Civic Center/UN Plaza (CIVC)'})
];
var bartStations = ee.FeatureCollection(stations);
// Map a function over the collection to buffer each feature.
var buffered = bartStations.map(function(f) {
return f.buffer(2000, 100); // Note that the errorMargin is set to 100.
});
Map.addLayer(buffered, {color: '800080'});
Map.setCenter(-122.4, 37.7, 11);
步驟分析
- 創(chuàng)建地理要素集,使用自定義坐標(biāo)决瞳,屬性
- 對(duì)要素集執(zhí)行緩沖區(qū)
- 添加緩沖區(qū)圖層
- 設(shè)置地圖中心,縮放等級(jí)
主要方法
- ee.Feature.buffer()
Returns the input buffered by a given distance. If the distance is positive, the geometry is expanded, and if the distance is negative, the geometry is contracted.
Arguments:
this:feature (Element): The feature the geometry of which is being buffered.
distance (Float): The distance of the buffering, which may be negative. If no projection is specified, the unit is meters. Otherwise the unit is in the coordinate system of the projection.
maxError (ErrorMargin, default: null): The maximum amount of error tolerated when approximating the buffering circle and performing any necessary reprojection. If unspecified, defaults to 1% of the distance.
proj (Projection, default: null): If specified, the buffering will be performed in this projection and the distance will be interpreted as units of the coordinate system of this projection. Otherwise the distance is interpereted as meters and the buffering is performed in a spherical coordinate system.
Returns: Feature
緩沖區(qū)功能,對(duì)地理要素進(jìn)行換出去分析屡贺。
輸入?yún)?shù):進(jìn)行緩沖區(qū)分析的地理要素,緩沖區(qū)分析距離泻仙,容差量没,坐標(biāo)系