mapshaper 0.6.3 → 0.6.6
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/CHANGELOG.md +1413 -0
- package/README.md +1 -1
- package/mapshaper.js +56 -58
- package/package.json +2 -2
- package/www/mapshaper-gui.js +10 -1
- package/www/mapshaper.js +56 -58
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ The web UI works in recent desktop versions of Chrome, Firefox, Safari and Inter
|
|
|
38
38
|
|
|
39
39
|
[Here](https://hub.docker.com/r/freifunkhamm/mapshaper) are resources for using mapshaper with Docker, provided by Christian Weiss.
|
|
40
40
|
|
|
41
|
-
You can find a number of mapshaper tutorials online, including a [two](https://moriartynaps.org/command-carto-part-one/) [part](https://moriartynaps.org/command-carto-part-two/) guide to command line cartography by Dylan Moriarty and [this introduction](https://
|
|
41
|
+
You can find a number of mapshaper tutorials online, including a [two](https://moriartynaps.org/command-carto-part-one/) [part](https://moriartynaps.org/command-carto-part-two/) guide to command line cartography by Dylan Moriarty and [this introduction](https://handsondataviz.org/mapshaper.html) by Jack Dougherty.
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
## Large file support
|
package/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.6.
|
|
3
|
+
var VERSION = "0.6.6";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -10349,8 +10349,13 @@
|
|
|
10349
10349
|
sum: captureNum,
|
|
10350
10350
|
sums: capture,
|
|
10351
10351
|
average: captureNum,
|
|
10352
|
+
mean: captureNum,
|
|
10352
10353
|
median: captureNum,
|
|
10353
10354
|
quantile: captureNum,
|
|
10355
|
+
iqr: captureNum,
|
|
10356
|
+
quartile1: captureNum,
|
|
10357
|
+
quartile2: captureNum,
|
|
10358
|
+
quartile3: captureNum,
|
|
10354
10359
|
min: captureNum,
|
|
10355
10360
|
max: captureNum,
|
|
10356
10361
|
mode: capture,
|
|
@@ -10366,9 +10371,16 @@
|
|
|
10366
10371
|
sums: wrap(sums),
|
|
10367
10372
|
median: wrap(utils.findMedian),
|
|
10368
10373
|
quantile: wrap2(utils.findQuantile),
|
|
10374
|
+
iqr: wrap(function(arr) {
|
|
10375
|
+
return utils.findQuantile(arr, 0.75) - utils.findQuantile(arr, 0.25);
|
|
10376
|
+
}),
|
|
10377
|
+
quartile1: wrap(function(arr) { return utils.findQuantile(arr, 0.25); }),
|
|
10378
|
+
quartile2: wrap(utils.findMedian),
|
|
10379
|
+
quartile3: wrap(function(arr) { return utils.findQuantile(arr, 0.75); }),
|
|
10369
10380
|
min: wrap(min),
|
|
10370
10381
|
max: wrap(max),
|
|
10371
10382
|
average: wrap(utils.mean),
|
|
10383
|
+
mean: wrap(utils.mean),
|
|
10372
10384
|
mode: wrap(getMode),
|
|
10373
10385
|
collect: wrap(pass),
|
|
10374
10386
|
first: wrap(pass),
|
|
@@ -30928,7 +30940,7 @@ ${svg}
|
|
|
30928
30940
|
|
|
30929
30941
|
var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
|
|
30930
30942
|
|
|
30931
|
-
var
|
|
30943
|
+
var d3Scales = /*#__PURE__*/Object.freeze({
|
|
30932
30944
|
__proto__: null,
|
|
30933
30945
|
schemeCategory10: category10,
|
|
30934
30946
|
schemeAccent: Accent,
|
|
@@ -31065,7 +31077,6 @@ ${svg}
|
|
|
31065
31077
|
}
|
|
31066
31078
|
|
|
31067
31079
|
function testLib() {
|
|
31068
|
-
var lib = require('d3-scale-chromatic');
|
|
31069
31080
|
schemes(index.categorical);
|
|
31070
31081
|
schemes(index.sequential);
|
|
31071
31082
|
schemes(index.diverging);
|
|
@@ -31075,7 +31086,7 @@ ${svg}
|
|
|
31075
31086
|
|
|
31076
31087
|
function schemes(arr) {
|
|
31077
31088
|
arr.forEach(function(name) {
|
|
31078
|
-
if (!
|
|
31089
|
+
if (!d3Scales['scheme' + name]) {
|
|
31079
31090
|
message('Warning: missing data for', name);
|
|
31080
31091
|
}
|
|
31081
31092
|
});
|
|
@@ -31083,7 +31094,7 @@ ${svg}
|
|
|
31083
31094
|
|
|
31084
31095
|
function interpolators(arr) {
|
|
31085
31096
|
arr.forEach(function(name) {
|
|
31086
|
-
if (!
|
|
31097
|
+
if (!d3Scales['interpolate' + name]) {
|
|
31087
31098
|
message('Missing interpolator for', name);
|
|
31088
31099
|
}
|
|
31089
31100
|
});
|
|
@@ -31122,7 +31133,7 @@ ${svg}
|
|
|
31122
31133
|
if (!isColorSchemeName(name)) {
|
|
31123
31134
|
stop('Unknown color scheme name:', name);
|
|
31124
31135
|
} else if (isCategoricalColorScheme(name)) {
|
|
31125
|
-
colors = ramps[name] ||
|
|
31136
|
+
colors = ramps[name] || d3Scales['scheme' + name];
|
|
31126
31137
|
} else {
|
|
31127
31138
|
colors = getColorRamp(name, n);
|
|
31128
31139
|
}
|
|
@@ -31156,9 +31167,8 @@ ${svg}
|
|
|
31156
31167
|
function getColorRamp(name, n, stops) {
|
|
31157
31168
|
initSchemes();
|
|
31158
31169
|
name = standardName(name);
|
|
31159
|
-
|
|
31160
|
-
var
|
|
31161
|
-
var interpolate = lib['interpolate' + name];
|
|
31170
|
+
var ramps = d3Scales['scheme' + name];
|
|
31171
|
+
var interpolate = d3Scales['interpolate' + name];
|
|
31162
31172
|
var ramp;
|
|
31163
31173
|
if (!ramps && !interpolate) {
|
|
31164
31174
|
stop('Unknown color scheme name:', name);
|
|
@@ -36794,6 +36804,7 @@ ${svg}
|
|
|
36794
36804
|
} else {
|
|
36795
36805
|
ctx = getNullLayerProxy(targets);
|
|
36796
36806
|
}
|
|
36807
|
+
ctx.global = getStashedVar('defs') || {}; // TODO: remove duplication with mapshaper.expressions.mjs
|
|
36797
36808
|
var exprOpts = Object.assign({returns: true}, opts);
|
|
36798
36809
|
var func = compileExpressionToFunction(expr, exprOpts);
|
|
36799
36810
|
|
|
@@ -42072,6 +42083,13 @@ ${svg}
|
|
|
42072
42083
|
inputObj = null;
|
|
42073
42084
|
}
|
|
42074
42085
|
|
|
42086
|
+
if (commands.length === 0) {
|
|
42087
|
+
return callback(new UserError("No commands to run"));
|
|
42088
|
+
}
|
|
42089
|
+
|
|
42090
|
+
commands = runAndRemoveInfoCommands(commands);
|
|
42091
|
+
if (commands.length === 0) return done(null);
|
|
42092
|
+
|
|
42075
42093
|
// add options to -i -o -join -clip -erase commands to bypass file i/o
|
|
42076
42094
|
// TODO: find a less kludgy solution
|
|
42077
42095
|
commands.forEach(function(cmd) {
|
|
@@ -42083,7 +42101,20 @@ ${svg}
|
|
|
42083
42101
|
}
|
|
42084
42102
|
});
|
|
42085
42103
|
|
|
42086
|
-
|
|
42104
|
+
var batches = divideImportCommand(commands);
|
|
42105
|
+
utils.reduceAsync(batches, null, nextGroup, done);
|
|
42106
|
+
|
|
42107
|
+
function nextGroup(prevJob, commands, next) {
|
|
42108
|
+
runParsedCommands(commands, new Job(), function(err, job) {
|
|
42109
|
+
err = filterError(err);
|
|
42110
|
+
next(err, job);
|
|
42111
|
+
});
|
|
42112
|
+
}
|
|
42113
|
+
|
|
42114
|
+
function done(err, job) {
|
|
42115
|
+
err = filterError(err);
|
|
42116
|
+
callback(err, job);
|
|
42117
|
+
}
|
|
42087
42118
|
}
|
|
42088
42119
|
|
|
42089
42120
|
function commandTakesFileInput(name) {
|
|
@@ -42130,23 +42161,19 @@ ${svg}
|
|
|
42130
42161
|
});
|
|
42131
42162
|
}
|
|
42132
42163
|
|
|
42164
|
+
|
|
42133
42165
|
// Execute a sequence of parsed commands
|
|
42134
42166
|
// @commands Array of parsed commands
|
|
42135
|
-
// @job:
|
|
42136
|
-
// @
|
|
42167
|
+
// @job: Job object containing previously imported data
|
|
42168
|
+
// @done: function([error], [job])
|
|
42137
42169
|
//
|
|
42138
|
-
function runParsedCommands(commands, job,
|
|
42139
|
-
if (!
|
|
42140
|
-
|
|
42141
|
-
|
|
42142
|
-
|
|
42143
|
-
if (!utils.isArray(commands)) {
|
|
42144
|
-
error("Expected an array of parsed commands");
|
|
42145
|
-
}
|
|
42146
|
-
|
|
42147
|
-
if (commands.length === 0) {
|
|
42148
|
-
return done(new UserError("No commands to run"));
|
|
42170
|
+
function runParsedCommands(commands, job, done) {
|
|
42171
|
+
if (!runningInBrowser() && commands[commands.length-1].name == 'o') {
|
|
42172
|
+
// in CLI, set 'final' flag on final -o command, so the export function knows
|
|
42173
|
+
// that it can modify the output dataset in-place instead of making a copy.
|
|
42174
|
+
commands[commands.length-1].options.final = true;
|
|
42149
42175
|
}
|
|
42176
|
+
if (!job) job = new Job();
|
|
42150
42177
|
commands = readAndRemoveSettings(job, commands);
|
|
42151
42178
|
if (!runningInBrowser()) {
|
|
42152
42179
|
printStartupMessages();
|
|
@@ -42155,31 +42182,13 @@ ${svg}
|
|
|
42155
42182
|
if (commands.length === 0) {
|
|
42156
42183
|
return done(null);
|
|
42157
42184
|
}
|
|
42158
|
-
|
|
42159
|
-
|
|
42160
|
-
|
|
42161
|
-
|
|
42162
|
-
}
|
|
42163
|
-
|
|
42164
|
-
var groups = divideImportCommand(commands);
|
|
42165
|
-
if (groups.length == 1) {
|
|
42166
|
-
// run a simple sequence of commands (input files are not batched)
|
|
42167
|
-
return runParsedCommands2(commands, job, done);
|
|
42168
|
-
}
|
|
42169
|
-
|
|
42170
|
-
// run duplicated commands (i.e. batch mode)
|
|
42171
|
-
utils.reduceAsync(groups, job, nextGroup, done);
|
|
42172
|
-
|
|
42173
|
-
function nextGroup(job, commands, next) {
|
|
42174
|
-
runParsedCommands2(commands, job, function(err, job) {
|
|
42175
|
-
err = filterError(err);
|
|
42176
|
-
next(err, job);
|
|
42177
|
-
});
|
|
42178
|
-
}
|
|
42185
|
+
// we're no longer using the same Job for all batches -- no reset needed
|
|
42186
|
+
// // resetting closes any unterminated -if blocks from a previous command sequence
|
|
42187
|
+
// resetControlFlow(job);
|
|
42188
|
+
utils.reduceAsync(commands, job, nextCommand, done);
|
|
42179
42189
|
|
|
42180
|
-
function
|
|
42181
|
-
|
|
42182
|
-
cb(err, job);
|
|
42190
|
+
function nextCommand(job, cmd, next) {
|
|
42191
|
+
runCommand(cmd, job, next);
|
|
42183
42192
|
}
|
|
42184
42193
|
}
|
|
42185
42194
|
|
|
@@ -42191,17 +42200,6 @@ ${svg}
|
|
|
42191
42200
|
return err;
|
|
42192
42201
|
}
|
|
42193
42202
|
|
|
42194
|
-
function runParsedCommands2(commands, job, cb) {
|
|
42195
|
-
// resetting closes any unterminated -if blocks from a previous command sequence
|
|
42196
|
-
resetControlFlow(job);
|
|
42197
|
-
utils.reduceAsync(commands, job, nextCommand, cb);
|
|
42198
|
-
|
|
42199
|
-
function nextCommand(job, cmd, next) {
|
|
42200
|
-
runCommand(cmd, job, next);
|
|
42201
|
-
}
|
|
42202
|
-
}
|
|
42203
|
-
|
|
42204
|
-
|
|
42205
42203
|
// If an initial import command indicates that several input files should be
|
|
42206
42204
|
// processed separately, then duplicate the sequence of commands to run
|
|
42207
42205
|
// once for each input file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mapshaper",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"description": "A tool for editing vector datasets for mapping and GIS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shapefile",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"test": "mocha test",
|
|
27
27
|
"build": "rollup --config",
|
|
28
|
-
|
|
28
|
+
"lint": "eslint --ext mjs src/",
|
|
29
29
|
"prepublishOnly": "npm lint; npm test; ./pre-publish",
|
|
30
30
|
"postpublish": "./release_web_ui; ./release_github_version",
|
|
31
31
|
"browserify": "browserify -r sync-request -r mproj -r buffer -r iconv-lite -r fs -r flatbush -r rw -r path -r kdbush -r @tmcw/togeojson -o www/modules.js",
|
package/www/mapshaper-gui.js
CHANGED
|
@@ -2488,6 +2488,7 @@
|
|
|
2488
2488
|
var historyId = 0;
|
|
2489
2489
|
var _isOpen = false;
|
|
2490
2490
|
var btn = gui.container.findChild('.console-btn').on('click', toggle);
|
|
2491
|
+
var globals = {}; // share user-defined globals between runs
|
|
2491
2492
|
|
|
2492
2493
|
// expose this function, so other components can run commands (e.g. box tool)
|
|
2493
2494
|
this.runMapshaperCommands = runMapshaperCommands;
|
|
@@ -2863,7 +2864,12 @@
|
|
|
2863
2864
|
if (commands.length === 0) return done();
|
|
2864
2865
|
applyParsedCommands(commands, function(err, flags) {
|
|
2865
2866
|
if (!err) {
|
|
2866
|
-
|
|
2867
|
+
str = internal.standardizeConsoleCommands(str);
|
|
2868
|
+
gui.session.consoleCommands(str);
|
|
2869
|
+
// kludge to terminate unclosed -if blocks
|
|
2870
|
+
if (str.includes('-if') && !str.includes('-endif')) {
|
|
2871
|
+
gui.session.consoleCommands('-endif');
|
|
2872
|
+
}
|
|
2867
2873
|
}
|
|
2868
2874
|
if (flags) {
|
|
2869
2875
|
// if the command may have changed data, and a tool with an edit mode is being used,
|
|
@@ -2884,6 +2890,8 @@
|
|
|
2884
2890
|
prevTableSize = prevTable ? prevTable.size() : 0,
|
|
2885
2891
|
prevArcCount = prevArcs ? prevArcs.size() : 0,
|
|
2886
2892
|
job = new internal.Job(model);
|
|
2893
|
+
|
|
2894
|
+
job.defs = globals; // share globals between runs
|
|
2887
2895
|
internal.runParsedCommands(commands, job, function(err) {
|
|
2888
2896
|
var flags = getCommandFlags(commands),
|
|
2889
2897
|
active2 = model.getActiveLayer(),
|
|
@@ -9782,6 +9790,7 @@
|
|
|
9782
9790
|
var faded = false;
|
|
9783
9791
|
|
|
9784
9792
|
if (params) {
|
|
9793
|
+
// TODO: check page URL for compatibility with mapbox key
|
|
9785
9794
|
init();
|
|
9786
9795
|
} else {
|
|
9787
9796
|
basemapBtn.hide();
|
package/www/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.6.
|
|
3
|
+
var VERSION = "0.6.6";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -10349,8 +10349,13 @@
|
|
|
10349
10349
|
sum: captureNum,
|
|
10350
10350
|
sums: capture,
|
|
10351
10351
|
average: captureNum,
|
|
10352
|
+
mean: captureNum,
|
|
10352
10353
|
median: captureNum,
|
|
10353
10354
|
quantile: captureNum,
|
|
10355
|
+
iqr: captureNum,
|
|
10356
|
+
quartile1: captureNum,
|
|
10357
|
+
quartile2: captureNum,
|
|
10358
|
+
quartile3: captureNum,
|
|
10354
10359
|
min: captureNum,
|
|
10355
10360
|
max: captureNum,
|
|
10356
10361
|
mode: capture,
|
|
@@ -10366,9 +10371,16 @@
|
|
|
10366
10371
|
sums: wrap(sums),
|
|
10367
10372
|
median: wrap(utils.findMedian),
|
|
10368
10373
|
quantile: wrap2(utils.findQuantile),
|
|
10374
|
+
iqr: wrap(function(arr) {
|
|
10375
|
+
return utils.findQuantile(arr, 0.75) - utils.findQuantile(arr, 0.25);
|
|
10376
|
+
}),
|
|
10377
|
+
quartile1: wrap(function(arr) { return utils.findQuantile(arr, 0.25); }),
|
|
10378
|
+
quartile2: wrap(utils.findMedian),
|
|
10379
|
+
quartile3: wrap(function(arr) { return utils.findQuantile(arr, 0.75); }),
|
|
10369
10380
|
min: wrap(min),
|
|
10370
10381
|
max: wrap(max),
|
|
10371
10382
|
average: wrap(utils.mean),
|
|
10383
|
+
mean: wrap(utils.mean),
|
|
10372
10384
|
mode: wrap(getMode),
|
|
10373
10385
|
collect: wrap(pass),
|
|
10374
10386
|
first: wrap(pass),
|
|
@@ -30928,7 +30940,7 @@ ${svg}
|
|
|
30928
30940
|
|
|
30929
30941
|
var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
|
|
30930
30942
|
|
|
30931
|
-
var
|
|
30943
|
+
var d3Scales = /*#__PURE__*/Object.freeze({
|
|
30932
30944
|
__proto__: null,
|
|
30933
30945
|
schemeCategory10: category10,
|
|
30934
30946
|
schemeAccent: Accent,
|
|
@@ -31065,7 +31077,6 @@ ${svg}
|
|
|
31065
31077
|
}
|
|
31066
31078
|
|
|
31067
31079
|
function testLib() {
|
|
31068
|
-
var lib = require('d3-scale-chromatic');
|
|
31069
31080
|
schemes(index.categorical);
|
|
31070
31081
|
schemes(index.sequential);
|
|
31071
31082
|
schemes(index.diverging);
|
|
@@ -31075,7 +31086,7 @@ ${svg}
|
|
|
31075
31086
|
|
|
31076
31087
|
function schemes(arr) {
|
|
31077
31088
|
arr.forEach(function(name) {
|
|
31078
|
-
if (!
|
|
31089
|
+
if (!d3Scales['scheme' + name]) {
|
|
31079
31090
|
message('Warning: missing data for', name);
|
|
31080
31091
|
}
|
|
31081
31092
|
});
|
|
@@ -31083,7 +31094,7 @@ ${svg}
|
|
|
31083
31094
|
|
|
31084
31095
|
function interpolators(arr) {
|
|
31085
31096
|
arr.forEach(function(name) {
|
|
31086
|
-
if (!
|
|
31097
|
+
if (!d3Scales['interpolate' + name]) {
|
|
31087
31098
|
message('Missing interpolator for', name);
|
|
31088
31099
|
}
|
|
31089
31100
|
});
|
|
@@ -31122,7 +31133,7 @@ ${svg}
|
|
|
31122
31133
|
if (!isColorSchemeName(name)) {
|
|
31123
31134
|
stop('Unknown color scheme name:', name);
|
|
31124
31135
|
} else if (isCategoricalColorScheme(name)) {
|
|
31125
|
-
colors = ramps[name] ||
|
|
31136
|
+
colors = ramps[name] || d3Scales['scheme' + name];
|
|
31126
31137
|
} else {
|
|
31127
31138
|
colors = getColorRamp(name, n);
|
|
31128
31139
|
}
|
|
@@ -31156,9 +31167,8 @@ ${svg}
|
|
|
31156
31167
|
function getColorRamp(name, n, stops) {
|
|
31157
31168
|
initSchemes();
|
|
31158
31169
|
name = standardName(name);
|
|
31159
|
-
|
|
31160
|
-
var
|
|
31161
|
-
var interpolate = lib['interpolate' + name];
|
|
31170
|
+
var ramps = d3Scales['scheme' + name];
|
|
31171
|
+
var interpolate = d3Scales['interpolate' + name];
|
|
31162
31172
|
var ramp;
|
|
31163
31173
|
if (!ramps && !interpolate) {
|
|
31164
31174
|
stop('Unknown color scheme name:', name);
|
|
@@ -36794,6 +36804,7 @@ ${svg}
|
|
|
36794
36804
|
} else {
|
|
36795
36805
|
ctx = getNullLayerProxy(targets);
|
|
36796
36806
|
}
|
|
36807
|
+
ctx.global = getStashedVar('defs') || {}; // TODO: remove duplication with mapshaper.expressions.mjs
|
|
36797
36808
|
var exprOpts = Object.assign({returns: true}, opts);
|
|
36798
36809
|
var func = compileExpressionToFunction(expr, exprOpts);
|
|
36799
36810
|
|
|
@@ -42072,6 +42083,13 @@ ${svg}
|
|
|
42072
42083
|
inputObj = null;
|
|
42073
42084
|
}
|
|
42074
42085
|
|
|
42086
|
+
if (commands.length === 0) {
|
|
42087
|
+
return callback(new UserError("No commands to run"));
|
|
42088
|
+
}
|
|
42089
|
+
|
|
42090
|
+
commands = runAndRemoveInfoCommands(commands);
|
|
42091
|
+
if (commands.length === 0) return done(null);
|
|
42092
|
+
|
|
42075
42093
|
// add options to -i -o -join -clip -erase commands to bypass file i/o
|
|
42076
42094
|
// TODO: find a less kludgy solution
|
|
42077
42095
|
commands.forEach(function(cmd) {
|
|
@@ -42083,7 +42101,20 @@ ${svg}
|
|
|
42083
42101
|
}
|
|
42084
42102
|
});
|
|
42085
42103
|
|
|
42086
|
-
|
|
42104
|
+
var batches = divideImportCommand(commands);
|
|
42105
|
+
utils.reduceAsync(batches, null, nextGroup, done);
|
|
42106
|
+
|
|
42107
|
+
function nextGroup(prevJob, commands, next) {
|
|
42108
|
+
runParsedCommands(commands, new Job(), function(err, job) {
|
|
42109
|
+
err = filterError(err);
|
|
42110
|
+
next(err, job);
|
|
42111
|
+
});
|
|
42112
|
+
}
|
|
42113
|
+
|
|
42114
|
+
function done(err, job) {
|
|
42115
|
+
err = filterError(err);
|
|
42116
|
+
callback(err, job);
|
|
42117
|
+
}
|
|
42087
42118
|
}
|
|
42088
42119
|
|
|
42089
42120
|
function commandTakesFileInput(name) {
|
|
@@ -42130,23 +42161,19 @@ ${svg}
|
|
|
42130
42161
|
});
|
|
42131
42162
|
}
|
|
42132
42163
|
|
|
42164
|
+
|
|
42133
42165
|
// Execute a sequence of parsed commands
|
|
42134
42166
|
// @commands Array of parsed commands
|
|
42135
|
-
// @job:
|
|
42136
|
-
// @
|
|
42167
|
+
// @job: Job object containing previously imported data
|
|
42168
|
+
// @done: function([error], [job])
|
|
42137
42169
|
//
|
|
42138
|
-
function runParsedCommands(commands, job,
|
|
42139
|
-
if (!
|
|
42140
|
-
|
|
42141
|
-
|
|
42142
|
-
|
|
42143
|
-
if (!utils.isArray(commands)) {
|
|
42144
|
-
error("Expected an array of parsed commands");
|
|
42145
|
-
}
|
|
42146
|
-
|
|
42147
|
-
if (commands.length === 0) {
|
|
42148
|
-
return done(new UserError("No commands to run"));
|
|
42170
|
+
function runParsedCommands(commands, job, done) {
|
|
42171
|
+
if (!runningInBrowser() && commands[commands.length-1].name == 'o') {
|
|
42172
|
+
// in CLI, set 'final' flag on final -o command, so the export function knows
|
|
42173
|
+
// that it can modify the output dataset in-place instead of making a copy.
|
|
42174
|
+
commands[commands.length-1].options.final = true;
|
|
42149
42175
|
}
|
|
42176
|
+
if (!job) job = new Job();
|
|
42150
42177
|
commands = readAndRemoveSettings(job, commands);
|
|
42151
42178
|
if (!runningInBrowser()) {
|
|
42152
42179
|
printStartupMessages();
|
|
@@ -42155,31 +42182,13 @@ ${svg}
|
|
|
42155
42182
|
if (commands.length === 0) {
|
|
42156
42183
|
return done(null);
|
|
42157
42184
|
}
|
|
42158
|
-
|
|
42159
|
-
|
|
42160
|
-
|
|
42161
|
-
|
|
42162
|
-
}
|
|
42163
|
-
|
|
42164
|
-
var groups = divideImportCommand(commands);
|
|
42165
|
-
if (groups.length == 1) {
|
|
42166
|
-
// run a simple sequence of commands (input files are not batched)
|
|
42167
|
-
return runParsedCommands2(commands, job, done);
|
|
42168
|
-
}
|
|
42169
|
-
|
|
42170
|
-
// run duplicated commands (i.e. batch mode)
|
|
42171
|
-
utils.reduceAsync(groups, job, nextGroup, done);
|
|
42172
|
-
|
|
42173
|
-
function nextGroup(job, commands, next) {
|
|
42174
|
-
runParsedCommands2(commands, job, function(err, job) {
|
|
42175
|
-
err = filterError(err);
|
|
42176
|
-
next(err, job);
|
|
42177
|
-
});
|
|
42178
|
-
}
|
|
42185
|
+
// we're no longer using the same Job for all batches -- no reset needed
|
|
42186
|
+
// // resetting closes any unterminated -if blocks from a previous command sequence
|
|
42187
|
+
// resetControlFlow(job);
|
|
42188
|
+
utils.reduceAsync(commands, job, nextCommand, done);
|
|
42179
42189
|
|
|
42180
|
-
function
|
|
42181
|
-
|
|
42182
|
-
cb(err, job);
|
|
42190
|
+
function nextCommand(job, cmd, next) {
|
|
42191
|
+
runCommand(cmd, job, next);
|
|
42183
42192
|
}
|
|
42184
42193
|
}
|
|
42185
42194
|
|
|
@@ -42191,17 +42200,6 @@ ${svg}
|
|
|
42191
42200
|
return err;
|
|
42192
42201
|
}
|
|
42193
42202
|
|
|
42194
|
-
function runParsedCommands2(commands, job, cb) {
|
|
42195
|
-
// resetting closes any unterminated -if blocks from a previous command sequence
|
|
42196
|
-
resetControlFlow(job);
|
|
42197
|
-
utils.reduceAsync(commands, job, nextCommand, cb);
|
|
42198
|
-
|
|
42199
|
-
function nextCommand(job, cmd, next) {
|
|
42200
|
-
runCommand(cmd, job, next);
|
|
42201
|
-
}
|
|
42202
|
-
}
|
|
42203
|
-
|
|
42204
|
-
|
|
42205
42203
|
// If an initial import command indicates that several input files should be
|
|
42206
42204
|
// processed separately, then duplicate the sequence of commands to run
|
|
42207
42205
|
// once for each input file
|