Interactive interface for browsing global, full-resolution satellite imagery
extractConfigFromWMTS.js conversion wip
ZachTRice6bfe79e6152a
diff --git a/tasks/node/extractConfigFromWMTS.js b/tasks/node/extractConfigFromWMTS.jsindex f0497a283..972f87f16 100755--- a/tasks/node/extractConfigFromWMTS.js+++ b/tasks/node/extractConfigFromWMTS.js@@ -46,7 +46,7 @@ if (!fs.existsSync(outputDir)) {fs.mkdirSync(outputDir)}-// const tolerant = config.tolerant+const tolerant = config.tolerantconst entries = config['wv-options-wmts']// let skip = []@@ -80,13 +80,48 @@ async function processLayer (gcLayer, wvLayers, entry) {}async function processEntry (entry) {+ const inputFile = path.join(inputDir, entry.from)+ const gcId = path.basename(inputFile)++ const wv = {+ layers: {},+ sources: {}+ }+ const wvMatrixSets = {}++ let gc+try {- processLayer()+ fs.readFileSync(inputFile)+ const gcXML = fs.readFileSync(inputFile, { encoding: 'utf-8' })+ gc = convert.xml2json(gcXML, { compact: true, spaces: 2 })+ gc = JSON.parse(gc)} catch (error) {+ if (tolerant) {+ warningCount += 1+ console.warn(`${prog}: WARN: ${inputFile} Unable to get GC: ${error}`)+ } else {+ errorCount += 1+ console.error(`${prog}: ERROR: ${inputFile} Unable to get GC: ${error}`)+ }+ return { layerCount, warningCount, errorCount }+ }+ // TODO: errors can go uncaught here+ gcContents = gc.Capabilities.Contents+ wvLayers = wv.layers++ if (!gcContents || !gcContents.Layer) {+ errorCount += 1+ console.error(`${prog}: ERROR: ${gcId} No Layers`)+ return { layerCount, warningCount, errorCount }}}+async function processMatrixSet (gcMatricSet) {++}+main().catch((err) => {console.error(err.stack)})diff --git a/tasks/node/getCapabilities.js b/tasks/node/getCapabilities.jsindex 93a355e11..494163e32 100755--- a/tasks/node/getCapabilities.js+++ b/tasks/node/getCapabilities.js@@ -9,7 +9,6 @@ const stream = require('stream')const finished = promisify(stream.finished)const prog = path.basename(__filename)-// const baseDir = path.join(__dirname, '..');const options = yargs.usage('Usage: $0 [options]')@@ -27,8 +26,6 @@ const options = yargs}).epilog('Pulls GetCapabilities XML and linked metadata from configured locations')-// import config file from ./config/default/release/config.json-const { argv } = optionsif (!argv.config && !argv.getcapabilities) {throw new Error('Invalid number of arguments')@@ -61,7 +58,6 @@ async function main () {if (vectordata) {await gatherProcess(vectordata, 'vectordatas', vectordataDir, '.json')}- // process.exit();}async function getCapabilities () {