mapshaper 0.6.91 → 0.6.93
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 +32 -12
- package/package.json +1 -1
- package/www/mapshaper-gui.js +33 -22
- package/www/mapshaper.js +32 -12
package/mapshaper.js
CHANGED
|
@@ -1202,7 +1202,7 @@
|
|
|
1202
1202
|
|
|
1203
1203
|
var LOGGING = false;
|
|
1204
1204
|
var STDOUT = false; // use stdout for status messages
|
|
1205
|
-
var _error, _stop, _message;
|
|
1205
|
+
var _error, _stop, _message, _warn;
|
|
1206
1206
|
|
|
1207
1207
|
var _interrupt = function() {
|
|
1208
1208
|
throw new NonFatalError(formatLogArgs(arguments));
|
|
@@ -1211,9 +1211,9 @@
|
|
|
1211
1211
|
setLoggingForCLI();
|
|
1212
1212
|
|
|
1213
1213
|
function getLoggingSetter() {
|
|
1214
|
-
var e = _error, s = _stop, m = _message;
|
|
1214
|
+
var e = _error, s = _stop, m = _message, w = _warn;
|
|
1215
1215
|
return function() {
|
|
1216
|
-
setLoggingFunctions(m, e, s);
|
|
1216
|
+
setLoggingFunctions(m, e, s, w);
|
|
1217
1217
|
};
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
@@ -1231,7 +1231,10 @@
|
|
|
1231
1231
|
logArgs(arguments);
|
|
1232
1232
|
}
|
|
1233
1233
|
|
|
1234
|
-
|
|
1234
|
+
// CLI warning is just a message (GUI behaves differently)
|
|
1235
|
+
var warn = message;
|
|
1236
|
+
|
|
1237
|
+
setLoggingFunctions(message, error, stop, warn);
|
|
1235
1238
|
}
|
|
1236
1239
|
|
|
1237
1240
|
function enableLogging() {
|
|
@@ -1262,11 +1265,16 @@
|
|
|
1262
1265
|
_message.apply(null, messageArgs(arguments));
|
|
1263
1266
|
}
|
|
1264
1267
|
|
|
1268
|
+
function warn() {
|
|
1269
|
+
_warn.apply(null, messageArgs(arguments));
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1265
1272
|
// A way for the GUI to replace the CLI logging functions
|
|
1266
|
-
function setLoggingFunctions(message, error, stop) {
|
|
1273
|
+
function setLoggingFunctions(message, error, stop, warn) {
|
|
1267
1274
|
_message = message;
|
|
1268
1275
|
_error = error;
|
|
1269
1276
|
_stop = stop;
|
|
1277
|
+
_warn = warn;
|
|
1270
1278
|
}
|
|
1271
1279
|
|
|
1272
1280
|
// get detailed error information from error stack (if available)
|
|
@@ -1418,6 +1426,7 @@
|
|
|
1418
1426
|
stop: stop,
|
|
1419
1427
|
interrupt: interrupt,
|
|
1420
1428
|
message: message,
|
|
1429
|
+
warn: warn,
|
|
1421
1430
|
setLoggingFunctions: setLoggingFunctions,
|
|
1422
1431
|
getErrorDetail: getErrorDetail,
|
|
1423
1432
|
print: print,
|
|
@@ -11192,10 +11201,11 @@
|
|
|
11192
11201
|
arcData.zlimit = arcs.getRetainedInterval(); // TODO: add this to getVertexData()
|
|
11193
11202
|
arcData = await exportArcData(arcData, opts);
|
|
11194
11203
|
}
|
|
11204
|
+
var layers = dataset.layers.map(lyr => exportLayer(lyr, opts));
|
|
11195
11205
|
return {
|
|
11196
11206
|
arcs: arcData,
|
|
11197
11207
|
info: dataset.info ? exportInfo(dataset.info) : null,
|
|
11198
|
-
layers: await Promise.all(
|
|
11208
|
+
layers: await Promise.all(layers)
|
|
11199
11209
|
};
|
|
11200
11210
|
}
|
|
11201
11211
|
|
|
@@ -11266,7 +11276,7 @@
|
|
|
11266
11276
|
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
11267
11277
|
}
|
|
11268
11278
|
|
|
11269
|
-
async function exportLayer(lyr) {
|
|
11279
|
+
async function exportLayer(lyr, opts) {
|
|
11270
11280
|
var data = null;
|
|
11271
11281
|
if (lyr.data) {
|
|
11272
11282
|
data = await exportTable2(lyr.data);
|
|
@@ -11278,7 +11288,7 @@
|
|
|
11278
11288
|
data: data,
|
|
11279
11289
|
menu_order: lyr.menu_order || null,
|
|
11280
11290
|
pinned: lyr.pinned || false,
|
|
11281
|
-
active: lyr.active ||
|
|
11291
|
+
active: !!(lyr.active || lyr == opts.active_layer) // lyr.active: deprecated
|
|
11282
11292
|
};
|
|
11283
11293
|
}
|
|
11284
11294
|
|
|
@@ -14190,7 +14200,7 @@
|
|
|
14190
14200
|
// Parse a formatted value in DMS DM or D to a numeric value. Returns NaN if unparsable.
|
|
14191
14201
|
// Delimiters: degrees: D|d|°; minutes: '; seconds: "
|
|
14192
14202
|
function parseDMS(str, fmt) {
|
|
14193
|
-
var defaultRxp = /^(?<prefix>[nsew+-]?)(?<d>[0-9.]+)[d°]? ?(?<m>[0-9.]*)['′]? ?(?<s>[0-9.]*)["″]? ?(?<suffix>[nsew]?)$/i;
|
|
14203
|
+
var defaultRxp = /^(?<prefix>[nsew+-]?)(?<d>[0-9.]+)[d°]? ?(?<m>[0-9.]*)[m'′]? ?(?<s>[0-9.]*)["″]? ?(?<suffix>[nsew]?)$/i;
|
|
14194
14204
|
var rxp = fmt ? getParseRxp(fmt) : defaultRxp;
|
|
14195
14205
|
var match = rxp.exec(str.trim());
|
|
14196
14206
|
var d = NaN;
|
|
@@ -28846,6 +28856,7 @@ ${svg}
|
|
|
28846
28856
|
stop('Invalid mapshaper session data object');
|
|
28847
28857
|
}
|
|
28848
28858
|
var datasets = await Promise.all(obj.datasets.map(importDataset));
|
|
28859
|
+
datasets = datasets.filter(Boolean); // skip corrupted datasets
|
|
28849
28860
|
return Object.assign(obj, {datasets: datasets});
|
|
28850
28861
|
}
|
|
28851
28862
|
|
|
@@ -28858,10 +28869,19 @@ ${svg}
|
|
|
28858
28869
|
|
|
28859
28870
|
async function importDataset(obj) {
|
|
28860
28871
|
var arcs = null;
|
|
28861
|
-
|
|
28872
|
+
var layers = (obj.layers || []).map(importLayer);
|
|
28873
|
+
try {
|
|
28874
|
+
if (obj.arcs) {
|
|
28875
|
+
arcs = await importArcs(obj.arcs);
|
|
28876
|
+
}
|
|
28877
|
+
} catch(e) {
|
|
28878
|
+
warn(`Some coordinates are corrupted, skipping ${layers.length == 1 ? 'a layer' : layers.length + ' layers'}.`);
|
|
28879
|
+
return null;
|
|
28880
|
+
}
|
|
28881
|
+
|
|
28862
28882
|
return {
|
|
28863
28883
|
info: importInfo(obj.info || {}),
|
|
28864
|
-
layers:
|
|
28884
|
+
layers: layers,
|
|
28865
28885
|
arcs: arcs
|
|
28866
28886
|
};
|
|
28867
28887
|
}
|
|
@@ -45596,7 +45616,7 @@ ${svg}
|
|
|
45596
45616
|
});
|
|
45597
45617
|
}
|
|
45598
45618
|
|
|
45599
|
-
var version = "0.6.
|
|
45619
|
+
var version = "0.6.93";
|
|
45600
45620
|
|
|
45601
45621
|
// Parse command line args into commands and run them
|
|
45602
45622
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
package/package.json
CHANGED
package/www/mapshaper-gui.js
CHANGED
|
@@ -1167,7 +1167,6 @@
|
|
|
1167
1167
|
gui.alert = function(str, title) {
|
|
1168
1168
|
closePopup();
|
|
1169
1169
|
openAlert = openPopup = showPopupAlert(str, title);
|
|
1170
|
-
// alert.button('close', gui.clearMode);
|
|
1171
1170
|
openAlert.onClose(gui.clearMode);
|
|
1172
1171
|
gui.enterMode('alert');
|
|
1173
1172
|
};
|
|
@@ -1550,6 +1549,7 @@
|
|
|
1550
1549
|
function importDatasets(datasets, gui) {
|
|
1551
1550
|
gui.model.addDatasets(datasets);
|
|
1552
1551
|
var target = findTargetLayer(datasets);
|
|
1552
|
+
delete target.layers[0].active; // kludge, active flag only used in snapshots now
|
|
1553
1553
|
gui.model.setDefaultTarget(target.layers, target.dataset);
|
|
1554
1554
|
gui.model.updated({select: true, arc_count: true}); // arc_count to refresh display shapes
|
|
1555
1555
|
}
|
|
@@ -1557,15 +1557,13 @@
|
|
|
1557
1557
|
async function captureSnapshot(gui) {
|
|
1558
1558
|
var lyr = gui.model.getActiveLayer()?.layer;
|
|
1559
1559
|
if (!lyr) return null; // no data -- no snapshot
|
|
1560
|
-
lyr.active = true;
|
|
1561
1560
|
// compact: true applies compression to vector coordinates, for ~30% reduction
|
|
1562
1561
|
// in file size in a typical polygon or polyline file, but longer processing time
|
|
1563
|
-
var opts = {compact: false};
|
|
1562
|
+
var opts = {compact: false, active_layer: lyr};
|
|
1564
1563
|
var datasets = gui.model.getDatasets();
|
|
1565
1564
|
// console.time('msx');
|
|
1566
1565
|
var obj = await internal.exportDatasetsToPack(datasets, opts);
|
|
1567
1566
|
// console.timeEnd('msx')
|
|
1568
|
-
delete lyr.active;
|
|
1569
1567
|
obj.gui = getGuiState(gui);
|
|
1570
1568
|
return obj;
|
|
1571
1569
|
}
|
|
@@ -1659,7 +1657,9 @@
|
|
|
1659
1657
|
var target;
|
|
1660
1658
|
datasets.forEach(function(dataset) {
|
|
1661
1659
|
var lyr = dataset.layers.find(function(lyr) { return !!lyr.active; });
|
|
1662
|
-
if (lyr)
|
|
1660
|
+
if (lyr) {
|
|
1661
|
+
target = {dataset: dataset, layers: [lyr]};
|
|
1662
|
+
}
|
|
1663
1663
|
});
|
|
1664
1664
|
if (!target) {
|
|
1665
1665
|
target = {dataset: datasets[0], layers: [datasets[0].layers[0]]};
|
|
@@ -2438,7 +2438,14 @@
|
|
|
2438
2438
|
internal.logArgs(arguments);
|
|
2439
2439
|
}
|
|
2440
2440
|
|
|
2441
|
-
|
|
2441
|
+
// GUI warning uses the alert popup, which replaces previous popup
|
|
2442
|
+
// (unlike message) -- this allows for catching and handling errors
|
|
2443
|
+
// by replacing the error popup with a warning.
|
|
2444
|
+
function warn() {
|
|
2445
|
+
gui.alert(GUI.formatMessageArgs(arguments));
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
internal.setLoggingFunctions(message, error, stop, warn);
|
|
2442
2449
|
}
|
|
2443
2450
|
|
|
2444
2451
|
function WriteFilesProxy(gui) {
|
|
@@ -2527,7 +2534,7 @@
|
|
|
2527
2534
|
// prevent GUI message popup on error
|
|
2528
2535
|
internal.setLoggingForCLI();
|
|
2529
2536
|
try {
|
|
2530
|
-
if (!dataset || internal.datasetIsEmpty(dataset)) {
|
|
2537
|
+
if (!dataset || internal.datasetIsEmpty(dataset) && !dataset.info?.crs) {
|
|
2531
2538
|
crs = internal.parseCrsString('wgs84');
|
|
2532
2539
|
} else {
|
|
2533
2540
|
crs = internal.getDatasetCRS(dataset);
|
|
@@ -4745,8 +4752,9 @@
|
|
|
4745
4752
|
|
|
4746
4753
|
// done: function(string|Error|null)
|
|
4747
4754
|
async function exportMenuSelection(targets) {
|
|
4748
|
-
var opts = getExportOpts();
|
|
4749
4755
|
// note: command line "target" option gets ignored
|
|
4756
|
+
var opts = getExportOpts();
|
|
4757
|
+
opts.active_layer = gui.model.getActiveLayer().layer; // kludge to support restoring active layer in gui
|
|
4750
4758
|
var files = await internal.exportTargetLayers(model, targets, opts);
|
|
4751
4759
|
gui.session.layersExported(getTargetLayerIds(), getExportOptsAsString());
|
|
4752
4760
|
if (files.length == 1 && checkboxOn(clipboardCheckbox)) {
|
|
@@ -6209,7 +6217,7 @@
|
|
|
6209
6217
|
|
|
6210
6218
|
var LOGGING = false;
|
|
6211
6219
|
var STDOUT = false; // use stdout for status messages
|
|
6212
|
-
var _error, _stop, _message;
|
|
6220
|
+
var _error, _stop, _message, _warn;
|
|
6213
6221
|
|
|
6214
6222
|
var _interrupt = function() {
|
|
6215
6223
|
throw new NonFatalError(formatLogArgs(arguments));
|
|
@@ -6218,9 +6226,9 @@
|
|
|
6218
6226
|
setLoggingForCLI();
|
|
6219
6227
|
|
|
6220
6228
|
function getLoggingSetter() {
|
|
6221
|
-
var e = _error, s = _stop, m = _message;
|
|
6229
|
+
var e = _error, s = _stop, m = _message, w = _warn;
|
|
6222
6230
|
return function() {
|
|
6223
|
-
setLoggingFunctions(m, e, s);
|
|
6231
|
+
setLoggingFunctions(m, e, s, w);
|
|
6224
6232
|
};
|
|
6225
6233
|
}
|
|
6226
6234
|
|
|
@@ -6238,7 +6246,10 @@
|
|
|
6238
6246
|
logArgs(arguments);
|
|
6239
6247
|
}
|
|
6240
6248
|
|
|
6241
|
-
|
|
6249
|
+
// CLI warning is just a message (GUI behaves differently)
|
|
6250
|
+
var warn = message;
|
|
6251
|
+
|
|
6252
|
+
setLoggingFunctions(message, error, stop, warn);
|
|
6242
6253
|
}
|
|
6243
6254
|
|
|
6244
6255
|
function enableLogging() {
|
|
@@ -6269,11 +6280,16 @@
|
|
|
6269
6280
|
_message.apply(null, messageArgs(arguments));
|
|
6270
6281
|
}
|
|
6271
6282
|
|
|
6283
|
+
function warn() {
|
|
6284
|
+
_warn.apply(null, messageArgs(arguments));
|
|
6285
|
+
}
|
|
6286
|
+
|
|
6272
6287
|
// A way for the GUI to replace the CLI logging functions
|
|
6273
|
-
function setLoggingFunctions(message, error, stop) {
|
|
6288
|
+
function setLoggingFunctions(message, error, stop, warn) {
|
|
6274
6289
|
_message = message;
|
|
6275
6290
|
_error = error;
|
|
6276
6291
|
_stop = stop;
|
|
6292
|
+
_warn = warn;
|
|
6277
6293
|
}
|
|
6278
6294
|
|
|
6279
6295
|
// get detailed error information from error stack (if available)
|
|
@@ -11999,7 +12015,7 @@
|
|
|
11999
12015
|
svg.append(g);
|
|
12000
12016
|
|
|
12001
12017
|
// prevent svg hit detection on inactive layers
|
|
12002
|
-
if (!lyr
|
|
12018
|
+
if (!gui.map.isActiveLayer(lyr)) {
|
|
12003
12019
|
g.style.pointerEvents = 'none';
|
|
12004
12020
|
}
|
|
12005
12021
|
};
|
|
@@ -12560,7 +12576,8 @@ GUI and setting the size and crop of SVG output.</p><div><input type="text" clas
|
|
|
12560
12576
|
}
|
|
12561
12577
|
|
|
12562
12578
|
if (e.layer) {
|
|
12563
|
-
_activeLyr =
|
|
12579
|
+
_activeLyr = e.layer;
|
|
12580
|
+
initActiveLayer(e.layer, e.dataset);
|
|
12564
12581
|
} else {
|
|
12565
12582
|
_activeLyr = null;
|
|
12566
12583
|
}
|
|
@@ -12750,12 +12767,6 @@ GUI and setting the size and crop of SVG output.</p><div><input type="text" clas
|
|
|
12750
12767
|
function initActiveLayer(lyr, dataset) {
|
|
12751
12768
|
enhanceLayerForDisplay(lyr, dataset, getDisplayOptions());
|
|
12752
12769
|
lyr.gui.style = getActiveLayerStyle(lyr.gui.displayLayer, getGlobalStyleOptions());
|
|
12753
|
-
lyr.active = true;
|
|
12754
|
-
getVisibleMapLayers().forEach(function(lyr) {
|
|
12755
|
-
delete lyr.active;
|
|
12756
|
-
});
|
|
12757
|
-
lyr.active = true;
|
|
12758
|
-
return lyr;
|
|
12759
12770
|
}
|
|
12760
12771
|
|
|
12761
12772
|
function getDrawableFurnitureLayers(layers) {
|
|
@@ -12768,7 +12779,7 @@ GUI and setting the size and crop of SVG output.</p><div><input type="text" clas
|
|
|
12768
12779
|
function updateLayerStyles(layers) {
|
|
12769
12780
|
layers.forEach(function(mapLayer, i) {
|
|
12770
12781
|
var style;
|
|
12771
|
-
if (mapLayer
|
|
12782
|
+
if (isActiveLayer(mapLayer)) {
|
|
12772
12783
|
// regenerating active style everytime, to support style change when
|
|
12773
12784
|
// switching between outline and preview modes.
|
|
12774
12785
|
style = getActiveLayerStyle(mapLayer.gui.displayLayer, getGlobalStyleOptions());
|
package/www/mapshaper.js
CHANGED
|
@@ -1202,7 +1202,7 @@
|
|
|
1202
1202
|
|
|
1203
1203
|
var LOGGING = false;
|
|
1204
1204
|
var STDOUT = false; // use stdout for status messages
|
|
1205
|
-
var _error, _stop, _message;
|
|
1205
|
+
var _error, _stop, _message, _warn;
|
|
1206
1206
|
|
|
1207
1207
|
var _interrupt = function() {
|
|
1208
1208
|
throw new NonFatalError(formatLogArgs(arguments));
|
|
@@ -1211,9 +1211,9 @@
|
|
|
1211
1211
|
setLoggingForCLI();
|
|
1212
1212
|
|
|
1213
1213
|
function getLoggingSetter() {
|
|
1214
|
-
var e = _error, s = _stop, m = _message;
|
|
1214
|
+
var e = _error, s = _stop, m = _message, w = _warn;
|
|
1215
1215
|
return function() {
|
|
1216
|
-
setLoggingFunctions(m, e, s);
|
|
1216
|
+
setLoggingFunctions(m, e, s, w);
|
|
1217
1217
|
};
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
@@ -1231,7 +1231,10 @@
|
|
|
1231
1231
|
logArgs(arguments);
|
|
1232
1232
|
}
|
|
1233
1233
|
|
|
1234
|
-
|
|
1234
|
+
// CLI warning is just a message (GUI behaves differently)
|
|
1235
|
+
var warn = message;
|
|
1236
|
+
|
|
1237
|
+
setLoggingFunctions(message, error, stop, warn);
|
|
1235
1238
|
}
|
|
1236
1239
|
|
|
1237
1240
|
function enableLogging() {
|
|
@@ -1262,11 +1265,16 @@
|
|
|
1262
1265
|
_message.apply(null, messageArgs(arguments));
|
|
1263
1266
|
}
|
|
1264
1267
|
|
|
1268
|
+
function warn() {
|
|
1269
|
+
_warn.apply(null, messageArgs(arguments));
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1265
1272
|
// A way for the GUI to replace the CLI logging functions
|
|
1266
|
-
function setLoggingFunctions(message, error, stop) {
|
|
1273
|
+
function setLoggingFunctions(message, error, stop, warn) {
|
|
1267
1274
|
_message = message;
|
|
1268
1275
|
_error = error;
|
|
1269
1276
|
_stop = stop;
|
|
1277
|
+
_warn = warn;
|
|
1270
1278
|
}
|
|
1271
1279
|
|
|
1272
1280
|
// get detailed error information from error stack (if available)
|
|
@@ -1418,6 +1426,7 @@
|
|
|
1418
1426
|
stop: stop,
|
|
1419
1427
|
interrupt: interrupt,
|
|
1420
1428
|
message: message,
|
|
1429
|
+
warn: warn,
|
|
1421
1430
|
setLoggingFunctions: setLoggingFunctions,
|
|
1422
1431
|
getErrorDetail: getErrorDetail,
|
|
1423
1432
|
print: print,
|
|
@@ -11192,10 +11201,11 @@
|
|
|
11192
11201
|
arcData.zlimit = arcs.getRetainedInterval(); // TODO: add this to getVertexData()
|
|
11193
11202
|
arcData = await exportArcData(arcData, opts);
|
|
11194
11203
|
}
|
|
11204
|
+
var layers = dataset.layers.map(lyr => exportLayer(lyr, opts));
|
|
11195
11205
|
return {
|
|
11196
11206
|
arcs: arcData,
|
|
11197
11207
|
info: dataset.info ? exportInfo(dataset.info) : null,
|
|
11198
|
-
layers: await Promise.all(
|
|
11208
|
+
layers: await Promise.all(layers)
|
|
11199
11209
|
};
|
|
11200
11210
|
}
|
|
11201
11211
|
|
|
@@ -11266,7 +11276,7 @@
|
|
|
11266
11276
|
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
11267
11277
|
}
|
|
11268
11278
|
|
|
11269
|
-
async function exportLayer(lyr) {
|
|
11279
|
+
async function exportLayer(lyr, opts) {
|
|
11270
11280
|
var data = null;
|
|
11271
11281
|
if (lyr.data) {
|
|
11272
11282
|
data = await exportTable2(lyr.data);
|
|
@@ -11278,7 +11288,7 @@
|
|
|
11278
11288
|
data: data,
|
|
11279
11289
|
menu_order: lyr.menu_order || null,
|
|
11280
11290
|
pinned: lyr.pinned || false,
|
|
11281
|
-
active: lyr.active ||
|
|
11291
|
+
active: !!(lyr.active || lyr == opts.active_layer) // lyr.active: deprecated
|
|
11282
11292
|
};
|
|
11283
11293
|
}
|
|
11284
11294
|
|
|
@@ -14190,7 +14200,7 @@
|
|
|
14190
14200
|
// Parse a formatted value in DMS DM or D to a numeric value. Returns NaN if unparsable.
|
|
14191
14201
|
// Delimiters: degrees: D|d|°; minutes: '; seconds: "
|
|
14192
14202
|
function parseDMS(str, fmt) {
|
|
14193
|
-
var defaultRxp = /^(?<prefix>[nsew+-]?)(?<d>[0-9.]+)[d°]? ?(?<m>[0-9.]*)['′]? ?(?<s>[0-9.]*)["″]? ?(?<suffix>[nsew]?)$/i;
|
|
14203
|
+
var defaultRxp = /^(?<prefix>[nsew+-]?)(?<d>[0-9.]+)[d°]? ?(?<m>[0-9.]*)[m'′]? ?(?<s>[0-9.]*)["″]? ?(?<suffix>[nsew]?)$/i;
|
|
14194
14204
|
var rxp = fmt ? getParseRxp(fmt) : defaultRxp;
|
|
14195
14205
|
var match = rxp.exec(str.trim());
|
|
14196
14206
|
var d = NaN;
|
|
@@ -28846,6 +28856,7 @@ ${svg}
|
|
|
28846
28856
|
stop('Invalid mapshaper session data object');
|
|
28847
28857
|
}
|
|
28848
28858
|
var datasets = await Promise.all(obj.datasets.map(importDataset));
|
|
28859
|
+
datasets = datasets.filter(Boolean); // skip corrupted datasets
|
|
28849
28860
|
return Object.assign(obj, {datasets: datasets});
|
|
28850
28861
|
}
|
|
28851
28862
|
|
|
@@ -28858,10 +28869,19 @@ ${svg}
|
|
|
28858
28869
|
|
|
28859
28870
|
async function importDataset(obj) {
|
|
28860
28871
|
var arcs = null;
|
|
28861
|
-
|
|
28872
|
+
var layers = (obj.layers || []).map(importLayer);
|
|
28873
|
+
try {
|
|
28874
|
+
if (obj.arcs) {
|
|
28875
|
+
arcs = await importArcs(obj.arcs);
|
|
28876
|
+
}
|
|
28877
|
+
} catch(e) {
|
|
28878
|
+
warn(`Some coordinates are corrupted, skipping ${layers.length == 1 ? 'a layer' : layers.length + ' layers'}.`);
|
|
28879
|
+
return null;
|
|
28880
|
+
}
|
|
28881
|
+
|
|
28862
28882
|
return {
|
|
28863
28883
|
info: importInfo(obj.info || {}),
|
|
28864
|
-
layers:
|
|
28884
|
+
layers: layers,
|
|
28865
28885
|
arcs: arcs
|
|
28866
28886
|
};
|
|
28867
28887
|
}
|
|
@@ -45596,7 +45616,7 @@ ${svg}
|
|
|
45596
45616
|
});
|
|
45597
45617
|
}
|
|
45598
45618
|
|
|
45599
|
-
var version = "0.6.
|
|
45619
|
+
var version = "0.6.93";
|
|
45600
45620
|
|
|
45601
45621
|
// Parse command line args into commands and run them
|
|
45602
45622
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|