GEE批量run/cancel task

GEE批量run task

【2021年11月更新】

GEE已经优化了界面,在task manager中可直接一键批量取消任务。
GEE批量run/cancel task_第1张图片

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

注意
getElementsByClassName(‘task local type-EXPORT_IMAGE awaiting-user-config’);
记得修改Elements的名字!

GEE批量run/cancel task_第2张图片

// An highlighted block
/**
 * 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
 */
function runTaskList(){
    var tasklist = document.getElementsByClassName('task local type-EXPORT_FEATURES awaiting-user-config');
    for (var i = 0; i < tasklist.length; i++)
            tasklist[i].getElementsByClassName('run-button')[0].click();
}

function confirmAll() {
    var ok = document.getElementsByClassName('goog-buttonset-default goog-buttonset-action');
    for (var i = 0; i < ok.length; i++)
        ok[i].click();
}

runTaskList();
confirmAll();



/* cancel task 依葫芦画瓢*/

function cancelTaskList(){
    var tasklist = document.getElementsByClassName('task local type-EXPORT_FEATURES submitted-to-backend');
    for (var i = 0; i < tasklist.length; i++)
            tasklist[i].getElementsByClassName('indicator')[0].click();
}

function confirmAll() {
    var ok = document.getElementsByClassName('goog-buttonset-default goog-buttonset-action');
    for (var i = 0; i < ok.length; i++)
        ok[i].click();
}

cancelTaskList();
confirmAll();


你可能感兴趣的:(GEE,实用tips,javascript)