Package: gee2drive
gee2drive: Download Earth Engine Public and Private assets to Google DriveGoogle Earth Engine currently allows you to export images and assets as either GeoTiff files and tables as Shapefiles, GeoJSON, KML, KMZ or TFrecords. The system splits the files if the estimated size is greater than 2GB which is the upper limit and needs the geometry to be parsed in the form of either a fusion table, a user drawn geometry or a table imported into the user's assets. While the javascript frontend is great owing to the queryable catalog whereby you can search and and export your personal and private assets, the limitation lies in batch exports. To resolve this the python API access allows you to call batch export functions but now it is limited to checking for itersects first and running without having a queryable catalog. With the same idea I created this tool which allows you to run a terminal environment where your personal and general catalog images are part of a autosuggest feature. This tool allows you to look for images based on names for example " you can search for Sentinel and it will show you full path of images which have the word sentinel in the title". It also creates a report for your image collections and images so apart from the public datasets this can also find your own datasets as well. You can then generate bandlist to make sure all bands you are exporting are of the same type and then export all images that intersect you aoi.The assumption here isYou have enough free space in your google drive.Every image in the give image have the same band structure, choose the bandlist that you know to common to all imagesIf the geomery is too complex use the operator feature to use a bounding box instead.For now all it filters is geometry and date, and it is does not filter based on metadata (however in the examples folder I have shown how to import and use additional filter before exporting an image collection)Table of contentsInstallationGetting startedGoogle Earth Engine to Drive ManagerGEE to Google Drive CLIgee2drive refreshgee2drive idsearchgee2drive intersectgee2drive bandtypegee2drive exportInstallationThis assumes that you have native python & pip installed in your system, you can test this by going to the terminal (or windows command prompt) and trying. This assumes that you are also well aware of Google Earth Engine Python setup and have it installed and authetenticated on your system. If not you canread about it herepythonand thenpip listIf you get no errors and you have python 2.7.14 or higher you should be good to go. Please note that I have tested this only on python 2.7.15 but can be easily modified for python 3.To installPython CLI for Digital Oceanyou can install using two methodspip install gee2driveor trypip install gee2drive --useror you can also trygit clone https://github.com/samapriya/gee2drive.git
cd gee2drive
python setup.py installInstallation is an optional step; the application can be also run directly by executing gee2drive.py script. The advantage of having it installed is being able to execute ppipe as any command line tool. I recommend installation within virtual environment. If you don't want to install, browse into the gee2drive folder and trypython gee2drive.pyto get to the same result.Getting startedAs usual, to print help:usage: gee2drive [-h] {refresh,idsearch,intersect,bandtype,export} ...

Google Earth Engine to Drive Exporter

positional arguments:
  {refresh,idsearch,intersect,bandtype,export}
    refresh             Refreshes your personal asset list and GEE Asset list
    idsearch            Does possible matches using asset name to give you
                        asseth id/full path
    intersect           Exports a report of all assets(Personal & GEE)
                        intersecting with provided geometry
    bandtype            Prints bandtype and generates list to be used for
                        export
    export              Export Collections based on filter

optional arguments:
  -h, --help            show this help message and exitTo obtain help for a specific functionality, simply call it withhelpswitch, e.g.:gee2drive idsearch -h. If you didn't install gee2drive, then you can run it just by going togee2drivedirectory and runningpython gee2drive.py [arguments go here]GEE to Google Drive CLIThis tool is designed to augment to the existing facilty of image export using a CLI, whereby you can pass it arguments to filter based on an area of interest geojson file, a start and end date for collectiongee2drive refreshFor the past couple of months I havemaintained a catalog of the most current Google Earth Engine assets, within their raster data catalog. I update this list every week. This tool downloads the most current version of this list, and also looks into your personal assets to generate your very own asset report which then serve as a master dataset to feed into autosuggestions.gee2drive refresh -h
usage: gee2drive refresh [-h]

optional arguments:
  -h, --help  show this help message and exitgee2drive idsearchThere is a possibility that you don't really remember the full path to your asset or the public asset. Fortunately when I parse and collect the image list and path for you they have names that are searchable so use a keyword. for example search using "MODIS" or "sentinel". Also it is not case sensitive, so you should be able to type "SENTINEl" or "Sentinel" or "sentinel" and it should still work. This matches images based on provider, tags, title and id match.gee2drive idsearch -h
usage: gee2drive idsearch [-h] [--name NAME]

optional arguments:
  -h, --help   show this help message and exit
  --name NAME  Name or part of name to search forgee2drive intersectThis tool allows you to export a report of every asset present in the Earth Engine dataset list and your personal assets that intersects
with your geometry. The tool expects you to provide a start and end date and a geometry to filter. The tool uses the bounds() function to use a bounding box incase the geometry has a complex geometry or too many vertices simply use the operatorbb. If the geojson/json/kml keeps giving parsing error go togeojson.iousage: gee2drive intersect [-h] [--start START] [--end END] [--aoi AOI]
                              [--report REPORT] [--operator OPERATOR]

optional arguments:
  -h, --help           show this help message and exit
  --start START        Start date to filter image
  --end END            End date to filter image
  --aoi AOI            Full path to geojson/json/kml to be used for bounds
  --report REPORT      Full path where the report will be exported including
                       type, path & number of intersects

Optional named arguments for geometry only:
  --operator OPERATOR  Use bb for Bounding box incase the geometry is complex
                       or has too many verticesgee2drive bandtypeExport requires all the bandtypes to be of the same kind. To do this, I simply generate the band types for you and you can select the band list you want , remember to paste it as a list.usage: gee2drive bandtype [-h] [--id ID]

optional arguments:
  -h, --help  show this help message and exit
  --id ID     full path for collection or imagegee2drive exportFinally the export tool, that lets you export an image or a collection clipped to your AOI. This makes use of the bandlist you exported. Incase you are exporting an image and not a collection you don't need a start and end date. The tool uses the bounds() function to use a bounding box incase the geometry has a complex geometry or too many vertices simply use the operatorbb. If the geojson/json/kml keeps giving parsing error go togeojson.io. This tool now also allows you to export table,usage: gee2drive export [-h] [--id ID] [--folder FOLDER] [--type TYPE]
                        [--aoi AOI] [--start START] [--end END]
                        [--bandlist BANDLIST] [--operator OPERATOR]
                        [--ftype FTYPE]

optional arguments:
  -h, --help           show this help message and exit
  --id ID              Full path for collection or image
  --folder FOLDER      Drive folder path
  --type TYPE          Type whether image or collection
  --aoi AOI            Full path to geojson/json/kml to be used for bounds

Optional named arguments for image collection only:
  --start START        Start date to filter image
  --end END            End date to filter image
  --bandlist BANDLIST  Bandlist we generated from bandtype export must be same
                       bandtype
  --operator OPERATOR  Use bb for Bounding box incase the geometry is complex
                       or has too many vertices
  --ftype FTYPE        Used only for exporting table choose SHP, KML, KMZ,
                       GeoJSON, TFRECORDA typical setup would be--bandlist ['B2','B3','B4'] --operator "bb" --type "collection"Changelogv0.1.0Major revision to overall tool and general improvementsUpdated methodology to get private and public asset list.Now supports export of table apart from image and image collection.Asset search improved to include tags, provider and id path.v0.0.6Now export report of all assets intersecting with geometry & date rangeMinor fixes and general improvementsv0.0.4Can now parse geojson, json,kmlMinor fixes and general improvementsv0.0.3Minor Fixes