ee.FeatureCollection.distinct
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Supprime les doublons d'une collection. Notez que les doublons sont identifiés à l'aide d'un hachage fort sur la forme sérialisée des propriétés sélectionnées.
Utilisation | Renvoie |
---|
FeatureCollection.distinct(properties) | FeatureCollection |
Argument | Type | Détails |
---|
ceci : collection | FeatureCollection | Collection d'entrée à partir de laquelle les objets seront sélectionnés. |
properties | Objet | Nom ou liste de noms de propriétés à utiliser pour la comparaison. La propriété ".geo" peut être incluse pour comparer les géométries des objets. |
Exemples
Éditeur de code (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'));
Configuration de Python
Consultez la page
Environnement Python pour en savoir plus sur l'API Python et sur l'utilisation de geemap
pour le développement interactif.
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())
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eThe \u003ccode\u003edistinct()\u003c/code\u003e method removes duplicate features from a FeatureCollection based on specified properties or geometry.\u003c/p\u003e\n"],["\u003cp\u003eDuplicates are identified using a strong hash of the serialized form of the selected properties or '.geo' for geometry.\u003c/p\u003e\n"],["\u003cp\u003eThe method accepts a property name, a list of property names, or '.geo' as input for comparison.\u003c/p\u003e\n"],["\u003cp\u003eIt returns a new FeatureCollection containing only the unique features.\u003c/p\u003e\n"],["\u003cp\u003eThe original FeatureCollection remains unchanged.\u003c/p\u003e\n"]]],["The `distinct` method removes duplicate features from a `FeatureCollection`. Duplicates are identified by comparing the serialized form of specified properties using a strong hash. The `properties` argument defines the comparison criteria, accepting a single property name or a list, including '.geo' for geometry. The method returns a new `FeatureCollection` with the duplicates removed. Examples are provided for both JavaScript and Python, using power plants in Belgium and properties like 'fuel1', 'source' or geometry to remove duplicates.\n"],null,["# ee.FeatureCollection.distinct\n\nRemoves duplicates from a collection. Note that duplicates are determined using a strong hash over the serialized form of the selected properties.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------------------|-------------------|\n| FeatureCollection.distinct`(properties)` | FeatureCollection |\n\n| Argument | Type | Details |\n|--------------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| this: `collection` | FeatureCollection | The input collection from which objects will be selected. |\n| `properties` | Object | A property name or a list of property names to use for comparison. The '.geo' property can be included to compare object geometries. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// FeatureCollection of power plants in Belgium.\nvar fc = ee.FeatureCollection('WRI/GPPD/power_plants')\n .filter('country_lg == \"Belgium\"');\nprint('FeatureCollection of power plants in Belgium', fc);\n\n// Remove duplicate features according to property values.\nprint('Distinct based on a single property', fc.distinct('fuel1'));\nprint('Distinct based on two properties', fc.distinct(['fuel1', 'source']));\nprint('Distinct based on geometry', fc.distinct('.geo'));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# FeatureCollection of power plants in Belgium.\nfc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(\n 'country_lg == \"Belgium\"')\nprint('FeatureCollection of power plants in Belgium:', fc.getInfo())\n\n# Remove duplicate features according to property values.\nprint('Distinct based on a single property:', fc.distinct('fuel1').getInfo())\nprint('Distinct based on two properties:',\n fc.distinct(['fuel1', 'source']).getInfo())\nprint('Distinct based on geometry', fc.distinct('.geo').getInfo())\n```"]]