mapshaper 0.6.10 → 0.6.11
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 +27 -7
- package/package.json +1 -1
- package/www/mapshaper-gui.js +16 -12
- package/www/mapshaper.js +27 -7
- package/www/page.css +0 -2
package/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.6.
|
|
3
|
+
var VERSION = "0.6.11";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -7311,15 +7311,18 @@
|
|
|
7311
7311
|
// replacing content so ArrayBuffers can be gc'd
|
|
7312
7312
|
obj.content = cli.convertArrayBuffer(obj.content); // convert to Buffer
|
|
7313
7313
|
}
|
|
7314
|
+
if (opts.gzip) {
|
|
7315
|
+
path = path + '.gz';
|
|
7316
|
+
obj.content = require$1('zlib').gzipSync(obj.content);
|
|
7317
|
+
}
|
|
7314
7318
|
if (opts.output) {
|
|
7315
7319
|
opts.output.push({filename: path, content: obj.content});
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
}
|
|
7320
|
-
cli.writeFile(path, obj.content);
|
|
7321
|
-
message("Wrote " + path);
|
|
7320
|
+
return;
|
|
7321
|
+
} if (!opts.force && inputFiles.indexOf(path) > -1) {
|
|
7322
|
+
stop('Need to use the "-o force" option to overwrite input files.');
|
|
7322
7323
|
}
|
|
7324
|
+
cli.writeFile(path, obj.content);
|
|
7325
|
+
message("Wrote " + path);
|
|
7323
7326
|
});
|
|
7324
7327
|
}
|
|
7325
7328
|
if (cb) cb(null);
|
|
@@ -19346,6 +19349,10 @@ ${svg}
|
|
|
19346
19349
|
describe: 'allow overwriting input files',
|
|
19347
19350
|
type: 'flag'
|
|
19348
19351
|
})
|
|
19352
|
+
.option('gzip', {
|
|
19353
|
+
describe: 'apply gzip compression to output files',
|
|
19354
|
+
type: 'flag'
|
|
19355
|
+
})
|
|
19349
19356
|
.option('dry-run', {
|
|
19350
19357
|
// describe: 'do not output any files'
|
|
19351
19358
|
type: 'flag'
|
|
@@ -23800,6 +23807,19 @@ ${svg}
|
|
|
23800
23807
|
} else if (fileType) { // string type, e.g. kml, geojson
|
|
23801
23808
|
content = cli.readFile(path, encoding || 'utf-8', cache);
|
|
23802
23809
|
|
|
23810
|
+
} else if (getFileExtension(path) == 'gz') {
|
|
23811
|
+
var pathgz = path;
|
|
23812
|
+
path = pathgz.replace(/\.gz$/, '');
|
|
23813
|
+
fileType = guessInputFileType(path);
|
|
23814
|
+
if (!fileType) {
|
|
23815
|
+
stop('Unrecognized file type:', path);
|
|
23816
|
+
}
|
|
23817
|
+
// TODO: consider using a temp file, to support incremental reading
|
|
23818
|
+
content = require('zlib').gunzipSync(cli.readFile(pathgz));
|
|
23819
|
+
if (fileType == 'json' || fileType == 'text') {
|
|
23820
|
+
content = trimBOM(decodeString(content, encoding || 'utf-8'));
|
|
23821
|
+
}
|
|
23822
|
+
|
|
23803
23823
|
} else { // type can't be inferred from filename -- try reading as text
|
|
23804
23824
|
content = cli.readFile(path, encoding || 'utf-8', cache);
|
|
23805
23825
|
fileType = guessInputContentType(content);
|
package/package.json
CHANGED
package/www/mapshaper-gui.js
CHANGED
|
@@ -6936,7 +6936,7 @@
|
|
|
6936
6936
|
|
|
6937
6937
|
el.hide();
|
|
6938
6938
|
|
|
6939
|
-
gui.on('
|
|
6939
|
+
gui.on('map_rendered', function() {
|
|
6940
6940
|
if (!_on) return;
|
|
6941
6941
|
redraw();
|
|
6942
6942
|
});
|
|
@@ -7060,7 +7060,7 @@
|
|
|
7060
7060
|
function coordsToPix(bbox, ext) {
|
|
7061
7061
|
var a = ext.translateCoords(bbox[0], bbox[1]);
|
|
7062
7062
|
var b = ext.translateCoords(bbox[2], bbox[3]);
|
|
7063
|
-
return [a[0], b[1], b[0], a[1]];
|
|
7063
|
+
return [Math.round(a[0]), Math.round(b[1]), Math.round(b[0]), Math.round(a[1])];
|
|
7064
7064
|
}
|
|
7065
7065
|
|
|
7066
7066
|
function pixToCoords(bbox, ext) {
|
|
@@ -7100,21 +7100,29 @@
|
|
|
7100
7100
|
}
|
|
7101
7101
|
|
|
7102
7102
|
function showHandles(handles, props) {
|
|
7103
|
-
var
|
|
7103
|
+
var scaledSize = Math.ceil(Math.min(props.width, props.height) / 5);
|
|
7104
|
+
var HANDLE_SIZE = Math.min(scaledSize, 7);
|
|
7104
7105
|
handles.forEach(function(handle) {
|
|
7105
7106
|
var top = 0,
|
|
7106
7107
|
left = 0;
|
|
7107
7108
|
if (handle.col == 'center') {
|
|
7108
|
-
left += props.width / 2 -
|
|
7109
|
+
left += props.width / 2 - HANDLE_SIZE / 2;
|
|
7109
7110
|
} else if (handle.col == 'right') {
|
|
7110
|
-
left += props.width -
|
|
7111
|
+
left += props.width - HANDLE_SIZE + 1;
|
|
7112
|
+
} else {
|
|
7113
|
+
left -= 1;
|
|
7111
7114
|
}
|
|
7112
7115
|
if (handle.row == 'center') {
|
|
7113
|
-
top += props.height / 2 -
|
|
7116
|
+
top += props.height / 2 - HANDLE_SIZE / 2;
|
|
7114
7117
|
} else if (handle.row == 'bottom') {
|
|
7115
|
-
top += props.height -
|
|
7118
|
+
top += props.height - HANDLE_SIZE + 1;
|
|
7119
|
+
} else {
|
|
7120
|
+
top -= 1;
|
|
7116
7121
|
}
|
|
7122
|
+
|
|
7117
7123
|
handle.el.css({
|
|
7124
|
+
width: HANDLE_SIZE,
|
|
7125
|
+
height: HANDLE_SIZE,
|
|
7118
7126
|
top: top,
|
|
7119
7127
|
left: left
|
|
7120
7128
|
});
|
|
@@ -7158,11 +7166,6 @@
|
|
|
7158
7166
|
ext.home();
|
|
7159
7167
|
});
|
|
7160
7168
|
|
|
7161
|
-
ext.on('change', function() {
|
|
7162
|
-
// kludge so controls (e.g. HighlightBox) can initialize before map is ready
|
|
7163
|
-
gui.dispatchEvent('map_navigation');
|
|
7164
|
-
});
|
|
7165
|
-
|
|
7166
7169
|
zoomTween.on('change', function(e) {
|
|
7167
7170
|
ext.zoomToExtent(e.value, _fx, _fy);
|
|
7168
7171
|
});
|
|
@@ -10602,6 +10605,7 @@
|
|
|
10602
10605
|
_stack.drawOverlayLayer(_overlayLyr, action);
|
|
10603
10606
|
// draw furniture
|
|
10604
10607
|
_stack.drawFurnitureLayers(furnitureLayers, action);
|
|
10608
|
+
gui.dispatchEvent('map_rendered');
|
|
10605
10609
|
}
|
|
10606
10610
|
}
|
|
10607
10611
|
|
package/www/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.6.
|
|
3
|
+
var VERSION = "0.6.11";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -7311,15 +7311,18 @@
|
|
|
7311
7311
|
// replacing content so ArrayBuffers can be gc'd
|
|
7312
7312
|
obj.content = cli.convertArrayBuffer(obj.content); // convert to Buffer
|
|
7313
7313
|
}
|
|
7314
|
+
if (opts.gzip) {
|
|
7315
|
+
path = path + '.gz';
|
|
7316
|
+
obj.content = require$1('zlib').gzipSync(obj.content);
|
|
7317
|
+
}
|
|
7314
7318
|
if (opts.output) {
|
|
7315
7319
|
opts.output.push({filename: path, content: obj.content});
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
}
|
|
7320
|
-
cli.writeFile(path, obj.content);
|
|
7321
|
-
message("Wrote " + path);
|
|
7320
|
+
return;
|
|
7321
|
+
} if (!opts.force && inputFiles.indexOf(path) > -1) {
|
|
7322
|
+
stop('Need to use the "-o force" option to overwrite input files.');
|
|
7322
7323
|
}
|
|
7324
|
+
cli.writeFile(path, obj.content);
|
|
7325
|
+
message("Wrote " + path);
|
|
7323
7326
|
});
|
|
7324
7327
|
}
|
|
7325
7328
|
if (cb) cb(null);
|
|
@@ -19346,6 +19349,10 @@ ${svg}
|
|
|
19346
19349
|
describe: 'allow overwriting input files',
|
|
19347
19350
|
type: 'flag'
|
|
19348
19351
|
})
|
|
19352
|
+
.option('gzip', {
|
|
19353
|
+
describe: 'apply gzip compression to output files',
|
|
19354
|
+
type: 'flag'
|
|
19355
|
+
})
|
|
19349
19356
|
.option('dry-run', {
|
|
19350
19357
|
// describe: 'do not output any files'
|
|
19351
19358
|
type: 'flag'
|
|
@@ -23800,6 +23807,19 @@ ${svg}
|
|
|
23800
23807
|
} else if (fileType) { // string type, e.g. kml, geojson
|
|
23801
23808
|
content = cli.readFile(path, encoding || 'utf-8', cache);
|
|
23802
23809
|
|
|
23810
|
+
} else if (getFileExtension(path) == 'gz') {
|
|
23811
|
+
var pathgz = path;
|
|
23812
|
+
path = pathgz.replace(/\.gz$/, '');
|
|
23813
|
+
fileType = guessInputFileType(path);
|
|
23814
|
+
if (!fileType) {
|
|
23815
|
+
stop('Unrecognized file type:', path);
|
|
23816
|
+
}
|
|
23817
|
+
// TODO: consider using a temp file, to support incremental reading
|
|
23818
|
+
content = require('zlib').gunzipSync(cli.readFile(pathgz));
|
|
23819
|
+
if (fileType == 'json' || fileType == 'text') {
|
|
23820
|
+
content = trimBOM(decodeString(content, encoding || 'utf-8'));
|
|
23821
|
+
}
|
|
23822
|
+
|
|
23803
23823
|
} else { // type can't be inferred from filename -- try reading as text
|
|
23804
23824
|
content = cli.readFile(path, encoding || 'utf-8', cache);
|
|
23805
23825
|
fileType = guessInputContentType(content);
|