From e809c96d7b901fdd2eb68f085a9d74b9d01f7e9e Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 4 Jun 2021 15:36:27 -0400 Subject: [PATCH] Automatically set --cog if postprocessing is required (#155) --- libs/Task.js | 19 +++++++++++++++++++ package.json | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/libs/Task.js b/libs/Task.js index a6c6db9..5517e0f 100644 --- a/libs/Task.js +++ b/libs/Task.js @@ -84,6 +84,25 @@ module.exports = class Task{ } }, + cb => { + // If we need to post process results + // if cog is supported (build cloud optimized geotiffs) + // we automatically add the cog option to the task options by default + if (this.skipPostProcessing) cb(); + else{ + odmInfo.supportsOption("cog", (err, supported) => { + if (err){ + console.warn(`Cannot check for supported option cog: ${err}`); + }else if (supported){ + if (!this.options.find(opt => opt.name === "cog")){ + this.options.push({ name: 'cog', value: true }); + } + } + cb(); + }); + } + }, + // Read images info cb => { fs.readdir(this.getImagesFolderPath(), (err, files) => { diff --git a/package.json b/package.json index 3c27efc..a8bfb89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NodeODM", - "version": "2.1.6", + "version": "2.1.7", "description": "REST API to access ODM", "main": "index.js", "scripts": {