ee.FeatureCollection.distinct

Entfernt Duplikate aus einer Sammlung. Duplikate werden anhand eines starken Hashs der serialisierten Form der ausgewählten Attribute ermittelt.

NutzungAusgabe
FeatureCollection.distinct(properties)FeatureCollection
ArgumentTypDetails
So gehts: collectionFeatureCollectionDie Eingabesammlung, aus der Objekte ausgewählt werden.
propertiesObjektEin Attributname oder eine Liste von Attributnamen, die für den Vergleich verwendet werden sollen. Die Eigenschaft „.geo“ kann verwendet werden, um Objektgeometrien zu vergleichen.

Beispiele

Code-Editor (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 einrichten

Informationen zur Python API und zur Verwendung von geemap für die interaktive Entwicklung finden Sie auf der Seite Python-Umgebung.

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