I am still relatively new to Google Earth Engine, but had a question about getting the download URLs for each image in an Image Collection. The question is exactly that, how do I obtain the set of download urls for each image in an imagery collection--given that I have pared each image down to a reasonable size.
Note, I did look through Stackoverflow and found an existing question about downloading a single image to a google Drive, but this question does not provide any information about image collections.
how to download images using google earth engine's python API
The following bit of code will generate some small image patches of Landsat 8 imagery. Each patch is only a handful of kb in size.
import ee
ee.Initialize()
col = ee.ImageCollection('LANDSAT/LC08/C01/T1').select('B8')
col.filterDate('1/1/2015', '1/30/2015')
boundary_region = ee.Geometry.Point([-2.40986111110000012, 26.76033333330000019]).buffer(300)
col.filterBounds(boundary_region)
def clipper(image):
return image.clip(region)
col.map(clipper)
Now I would like to download each image in the collection col
.
Earth Engine provides a couple of ways to iterate over imagery collections: the map()
and iterate()
functions, but apparently both of those functions do not work for the download functions.
Now it seems like once I can generate the url for a single image using the function:
boundary_geojson = ee.Geometry.Polygon(boundary_region.bounds().getInfo().coordinates[0]).toGeoJSONString()
def downloader(image):
url = ee.data.makeDownloadUrl(
ee.data.getDownloadId({
'image': image.serialize(),
'scale': 30,
'filePerBand': 'false',
'name': 'test',
'region': boundary_geojson,
}))
return url
Note, for some reason I can't seem to get the boundary_geojson
variable to work properly.
now the set of urls should be a call as simple as
col.map(downloader)
but that does not work.
Does anyone know how to generate the list of urls the correspond to the images in an image collection?