Google Earth Engine lets you export images, map tiles, tables and videos from Earth Engine. The exports can only be sent to your Google Drive account, to Google Cloud Storage or to a new Earth Engine asset. Satellite images are large in size so your free drive storage will fill up in no time and then you are a force to buy the storage which is not cheap if you are living in developing countries. But we can take advantage of the google python API to export the images, image collections directly to your local computer without uploading to your drive.
The Google Earth Engine (GEE) Python API facilitates interacting with Earth Engine servers using the Python programming language. It is available as a Python package that can be installed locally or within the cloud and accessed from a command-line interpreter or within a Jupyter notebook.
Set up Python API for GEE and continue following
Step 1
The Python API package is called ee
. It must also be initialized for every new session and script.
# import Google earth engine module import ee #Authenticate the Google earth engine with google account ee.Initialize()
Step 2
Load the Image or ImageCollection you like. In this example, the Landsat 8 image is Loaded to download
#load image
MyImage = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
Step 3
Create a Python function to get the download link:
#create function to download the image or imagecollection as you desire def downloader(ee_object,region): try: #download image if isinstance(ee_object, ee.image.Image): print('Its Image') url = ee_object.getDownloadUrl({ 'scale': 30, 'crs': 'EPSG:4326', 'region': region }) return url #download imagecollection elif isinstance(ee_object, ee.imagecollection.ImageCollection): print('Its ImageCollection') ee_object_new = ee_object.mosaic() url = ee_object_new.getDownloadUrl({ 'scale': 30, 'crs': 'EPSG:4326', 'region': region }) return url except: print("Could not download")
Step 4
Select the region or Area of Interest
geometry = ee.Geometry.Rectangle([80.058, 26.347, 82.201, 28.447]) region = geometry.toGeoJSONString()#region must in JSON format path = downloader(MyImage,region)#call function print(path)#print the download URL
Final step:
Copy the URL and paste it in any browser, the file will be downloaded.
Note that Google has a limitation of 1 GB per download.
Very much useful tutoria. How can I fixed date like a crop season like 2019-02-01 to 2029-05-30. May I set area of interest by shape file and if i want to download a large area like a hole country? Mosaic is needed?
Excellent Work.So we need to know how to adjust a time frame for the scene,for further analysis
This code did not work for me when downloading image collection. Can anyone offer some clarification?
Dear Simon, GEE has a limitation on the size of the image download. Try downloading an image with a size less than 1 gb
hello I am unable to download to my computer also I have less than 100mb image. what can i do next? if you have tutorial video than share me link
Dear Simon What can I do if I want this data by point, not by block? Thank you.