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.setUrl(url);
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]);
c.controlPanel.add(buttons);
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.