ee.FeatureCollection.distinct

นำรายการที่ซ้ำกันออกจากคอลเล็กชัน โปรดทราบว่าระบบจะพิจารณาว่ารายการใดซ้ำกันโดยใช้แฮชที่รัดกุมในรูปแบบที่แปลงเป็นอนุกรมของพร็อพเพอร์ตี้ที่เลือก

การใช้งานการคืนสินค้า
FeatureCollection.distinct(properties)FeatureCollection
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ collectionFeatureCollectionคอลเล็กชันอินพุตที่จะเลือกออบเจ็กต์
propertiesวัตถุชื่อพร็อพเพอร์ตี้หรือรายการชื่อพร็อพเพอร์ตี้ที่จะใช้เปรียบเทียบ คุณสามารถรวมพร็อพเพอร์ตี้ ".geo" เพื่อเปรียบเทียบรูปทรงเรขาคณิตของออบเจ็กต์

ตัวอย่าง

โปรแกรมแก้ไขโค้ด (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'));

การตั้งค่า Python

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า สภาพแวดล้อม Python

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())