mapshaper 0.6.19 → 0.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mapshaper.js +157 -74
- package/package.json +1 -1
- package/www/index.html +2 -0
- package/www/mapshaper-gui.js +131 -74
- package/www/mapshaper.js +157 -74
- package/www/page.css +17 -7
package/www/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.6.
|
|
3
|
+
var VERSION = "0.6.20";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
get defaults () { return defaults; },
|
|
31
31
|
get extend () { return extend$1; },
|
|
32
32
|
get inherit () { return inherit; },
|
|
33
|
+
get promisify () { return promisify; },
|
|
33
34
|
get reduceAsync () { return reduceAsync; },
|
|
34
35
|
get merge () { return merge; },
|
|
35
36
|
get difference () { return difference; },
|
|
@@ -318,6 +319,19 @@
|
|
|
318
319
|
targ.prototype.__super__ = f;
|
|
319
320
|
}
|
|
320
321
|
|
|
322
|
+
function promisify(asyncFn) {
|
|
323
|
+
return function() {
|
|
324
|
+
var args = toArray(arguments);
|
|
325
|
+
return new Promise((resolve, reject) => {
|
|
326
|
+
var cb = function(err, data) {
|
|
327
|
+
if (err) reject(err);
|
|
328
|
+
else resolve(data);
|
|
329
|
+
};
|
|
330
|
+
args.push(cb);
|
|
331
|
+
asyncFn.apply(this, args);
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
}
|
|
321
335
|
|
|
322
336
|
// Call @iter on each member of an array (similar to Array#reduce(iter))
|
|
323
337
|
// iter: function(memo, item, callback)
|
|
@@ -9956,6 +9970,10 @@
|
|
|
9956
9970
|
// base async inflate fn
|
|
9957
9971
|
var bInflt = function () { return [u8, u16, u32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gu8]; };
|
|
9958
9972
|
var bDflt = function () { return [u8, u16, u32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };
|
|
9973
|
+
// gzip extra
|
|
9974
|
+
var gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };
|
|
9975
|
+
// gunzip extra
|
|
9976
|
+
var guze = function () { return [gzs, gzl]; };
|
|
9959
9977
|
// post buf
|
|
9960
9978
|
var pbf = function (msg) { return postMessage(msg, [msg.buffer]); };
|
|
9961
9979
|
// get u8
|
|
@@ -10047,6 +10065,17 @@
|
|
|
10047
10065
|
function inflateSync(data, out) {
|
|
10048
10066
|
return inflt(data, out);
|
|
10049
10067
|
}
|
|
10068
|
+
function gzip(data, opts, cb) {
|
|
10069
|
+
if (!cb)
|
|
10070
|
+
cb = opts, opts = {};
|
|
10071
|
+
if (typeof cb != 'function')
|
|
10072
|
+
err(7);
|
|
10073
|
+
return cbify(data, opts, [
|
|
10074
|
+
bDflt,
|
|
10075
|
+
gze,
|
|
10076
|
+
function () { return [gzipSync$1]; }
|
|
10077
|
+
], function (ev) { return pbf(gzipSync$1(ev.data[0], ev.data[1])); }, 2, cb);
|
|
10078
|
+
}
|
|
10050
10079
|
/**
|
|
10051
10080
|
* Compresses data with GZIP
|
|
10052
10081
|
* @param data The data to compress
|
|
@@ -10061,6 +10090,17 @@
|
|
|
10061
10090
|
var d = dopt(data, opts, gzhl(opts), 8), s = d.length;
|
|
10062
10091
|
return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;
|
|
10063
10092
|
}
|
|
10093
|
+
function gunzip(data, opts, cb) {
|
|
10094
|
+
if (!cb)
|
|
10095
|
+
cb = opts, opts = {};
|
|
10096
|
+
if (typeof cb != 'function')
|
|
10097
|
+
err(7);
|
|
10098
|
+
return cbify(data, opts, [
|
|
10099
|
+
bInflt,
|
|
10100
|
+
guze,
|
|
10101
|
+
function () { return [gunzipSync$1]; }
|
|
10102
|
+
], function (ev) { return pbf(gunzipSync$1(ev.data[0])); }, 3, cb);
|
|
10103
|
+
}
|
|
10064
10104
|
/**
|
|
10065
10105
|
* Expands GZIP data
|
|
10066
10106
|
* @param data The data to decompress
|
|
@@ -10529,6 +10569,15 @@
|
|
|
10529
10569
|
return files;
|
|
10530
10570
|
}
|
|
10531
10571
|
|
|
10572
|
+
function runningInBrowser() {
|
|
10573
|
+
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
10574
|
+
}
|
|
10575
|
+
|
|
10576
|
+
var Env = /*#__PURE__*/Object.freeze({
|
|
10577
|
+
__proto__: null,
|
|
10578
|
+
runningInBrowser: runningInBrowser
|
|
10579
|
+
});
|
|
10580
|
+
|
|
10532
10581
|
// Checks if @arg is a Uint8Array containing gzipped data
|
|
10533
10582
|
function isGzipped(arg) {
|
|
10534
10583
|
return arg.length > 2 && arg.buffer instanceof ArrayBuffer && arg[0] == 0x1f && arg[1] == 0x8b;
|
|
@@ -10540,7 +10589,30 @@
|
|
|
10540
10589
|
if (typeof content == 'string') {
|
|
10541
10590
|
content = strToU8(content);
|
|
10542
10591
|
}
|
|
10543
|
-
|
|
10592
|
+
if (runningInBrowser()) {
|
|
10593
|
+
return gzipSync$1(content, opts);
|
|
10594
|
+
}
|
|
10595
|
+
return require('zlib').gzipSync(content, opts);
|
|
10596
|
+
}
|
|
10597
|
+
|
|
10598
|
+
async function gzipAsync(content, opts) {
|
|
10599
|
+
if (typeof content == 'string') {
|
|
10600
|
+
content = strToU8(content);
|
|
10601
|
+
}
|
|
10602
|
+
var gzip$1 = runningInBrowser() ? utils.promisify(gzip) : utils.promisify(require('zlib').gzip);
|
|
10603
|
+
return gzip$1(content, opts);
|
|
10604
|
+
}
|
|
10605
|
+
|
|
10606
|
+
async function gunzipAsync(buf, opts) {
|
|
10607
|
+
if (buf instanceof ArrayBuffer) {
|
|
10608
|
+
buf = new Uint8Array(buf);
|
|
10609
|
+
}
|
|
10610
|
+
opts = opts || {};
|
|
10611
|
+
var out = await utils.promisify(gunzip)(buf, opts);
|
|
10612
|
+
if (opts.filename && !isImportableAsBinary(opts.filename)) {
|
|
10613
|
+
out = strFromU8(out);
|
|
10614
|
+
}
|
|
10615
|
+
return out;
|
|
10544
10616
|
}
|
|
10545
10617
|
|
|
10546
10618
|
function gunzipSync(buf, filename) {
|
|
@@ -10560,21 +10632,23 @@
|
|
|
10560
10632
|
__proto__: null,
|
|
10561
10633
|
isGzipped: isGzipped,
|
|
10562
10634
|
gzipSync: gzipSync,
|
|
10635
|
+
gzipAsync: gzipAsync,
|
|
10636
|
+
gunzipAsync: gunzipAsync,
|
|
10563
10637
|
gunzipSync: gunzipSync
|
|
10564
10638
|
});
|
|
10565
10639
|
|
|
10566
10640
|
// Export in a column-first format
|
|
10567
10641
|
// Faster than exportTable(), and can handle some data that can't be
|
|
10568
10642
|
// converted to JSON, like Date objects.
|
|
10569
|
-
function exportTable2(table) {
|
|
10643
|
+
async function exportTable2(table) {
|
|
10570
10644
|
var fields = table.getFields();
|
|
10571
10645
|
var records = table.getRecords();
|
|
10572
10646
|
var types = [];
|
|
10573
|
-
var columns = fields.map(function(name) {
|
|
10647
|
+
var columns = await Promise.all(fields.map(function(name) {
|
|
10574
10648
|
var type = getColumnType(name, records);
|
|
10575
10649
|
types.push(type);
|
|
10576
10650
|
return exportColumn(name, type, records);
|
|
10577
|
-
});
|
|
10651
|
+
}));
|
|
10578
10652
|
return ({
|
|
10579
10653
|
fields: fields,
|
|
10580
10654
|
types: types,
|
|
@@ -10632,9 +10706,9 @@
|
|
|
10632
10706
|
}
|
|
10633
10707
|
}
|
|
10634
10708
|
|
|
10635
|
-
function exportColumn(name, type, records) {
|
|
10709
|
+
async function exportColumn(name, type, records) {
|
|
10636
10710
|
if (type == 'number' || type == 'string') {
|
|
10637
|
-
return
|
|
10711
|
+
return gzipAsync(JSON.stringify(getFieldValues(records, name)), {level: 2, consume: true});
|
|
10638
10712
|
}
|
|
10639
10713
|
return getFieldValues(records, name);
|
|
10640
10714
|
}
|
|
@@ -10648,7 +10722,6 @@
|
|
|
10648
10722
|
// return gzipSync(arr, {level: 2});
|
|
10649
10723
|
// }
|
|
10650
10724
|
|
|
10651
|
-
// import { gzipSync, isGzipped } from '../io/mapshaper-gzip';
|
|
10652
10725
|
var PACKAGE_EXT = 'msx';
|
|
10653
10726
|
|
|
10654
10727
|
// libraries
|
|
@@ -10665,10 +10738,11 @@
|
|
|
10665
10738
|
}
|
|
10666
10739
|
*/
|
|
10667
10740
|
|
|
10668
|
-
function exportPackedDatasets(datasets, opts) {
|
|
10741
|
+
async function exportPackedDatasets(datasets, opts) {
|
|
10742
|
+
var content = pack(await exportDatasetsToPack(datasets, opts));
|
|
10669
10743
|
return [{
|
|
10670
|
-
content:
|
|
10671
|
-
filename: opts.file || '
|
|
10744
|
+
content: content,
|
|
10745
|
+
filename: opts.file || 'mapshaper_snapshot.' + PACKAGE_EXT
|
|
10672
10746
|
}];
|
|
10673
10747
|
}
|
|
10674
10748
|
|
|
@@ -10681,11 +10755,11 @@
|
|
|
10681
10755
|
|
|
10682
10756
|
// gui: (optional) gui instance
|
|
10683
10757
|
//
|
|
10684
|
-
function exportDatasetsToPack(datasets, opts) {
|
|
10758
|
+
async function exportDatasetsToPack(datasets, opts) {
|
|
10685
10759
|
return {
|
|
10686
10760
|
version: 1,
|
|
10687
10761
|
created: (new Date).toISOString(),
|
|
10688
|
-
datasets: datasets.map(exportDataset)
|
|
10762
|
+
datasets: await Promise.all(datasets.map(d => exportDataset(d, opts || {})))
|
|
10689
10763
|
};
|
|
10690
10764
|
}
|
|
10691
10765
|
|
|
@@ -10695,11 +10769,11 @@
|
|
|
10695
10769
|
// return BSON.serialize(obj);
|
|
10696
10770
|
// }
|
|
10697
10771
|
|
|
10698
|
-
function exportDataset(dataset) {
|
|
10772
|
+
async function exportDataset(dataset, opts) {
|
|
10699
10773
|
return {
|
|
10700
|
-
arcs: dataset.arcs ? exportArcs(dataset.arcs) : null,
|
|
10774
|
+
arcs: dataset.arcs ? await exportArcs(dataset.arcs, opts) : null,
|
|
10701
10775
|
info: dataset.info ? exportInfo(dataset.info) : null,
|
|
10702
|
-
layers: (dataset.layers || []).map(exportLayer)
|
|
10776
|
+
layers: await Promise.all((dataset.layers || []).map(exportLayer))
|
|
10703
10777
|
};
|
|
10704
10778
|
}
|
|
10705
10779
|
|
|
@@ -10707,7 +10781,7 @@
|
|
|
10707
10781
|
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
10708
10782
|
}
|
|
10709
10783
|
|
|
10710
|
-
function exportArcs(arcs) {
|
|
10784
|
+
async function exportArcs(arcs, opts) {
|
|
10711
10785
|
var data = arcs.getVertexData();
|
|
10712
10786
|
var obj = {
|
|
10713
10787
|
nn: typedArrayToBuffer(data.nn),
|
|
@@ -10717,19 +10791,27 @@
|
|
|
10717
10791
|
zlimit: arcs.getRetainedInterval()
|
|
10718
10792
|
};
|
|
10719
10793
|
|
|
10720
|
-
// gzipping typically
|
|
10721
|
-
// -- not worth the time
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10794
|
+
// gzipping typically sees about 70% compression on unrounded coordinates
|
|
10795
|
+
// -- possibly not worth the time
|
|
10796
|
+
if (opts.compact) {
|
|
10797
|
+
var gzipOpts = {level: 1, consume: false};
|
|
10798
|
+
var promises = [gzipAsync(obj.nn, gzipOpts), gzipAsync(obj.xx, gzipOpts), gzipAsync(obj.yy, gzipOpts)];
|
|
10799
|
+
if (obj.zz) promises.push(gzipAsync(obj.zz, gzipOpts));
|
|
10800
|
+
var results = await Promise.all(promises);
|
|
10801
|
+
obj.nn = results.shift();
|
|
10802
|
+
obj.xx = results.shift();
|
|
10803
|
+
obj.yy = results.shift();
|
|
10804
|
+
if (obj.zz) obj.zz = results.shift();
|
|
10805
|
+
}
|
|
10727
10806
|
return obj;
|
|
10728
10807
|
}
|
|
10729
10808
|
|
|
10730
|
-
function exportLayer(lyr) {
|
|
10809
|
+
async function exportLayer(lyr) {
|
|
10731
10810
|
// console.time('table')
|
|
10732
|
-
var data =
|
|
10811
|
+
var data = null;
|
|
10812
|
+
if (lyr.data) {
|
|
10813
|
+
data = await exportTable2(lyr.data);
|
|
10814
|
+
}
|
|
10733
10815
|
// console.timeEnd('table')
|
|
10734
10816
|
return {
|
|
10735
10817
|
name: lyr.name || null,
|
|
@@ -10894,15 +10976,6 @@
|
|
|
10894
10976
|
filenameIsUnsupportedOutputType: filenameIsUnsupportedOutputType
|
|
10895
10977
|
});
|
|
10896
10978
|
|
|
10897
|
-
function runningInBrowser() {
|
|
10898
|
-
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
10899
|
-
}
|
|
10900
|
-
|
|
10901
|
-
var Env = /*#__PURE__*/Object.freeze({
|
|
10902
|
-
__proto__: null,
|
|
10903
|
-
runningInBrowser: runningInBrowser
|
|
10904
|
-
});
|
|
10905
|
-
|
|
10906
10979
|
// input: A file path or a buffer
|
|
10907
10980
|
function unzipSync(input) {
|
|
10908
10981
|
if (input instanceof ArrayBuffer) {
|
|
@@ -21084,7 +21157,7 @@ ${svg}
|
|
|
21084
21157
|
|
|
21085
21158
|
// @targets - non-empty output from Catalog#findCommandTargets()
|
|
21086
21159
|
//
|
|
21087
|
-
function exportTargetLayers(targets, opts) {
|
|
21160
|
+
async function exportTargetLayers(targets, opts) {
|
|
21088
21161
|
// convert target fmt to dataset fmt
|
|
21089
21162
|
var datasets = targets.map(function(target) {
|
|
21090
21163
|
return utils.defaults({layers: target.layers}, target.dataset);
|
|
@@ -21094,10 +21167,11 @@ ${svg}
|
|
|
21094
21167
|
|
|
21095
21168
|
//
|
|
21096
21169
|
//
|
|
21097
|
-
function exportDatasets(datasets, opts) {
|
|
21170
|
+
async function exportDatasets(datasets, opts) {
|
|
21098
21171
|
var format = getOutputFormat(datasets[0], opts);
|
|
21099
21172
|
var files;
|
|
21100
21173
|
if (format == PACKAGE_EXT) {
|
|
21174
|
+
opts = utils.defaults({compact: true}, opts);
|
|
21101
21175
|
return exportPackedDatasets(datasets, opts);
|
|
21102
21176
|
}
|
|
21103
21177
|
if (format == 'kml' || format == 'svg' || format == 'topojson' || format == 'geojson' && opts.combine_layers) {
|
|
@@ -21201,7 +21275,7 @@ ${svg}
|
|
|
21201
21275
|
}
|
|
21202
21276
|
|
|
21203
21277
|
var exporters = {
|
|
21204
|
-
[PACKAGE_EXT]: exportPackedDatasets,
|
|
21278
|
+
// [PACKAGE_EXT]: exportPackedDatasets, // handled as a special case
|
|
21205
21279
|
geojson: exportGeoJSON2,
|
|
21206
21280
|
topojson: exportTopoJSON,
|
|
21207
21281
|
shapefile: exportShapefile,
|
|
@@ -27373,18 +27447,16 @@ ${svg}
|
|
|
27373
27447
|
importFileContent: importFileContent
|
|
27374
27448
|
});
|
|
27375
27449
|
|
|
27376
|
-
// import { gunzipSync, isGzipped } from '../io/mapshaper-gzip';
|
|
27377
|
-
|
|
27378
27450
|
// Import datasets contained in a BSON blob
|
|
27379
27451
|
// Return command target as a dataset
|
|
27380
27452
|
//
|
|
27381
|
-
function unpackSession(buf) {
|
|
27453
|
+
async function unpackSession(buf) {
|
|
27382
27454
|
var obj = unpack(buf, {});
|
|
27383
27455
|
if (!isValidSession(obj)) {
|
|
27384
27456
|
stop('Invalid mapshaper session data object');
|
|
27385
27457
|
}
|
|
27386
27458
|
|
|
27387
|
-
var datasets = obj.datasets.map(importDataset);
|
|
27459
|
+
var datasets = await Promise.all(obj.datasets.map(importDataset));
|
|
27388
27460
|
return Object.assign(obj, {datasets: datasets});
|
|
27389
27461
|
}
|
|
27390
27462
|
|
|
@@ -27395,11 +27467,13 @@ ${svg}
|
|
|
27395
27467
|
return true;
|
|
27396
27468
|
}
|
|
27397
27469
|
|
|
27398
|
-
function importDataset(obj) {
|
|
27470
|
+
async function importDataset(obj) {
|
|
27471
|
+
var arcs = null;
|
|
27472
|
+
if (obj.arcs) arcs = await importArcs(obj.arcs);
|
|
27399
27473
|
return {
|
|
27400
27474
|
info: importInfo(obj.info || {}),
|
|
27401
27475
|
layers: (obj.layers || []).map(importLayer),
|
|
27402
|
-
arcs:
|
|
27476
|
+
arcs: arcs
|
|
27403
27477
|
};
|
|
27404
27478
|
}
|
|
27405
27479
|
|
|
@@ -27409,7 +27483,23 @@ ${svg}
|
|
|
27409
27483
|
// return new constructor(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
27410
27484
|
}
|
|
27411
27485
|
|
|
27412
|
-
function importArcs(obj) {
|
|
27486
|
+
async function importArcs(obj) {
|
|
27487
|
+
if (isGzipped(obj.xx)) {
|
|
27488
|
+
var promises = [];
|
|
27489
|
+
promises.push(gunzipAsync(obj.nn));
|
|
27490
|
+
promises.push(gunzipAsync(obj.xx));
|
|
27491
|
+
promises.push(gunzipAsync(obj.yy));
|
|
27492
|
+
if (obj.zz) {
|
|
27493
|
+
promises.push(gunzipAsync(obj.zz));
|
|
27494
|
+
}
|
|
27495
|
+
var data = await Promise.all(promises);
|
|
27496
|
+
obj.nn = data.shift();
|
|
27497
|
+
obj.xx = data.shift();
|
|
27498
|
+
obj.yy = data.shift();
|
|
27499
|
+
if (obj.zz) {
|
|
27500
|
+
obj.zz = data.shift();
|
|
27501
|
+
}
|
|
27502
|
+
}
|
|
27413
27503
|
var nn = bufferToDataView(obj.nn, Uint32Array);
|
|
27414
27504
|
var xx = bufferToDataView(obj.xx, Float64Array);
|
|
27415
27505
|
var yy = bufferToDataView(obj.yy, Float64Array);
|
|
@@ -27445,7 +27535,7 @@ ${svg}
|
|
|
27445
27535
|
unpackSession: unpackSession
|
|
27446
27536
|
});
|
|
27447
27537
|
|
|
27448
|
-
cmd.importFiles = function(catalog, opts) {
|
|
27538
|
+
cmd.importFiles = async function(catalog, opts) {
|
|
27449
27539
|
var files = opts.files || [];
|
|
27450
27540
|
var dataset;
|
|
27451
27541
|
|
|
@@ -27475,7 +27565,7 @@ ${svg}
|
|
|
27475
27565
|
if (files.length > 1) {
|
|
27476
27566
|
stop('Expected a single package file');
|
|
27477
27567
|
}
|
|
27478
|
-
dataset = importMshpFile(files[0], catalog, opts);
|
|
27568
|
+
dataset = await importMshpFile(files[0], catalog, opts);
|
|
27479
27569
|
return dataset;
|
|
27480
27570
|
}
|
|
27481
27571
|
|
|
@@ -27494,12 +27584,10 @@ ${svg}
|
|
|
27494
27584
|
return dataset;
|
|
27495
27585
|
};
|
|
27496
27586
|
|
|
27497
|
-
function importMshpFile(file, catalog, opts) {
|
|
27587
|
+
async function importMshpFile(file, catalog, opts) {
|
|
27498
27588
|
var buf = cli.readFile(file, null, opts.input);
|
|
27499
|
-
var obj = unpackSession(buf);
|
|
27500
|
-
obj.datasets.forEach(
|
|
27501
|
-
catalog.addDataset(dataset);
|
|
27502
|
-
});
|
|
27589
|
+
var obj = await unpackSession(buf);
|
|
27590
|
+
obj.datasets.forEach(catalog.addDataset, catalog);
|
|
27503
27591
|
return obj.target;
|
|
27504
27592
|
}
|
|
27505
27593
|
|
|
@@ -42648,7 +42736,7 @@ ${svg}
|
|
|
42648
42736
|
name == 'else' || name == 'endif' || name == 'stop';
|
|
42649
42737
|
}
|
|
42650
42738
|
|
|
42651
|
-
function runCommand(command, job
|
|
42739
|
+
async function runCommand(command, job) {
|
|
42652
42740
|
var name = command.name,
|
|
42653
42741
|
opts = command.options,
|
|
42654
42742
|
source,
|
|
@@ -42824,7 +42912,7 @@ ${svg}
|
|
|
42824
42912
|
|
|
42825
42913
|
} else if (name == 'i') {
|
|
42826
42914
|
if (opts.replace) job.catalog = new Catalog(); // is this what we want?
|
|
42827
|
-
targetDataset = cmd.importFiles(job.catalog, command.options);
|
|
42915
|
+
targetDataset = await cmd.importFiles(job.catalog, command.options);
|
|
42828
42916
|
if (targetDataset) {
|
|
42829
42917
|
outputLayers = targetDataset.layers; // kludge to allow layer naming below
|
|
42830
42918
|
}
|
|
@@ -42872,14 +42960,13 @@ ${svg}
|
|
|
42872
42960
|
outputLayers = cmd.mosaic(targetLayers, targetDataset, opts);
|
|
42873
42961
|
|
|
42874
42962
|
} else if (name == 'o') {
|
|
42875
|
-
outputFiles = exportTargetLayers(targets, opts);
|
|
42963
|
+
outputFiles = await exportTargetLayers(targets, opts);
|
|
42876
42964
|
if (opts.final) {
|
|
42877
42965
|
// don't propagate data if output is final
|
|
42878
42966
|
//// catalog = null;
|
|
42879
42967
|
job.catalog = new Catalog();
|
|
42880
42968
|
}
|
|
42881
|
-
writeFiles(outputFiles, opts
|
|
42882
|
-
return; // async command
|
|
42969
|
+
await utils.promisify(writeFiles)(outputFiles, opts);
|
|
42883
42970
|
|
|
42884
42971
|
} else if (name == 'point-grid') {
|
|
42885
42972
|
outputLayers = [cmd.pointGrid(targetDataset, opts)];
|
|
@@ -42903,19 +42990,11 @@ ${svg}
|
|
|
42903
42990
|
cmd.print(command._.join(' '));
|
|
42904
42991
|
|
|
42905
42992
|
} else if (name == 'proj') {
|
|
42906
|
-
initProjLibrary(opts
|
|
42907
|
-
|
|
42908
|
-
|
|
42909
|
-
|
|
42910
|
-
targets.forEach(function(targ) {
|
|
42911
|
-
cmd.proj(targ.dataset, job.catalog, opts);
|
|
42912
|
-
});
|
|
42913
|
-
} catch(e) {
|
|
42914
|
-
err = e;
|
|
42915
|
-
}
|
|
42916
|
-
done(err);
|
|
42993
|
+
await utils.promisify(initProjLibrary)(opts);
|
|
42994
|
+
job.resumeCommand();
|
|
42995
|
+
targets.forEach(function(targ) {
|
|
42996
|
+
cmd.proj(targ.dataset, job.catalog, opts);
|
|
42917
42997
|
});
|
|
42918
|
-
return; // async command
|
|
42919
42998
|
|
|
42920
42999
|
} else if (name == 'rectangle') {
|
|
42921
43000
|
if (source || opts.bbox || targets.length === 0) {
|
|
@@ -42942,8 +43021,7 @@ ${svg}
|
|
|
42942
43021
|
});
|
|
42943
43022
|
|
|
42944
43023
|
} else if (name == 'run') {
|
|
42945
|
-
cmd.run(job, targets, opts
|
|
42946
|
-
return; // async command
|
|
43024
|
+
await utils.promisify(cmd.run)(job, targets, opts);
|
|
42947
43025
|
|
|
42948
43026
|
} else if (name == 'scalebar') {
|
|
42949
43027
|
cmd.scalebar(job.catalog, opts);
|
|
@@ -43064,12 +43142,13 @@ ${svg}
|
|
|
43064
43142
|
}
|
|
43065
43143
|
|
|
43066
43144
|
// non-erroring synchronous commands are done
|
|
43067
|
-
done(null);
|
|
43145
|
+
return done(null);
|
|
43068
43146
|
|
|
43069
43147
|
function done(err) {
|
|
43070
43148
|
job.endCommand();
|
|
43071
43149
|
verbose('-', T$1.stop());
|
|
43072
|
-
|
|
43150
|
+
if (err) throw err;
|
|
43151
|
+
return job;
|
|
43073
43152
|
}
|
|
43074
43153
|
}
|
|
43075
43154
|
|
|
@@ -43318,7 +43397,11 @@ ${svg}
|
|
|
43318
43397
|
utils.reduceAsync(commands, job, nextCommand, done);
|
|
43319
43398
|
|
|
43320
43399
|
function nextCommand(job, cmd, next) {
|
|
43321
|
-
runCommand(cmd, job
|
|
43400
|
+
runCommand(cmd, job).then(function(result) {
|
|
43401
|
+
next(null, result);
|
|
43402
|
+
}).catch(function(e) {
|
|
43403
|
+
next(e);
|
|
43404
|
+
});
|
|
43322
43405
|
}
|
|
43323
43406
|
}
|
|
43324
43407
|
|
package/www/page.css
CHANGED
|
@@ -738,18 +738,29 @@ body.simplify .layer-control-btn {
|
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
.layer-menu .layer-list {
|
|
741
|
-
margin: 6px 0
|
|
741
|
+
margin: 6px 0 7px 0;
|
|
742
742
|
}
|
|
743
743
|
|
|
744
744
|
.layer-menu .layer-item {
|
|
745
745
|
position: relative;
|
|
746
746
|
margin-left: -14px;
|
|
747
747
|
margin-right: 6px;
|
|
748
|
-
padding:
|
|
749
|
-
cursor: pointer;
|
|
748
|
+
padding: 6px 14px;
|
|
750
749
|
width: 100%;
|
|
751
750
|
}
|
|
752
751
|
|
|
752
|
+
.layer-menu .layer-list .layer-item {
|
|
753
|
+
cursor: pointer;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.layer-menu .file-list {
|
|
757
|
+
padding-bottom: 4px;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
.layer-menu .file-list .layer-item {
|
|
761
|
+
padding: 0px 14px 2px 14px;
|
|
762
|
+
}
|
|
763
|
+
|
|
753
764
|
.pin-all img,
|
|
754
765
|
.layer-item img {
|
|
755
766
|
position: absolute;
|
|
@@ -786,14 +797,13 @@ img.close-btn {
|
|
|
786
797
|
cursor: pointer;
|
|
787
798
|
}
|
|
788
799
|
|
|
789
|
-
|
|
790
800
|
.layer-item img.pin-btn {
|
|
791
|
-
top:
|
|
801
|
+
top: 4px;
|
|
792
802
|
}
|
|
793
803
|
|
|
794
804
|
.layer-item img.close-btn {
|
|
795
805
|
/* top: 29px; */
|
|
796
|
-
bottom:
|
|
806
|
+
bottom: 5px;
|
|
797
807
|
}
|
|
798
808
|
|
|
799
809
|
/* hide close button when not hovering */
|
|
@@ -861,7 +871,7 @@ img.close-btn:hover,
|
|
|
861
871
|
text-decoration: none;
|
|
862
872
|
}
|
|
863
873
|
|
|
864
|
-
.layer-
|
|
874
|
+
.layer-list .layer-item:hover:not(.active):not(.dragging) {
|
|
865
875
|
background-color: #f7f7f7;
|
|
866
876
|
}
|
|
867
877
|
|