ee.FeatureCollection.union

Hợp nhất tất cả các hình học trong một tập hợp nhất định thành một hình học và trả về một tập hợp chứa một đối tượng duy nhất chỉ có mã nhận dạng "union_result" và một hình học.

Cách sử dụngGiá trị trả về
FeatureCollection.union(maxError)FeatureCollection
Đối sốLoạiThông tin chi tiết
this: collectionFeatureCollectionBộ sưu tập đang được hợp nhất.
maxErrorErrorMargin, mặc định: nullSai số tối đa được phép khi thực hiện bất kỳ phép chiếu lại cần thiết nào. Nếu không được chỉ định, giá trị mặc định sẽ là sai số được yêu cầu từ đầu ra.

Ví dụ

Trình soạn thảo mã (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

print('Original FeatureCollection', fc);

// Merge all geometries into one. A FeatureCollection with a single feature
// with no properties is returned.
print('All geometries merged into one', fc.union(1));

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về API Python và cách sử dụng geemap cho quá trình phát triển tương tác.

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"')

print('Original FeatureCollection:', fc.getInfo())

# Merge all geometries into one. A FeatureCollection with a single feature
# with no properties is returned.
print('All geometries merged into one:', fc.union(1).getInfo())