From 029c26cf310d3eaa638eee1252ac099d395c283e Mon Sep 17 00:00:00 2001 From: Thomas Gratier Date: Thu, 11 Nov 2021 02:44:26 +0100 Subject: [PATCH] Add support to use manifest.js file in mapshaper-guix --- bin/mapshaper-gui | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/mapshaper-gui b/bin/mapshaper-gui index 662ceccf0..2f2fe740a 100755 --- a/bin/mapshaper-gui +++ b/bin/mapshaper-gui @@ -10,6 +10,7 @@ var defaultPort = 5555, .option('-f, --force-save', 'allow overwriting input files with output files') .option('-a, --display-all', 'turn on visibility of all layers') .option('-t, --target ', 'name of layer to select initially') + .option('-m, --manifest ', 'name of layer to select initially') .helpOption('-h, --help', 'show this help message') .version(require('../package.json').version) .parse(), @@ -69,7 +70,12 @@ function startServer(port) { new Cookies(request, response).set('session_id', sessionId); } // serve JS file containing manifest of files for mapshaper to load - serveContent(getManifestJS(dataFiles, opts), response, getMimeType(uri)); + if (opts.manifest) { + var contentManifest = fs.readFileSync(opts.manifest, 'utf-8'); + } else { + var contentManifest = getManifestJS(dataFiles, opts); + } + serveContent(contentManifest, response, getMimeType(uri)); } else if (uri.indexOf('/data/') === 0) { // serve a file from a path relative to this script // assumed to be a data file from the cmd line (!)