Download satellites images with GEE Python API

Download satellites images with GEE Python API

First we need to Integrate Google Earth Engine library to our local system. For that you can view this link.

Below python code for download satellite images with GEE Python API



import ee

ee.Authenticate()
ee.Initialize()

Satellite_name = "COPERNICUS/S2"
# Get a download URL for an image. here we use Sentinel-2 satellite
image = ee.ImageCollection(Satellite_name).first() # first() for take first image from collection of image of sentinel-2 satellite

# getDownloadUrl function provide url for download data

path = image.getDownloadUrl({
'scale': 30, # for resolution of image
'crs': 'EPSG:4326', # which crs-transformation should apply
'region': '[[-120, 35], [-119.999, 35], [-119.9990, 34.9990], [-120, 34.999]]' # polygon region
})
# print downloadable link you can download image by click link printed by program
print (path)



Details about getDownloadURL function ee.Image.getDownloadURL

Get a Download URL
Returns returns a download URL, or undefined if a callback was specified.
UsageReturns
Image.getDownloadURL(params, callback)Object|String

ArgumentTypeDetails
this: imageImage
The Image instance.
paramsObject
An object containing download options with the following possible values:
  - name: a base name to use when constructing filenames.
  - bands: a description of the bands to download. Must be a list of dictionaries, each with the following keys:
    + id: the name of the band, a string, required.
    + crs: an optional CRS string defining the band projection.
    + crs_transform: an optional list of 6 numbers specifying an affine transform from the specified CRS, in row-major order:
[xScale, xShearing, xTranslation, yShearing, yScale, yTranslation]
    + dimensions: an optional list of two integers defining the width and height to which the band is cropped.
    + scale: an optional number, specifying the scale in meters of the band; ignored if crs and crs_transform is specified.
  - crs: a default CRS string to use for any bands that do not explicitly specify one.
  - crs_transform: a default affine transform to use for any bands that do not specify one, of the same format as the crs_transform of bands.
  - dimensions: default image cropping dimensions to use for any bands that do not specify them.
  - scale: a default scale to use for any bands that do not specify one; ignored if crs and crs_transform is specified.
  - region: a polygon specifying a region to download; ignored if crs and crs_transform is specified.
callbackFunction, optional
An optional callback. If not supplied, the call is made synchronously.

Comments

Popular posts from this blog

Get Started Using Python - Google Colab Notebook And Earth Engine Python API

Introduction to the Google Earth Engine Python API for Local system.