My Google Earth Engine app allows you to select a raster layer and then download that layer as a zip containing a tif. Here is the javascript code in the GEE IDE for the downloading part:

function downloadImg() {
  var viewBounds = ee.Geometry.Rectangle(Map.getBounds()); // CHANGE BOUNDARIES TO SHAPEFILE
  var downloadArgs = {
    name: 'sample_image',
    crs: 'EPSG:4326',
    region: viewBounds.toGeoJSONString()

 var img = imgCol.first(); 

 var url =img.getDownloadURL(downloadArgs);
 urlLabel.style().set({shown: true});

// Add UI elements to the Map.
var downloadButton = ui.Button('Get download link', downloadImg);
var urlLabel = ui.Label('Download', {shown: false});
var buttons = ui.Panel([downloadButton, urlLabel]);

This protoype just auto-selects the first layer in my ImageCollection right now.

I want to add widgets to allow the user to upload a shapefile and only download the raster data within that shapefile. It would also be great to be able to draw a polygon and download that shape.

1 Answer 1


Apps can't do upload and can only do download through getDownloadUrl or getThumbnail.

  • I was hoping this wouldn't be the case. Do you know if something similar is achievable through other means? I'm trying to achieve something like this: rangelands.app/rap
    – ags
    Oct 17, 2021 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.