ee.FeatureCollection.distinct

Xoá các phần tử trùng lặp khỏi một bộ sưu tập. Xin lưu ý rằng các bản sao được xác định bằng cách sử dụng hàm băm mạnh trên dạng được chuyển đổi tuần tự của các thuộc tính đã chọn.

Cách sử dụngGiá trị trả về
FeatureCollection.distinct(properties)FeatureCollection
Đối sốLoạiThông tin chi tiết
this: collectionFeatureCollectionTập hợp đầu vào mà các đối tượng sẽ được chọn.
propertiesĐối tượngTên thuộc tính hoặc danh sách tên thuộc tính cần dùng để so sánh. Bạn có thể thêm thuộc tính ".geo" để so sánh các hình học đối tượng.

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('FeatureCollection of power plants in Belgium', fc);

// Remove duplicate features according to property values.
print('Distinct based on a single property', fc.distinct('fuel1'));
print('Distinct based on two properties', fc.distinct(['fuel1', 'source']));
print('Distinct based on geometry', fc.distinct('.geo'));

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('FeatureCollection of power plants in Belgium:', fc.getInfo())

# Remove duplicate features according to property values.
print('Distinct based on a single property:', fc.distinct('fuel1').getInfo())
print('Distinct based on two properties:',
      fc.distinct(['fuel1', 'source']).getInfo())
print('Distinct based on geometry', fc.distinct('.geo').getInfo())