Skip to content

Batch export Google Earth Engine (GEE) tasks with `Tampermonkey`.

License

Notifications You must be signed in to change notification settings

gee-hydro/gee_monkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gee_monkey

Batch export Google Earth Engine (GEE) tasks with Tampermonkey.

  • Tired of click GEE tasks run button in browser?
  • Tired of translate JavaScript into python, because of JavaScript inconvenient batch exporting?
  • Tired of paste JavaScript into console?

Tampermonkey can solve those problems!

Functions

  • rAll : batch run all tasks
  • rInv : batch run all tasks in inverse order
  • cALL : cancel all tasks
  • cSub : only cancel submitted-to-backend tasks, and leave running-on-backend tasks
  • ntask: How many tasks to export? If not specified, it is all tasks.

to be continue

Tasks submitted to GEE have two kinds:

  1. task submitted-to-backend: just submitted and waiting in the queue
  2. task running-on-backend: submitted and running now (in skyblue backgroud)

Updates

  • 2021-09-22 (version 0.1.7)

    • update for task manager
    • timeout was replaced with async, which comes into effect for confirm_all and runAll in this version.
  • 2020-08-14 (version 0.1.5)

    • fix user-box error
  • 2019-09-17 (version 0.1.4)

    • add rInv and ntask
  • 2018-07-20

    • running-on-backend task's background is set to skyblue to distinguish submitted-to-backend task.

Free version

https://gis.stackexchange.com/questions/290771/batch-task-execution-in-google-earth-engine

/**
 * Copyright (c) 2017 Dongdong Kong. All rights reserved.
 * This work is licensed under the terms of the MIT license.  
 * For a copy, see <https://opensource.org/licenses/MIT>.
 *
 * Batch execute GEE Export task
 *
 * First of all, You need to generate export tasks. And run button was shown.
 *   
 * Then press F12 get into console, then paste those scripts in it, and press 
 * enter. All the task will be start automatically. 
 * (Firefox and Chrome are supported. Other Browsers I didn't test.)
 * 
 * @Author: 
 *  Dongdong Kong, 28 Aug' 2017, Sun Yat-sen University
 *  yzq.yang, 17 Sep' 2021
 */
function runTaskList(){
    // var tasklist = document.getElementsByClassName('task local type-EXPORT_IMAGE awaiting-user-config');
    // for (var i = 0; i < tasklist.length; i++)
    //         tasklist[i].getElementsByClassName('run-button')[0].click();
    $$('.run-button' ,$$('ee-task-pane')[0].shadowRoot).forEach(function(e) {
         e.click();
    })
}

function confirmAll() {
    // var ok = document.getElementsByClassName('goog-buttonset-default goog-buttonset-action');
    // for (var i = 0; i < ok.length; i++)
    //     ok[i].click();
    $$('ee-table-config-dialog, ee-image-config-dialog').forEach(function(e) {
         var eeDialog = $$('ee-dialog', e.shadowRoot)[0]
         var paperDialog = $$('paper-dialog', eeDialog.shadowRoot)[0]
         $$('.ok-button', paperDialog)[0].click()
    })
}

runTaskList();
confirmAll();

Pro version

Installation

You need chrome and Tampermonkey (firefox is also OK).
You also can submit tasks by your phone with firefox and Tampermonkey.

  • 1 Install Tampermonkey extension in chrome or firefox.
  • 2 Dashboard → New script → paste the script in gee_monkey → F5 refresh GEE website.

About

Batch export Google Earth Engine (GEE) tasks with `Tampermonkey`.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published