Google Earth Engine FeatureCollection getDownloadURL returns empty CSV

by Thailynn Munroe   Last Updated July 11, 2019 20:22 PM

I am trying to create a link that lets me or users of my app download a feature collection as a CSV directly from the map. However, when using ee.FeatureCollection.getDownloadURL, the csv that it downloads is always empty. When I print the feature collection to the screen there are features and attributes there. Any ideas as to why it's outputting an empty CSV?

Here is the part of my script that is outputting the download url:

  var output_fc = ee.FeatureCollection(leng.map(function(x){
    var dict = {class_name: to.get(x), class_area: class_areas_results.get(x), tree_cover_loss_area: tcl_results.get(x), tree_cover_gain_area: tc_gain_results.get(x), 
    avg_tree_area: avg_tree_area_results.get(x), tcd_00: tcd_00_results.get(x), tcd_10: tcd_10_results.get(x)};
    var feature = ee.Feature(null, dict);
    return feature;
  }));

  var download = (ui.Label('Download').setUrl((ee.FeatureCollection(output_fc).getDownloadURL({
    format: 'CSV',
    filename: 'changeAreas'
  }))))

  panel.add(download)

  print(output_fc)


Related Questions


Updated November 18, 2018 20:22 PM

Updated June 20, 2018 19:22 PM

Updated February 20, 2019 02:22 AM

Updated November 14, 2017 05:22 AM

Updated February 12, 2019 20:22 PM