ee.FeatureCollection.getDownloadURL

Récupère une URL de téléchargement. Lorsque l'URL est consultée, la FeatureCollection est téléchargée dans l'un des formats suivants.

Renvoie une URL de téléchargement ou "undefined" si un rappel a été spécifié.

UtilisationRenvoie
FeatureCollection.getDownloadURL(format, selectors, filename, callback)Object|String
ArgumentTypeDétails
ceci : featurecollectionFeatureCollectionInstance FeatureCollection.
formatChaîne, facultativeFormat du téléchargement : "csv", "json", "geojson", "kml" ou "kmz" ("json" génère un fichier GeoJSON). Si aucune valeur n'est spécifiée, la valeur par défaut est "csv".
selectorsList<String>|String, facultatifNoms des propriétés des entités utilisés pour sélectionner les attributs à télécharger. Si aucune n'est spécifiée, toutes les propriétés sont incluses.
filenameChaîne, facultativeNom du fichier à télécharger. L'extension est ajoutée par défaut. Si aucune valeur n'est spécifiée, la valeur par défaut est "table".
callbackFonction, facultatifUn rappel facultatif. Si ce paramètre n'est pas spécifié, l'appel est effectué de manière synchrone.

Exemples

Éditeur de code (JavaScript)

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

// Get a download URL for the FeatureCollection.
var downloadUrl = fc.getDownloadURL({
  format: 'CSV',
  selectors: ['capacitymw', 'fuel1'],
  filename: 'belgian_power_plants'
});
print('URL for downloading FeatureCollection as CSV', downloadUrl);

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"')

# Get a download URL for the FeatureCollection.
download_url = fc.getDownloadURL(**{
  'filetype': 'CSV',
  'selectors': ['capacitymw', 'fuel1'],
  'filename': 'belgian_power_plants',
})
print('URL for downloading FeatureCollection as CSV:', download_url)