mapshaper 0.7.22 → 0.7.24
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/bin/mapshaper-gui +3 -5
- package/mapshaper.js +5305 -1766
- package/package.json +9 -6
- package/www/geopackage.js +4 -1
- package/www/index.html +21 -19
- package/www/mapshaper-gui.js +74 -27
- package/www/mapshaper.js +5305 -1766
- package/www/modules.js +8 -455
- package/www/page.css +60 -1
- package/www/sponsor.html +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mapshaper",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.24",
|
|
4
4
|
"description": "A tool for editing geospatial data for mapping and GIS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shapefile",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"@tmcw/togeojson": "^5.6.0",
|
|
53
53
|
"@xmldom/xmldom": "^0.8.6",
|
|
54
54
|
"adm-zip": "^0.5.9",
|
|
55
|
-
"big.js": "^7.0.1",
|
|
56
55
|
"commander": "^14.0.3",
|
|
57
56
|
"cookies": "^0.8.0",
|
|
58
57
|
"d3-color": "3.1.0",
|
|
@@ -60,10 +59,9 @@
|
|
|
60
59
|
"d3-scale-chromatic": "3.0.0",
|
|
61
60
|
"delaunator": "^5.0.0",
|
|
62
61
|
"fflate": "0.8.2",
|
|
63
|
-
"flatbush": "^
|
|
62
|
+
"flatbush": "^4.6.0",
|
|
64
63
|
"flatgeobuf": "^4.3.4",
|
|
65
64
|
"geographiclib-geodesic": "^2.2.0",
|
|
66
|
-
"geokdbush": "^1.1.0",
|
|
67
65
|
"geotiff": "^3.0.5",
|
|
68
66
|
"geotiff-geokeys-to-proj4": "^2024.4.13",
|
|
69
67
|
"hyparquet": "^1.25.6",
|
|
@@ -74,7 +72,7 @@
|
|
|
74
72
|
"jpeg-js": "^0.4.4",
|
|
75
73
|
"kdbush": "^3.0.0",
|
|
76
74
|
"mproj": "0.1.3",
|
|
77
|
-
"msgpackr": "^1.
|
|
75
|
+
"msgpackr": "^1.11.12",
|
|
78
76
|
"open": "^11.0.0",
|
|
79
77
|
"pngjs": "^7.0.0",
|
|
80
78
|
"rw": "~1.3.3",
|
|
@@ -85,6 +83,7 @@
|
|
|
85
83
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
86
84
|
"@rollup/plugin-json": "^6.1.0",
|
|
87
85
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
86
|
+
"big.js": "^7.0.1",
|
|
88
87
|
"csv-spectrum": "^1.0.0",
|
|
89
88
|
"eslint": "^8.16.0",
|
|
90
89
|
"highlight.js": "^11.11.1",
|
|
@@ -117,6 +116,10 @@
|
|
|
117
116
|
"test": "test"
|
|
118
117
|
},
|
|
119
118
|
"optionalDependencies": {
|
|
120
|
-
"@rollup/rollup-linux-x64-gnu": "^4.44.1"
|
|
119
|
+
"@rollup/rollup-linux-x64-gnu": "^4.44.1",
|
|
120
|
+
"better-sqlite3": "^12.10.0"
|
|
121
|
+
},
|
|
122
|
+
"overrides": {
|
|
123
|
+
"better-sqlite3": "^12.10.0"
|
|
121
124
|
}
|
|
122
125
|
}
|
package/www/geopackage.js
CHANGED
|
@@ -3033,6 +3033,9 @@
|
|
|
3033
3033
|
before.run();
|
|
3034
3034
|
try {
|
|
3035
3035
|
const result = apply.call(fn, this, arguments);
|
|
3036
|
+
if (result && typeof result.then === 'function') {
|
|
3037
|
+
throw new TypeError('Transaction function cannot return a promise');
|
|
3038
|
+
}
|
|
3036
3039
|
after.run();
|
|
3037
3040
|
return result;
|
|
3038
3041
|
} catch (ex) {
|
|
@@ -4276,7 +4279,7 @@
|
|
|
4276
4279
|
}
|
|
4277
4280
|
|
|
4278
4281
|
// Make sure the specified directory exists
|
|
4279
|
-
if (!anonymous && !fs.existsSync(path.dirname(filename))) {
|
|
4282
|
+
if (!anonymous && !filename.startsWith('file:') && !fs.existsSync(path.dirname(filename))) {
|
|
4280
4283
|
throw new TypeError('Cannot open database because the directory does not exist');
|
|
4281
4284
|
}
|
|
4282
4285
|
|
package/www/index.html
CHANGED
|
@@ -344,29 +344,31 @@ encoding=big5</span>. Click to see all options.</div></div></div>
|
|
|
344
344
|
|
|
345
345
|
<!-- TODO: remove #mshp-main-page without causing the map to jitter when resized -->
|
|
346
346
|
<div id="mshp-main-page">
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
</div>
|
|
355
|
-
<div class="layer-item">
|
|
356
|
-
<h3>Layers</h3>
|
|
357
|
-
<div class="pin-all pinnable">
|
|
358
|
-
<img class="eye-btn black-eye" src="images/eye.png" alt="">
|
|
359
|
-
<img class="eye-btn green-eye" src="images/eye2.png" alt="">
|
|
347
|
+
<div class="main-area sidebar-panels">
|
|
348
|
+
<div class="layer-control layer-area sidebar-panel">
|
|
349
|
+
<div class="info-box">
|
|
350
|
+
<div class="info-box-scrolled">
|
|
351
|
+
<div class="layer-menu">
|
|
352
|
+
<div class="layer-add-links">
|
|
353
|
+
<span id="add-file-btn" class="layer-menu-link">Add files</span><span class="layer-menu-link-separator"> · </span><span id="add-empty-btn" class="layer-menu-link">Add empty layer</span>
|
|
360
354
|
</div>
|
|
355
|
+
<div class="layer-item">
|
|
356
|
+
<h3>Layers</h3>
|
|
357
|
+
<div class="pin-all pinnable">
|
|
358
|
+
<img class="eye-btn black-eye" src="images/eye.png" alt="">
|
|
359
|
+
<img class="eye-btn green-eye" src="images/eye2.png" alt="">
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
<div class="layer-list"></div>
|
|
363
|
+
<div class="no-layer-note">No data has been added</div>
|
|
364
|
+
</div>
|
|
361
365
|
</div>
|
|
362
|
-
<div class="layer-list"></div>
|
|
363
|
-
<div class="no-layer-note">No data has been added</div>
|
|
364
|
-
</div>
|
|
365
366
|
</div>
|
|
366
367
|
</div>
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
<div class="console console-area sidebar-panel">
|
|
369
|
+
<div class="sidebar-panels-resize-handle" role="separator" aria-orientation="horizontal" aria-label="Resize panels"></div>
|
|
370
|
+
<div class="console-window"><div class="console-buffer selectable"></div></div>
|
|
371
|
+
</div>
|
|
370
372
|
</div>
|
|
371
373
|
<div class="sidebar-resize-handle" role="separator" aria-orientation="vertical" aria-label="Resize sidebar"></div>
|
|
372
374
|
<div class="sidebar-tabs">
|
package/www/mapshaper-gui.js
CHANGED
|
@@ -9348,7 +9348,7 @@
|
|
|
9348
9348
|
this.runCommand = function(str) {
|
|
9349
9349
|
str = str.trim();
|
|
9350
9350
|
if (!str) return;
|
|
9351
|
-
gui.
|
|
9351
|
+
gui.toggleSidebarPanel('console');
|
|
9352
9352
|
submit(str);
|
|
9353
9353
|
};
|
|
9354
9354
|
|
|
@@ -9370,9 +9370,9 @@
|
|
|
9370
9370
|
}
|
|
9371
9371
|
|
|
9372
9372
|
gui.on('sidebar', function(e) {
|
|
9373
|
-
if (e.
|
|
9373
|
+
if (e.panels.includes('console')) {
|
|
9374
9374
|
turnOn();
|
|
9375
|
-
} else if (e.prev
|
|
9375
|
+
} else if (e.prev.includes('console')) {
|
|
9376
9376
|
turnOff();
|
|
9377
9377
|
}
|
|
9378
9378
|
});
|
|
@@ -9431,6 +9431,7 @@
|
|
|
9431
9431
|
// gui instances with the console open. E.g. console could close
|
|
9432
9432
|
// when an instance loses focus.
|
|
9433
9433
|
internal.setLoggingFunctions(consoleMessage, consoleError, consoleStop, consoleWarn);
|
|
9434
|
+
el.addClass('open');
|
|
9434
9435
|
el.show();
|
|
9435
9436
|
input.node().focus();
|
|
9436
9437
|
history = getHistory();
|
|
@@ -9444,6 +9445,7 @@
|
|
|
9444
9445
|
if (GUI.isActiveInstance(gui)) {
|
|
9445
9446
|
setLoggingForGUI(gui); // reset stop, message and error functions
|
|
9446
9447
|
}
|
|
9448
|
+
el.removeClass('open');
|
|
9447
9449
|
el.hide();
|
|
9448
9450
|
input.node().blur();
|
|
9449
9451
|
saveHistory();
|
|
@@ -9506,7 +9508,7 @@
|
|
|
9506
9508
|
if (gui.getMode()) {
|
|
9507
9509
|
gui.clearMode(); // esc closes any open panels
|
|
9508
9510
|
} else {
|
|
9509
|
-
gui.
|
|
9511
|
+
gui.setSidebarPanels([]);
|
|
9510
9512
|
}
|
|
9511
9513
|
capture = true;
|
|
9512
9514
|
|
|
@@ -10916,7 +10918,7 @@
|
|
|
10916
10918
|
function LayerControl(gui) {
|
|
10917
10919
|
var model = gui.model;
|
|
10918
10920
|
var map = gui.map;
|
|
10919
|
-
var el = gui.container.findChild(".layer-control");
|
|
10921
|
+
var el = gui.container.findChild(".layer-control").hide();
|
|
10920
10922
|
var btn = gui.container.findChild('.layer-control-btn');
|
|
10921
10923
|
var headerBtn = btn.findChild('.active-layer-label');
|
|
10922
10924
|
var tab = gui.container.findChild('.layer-tab');
|
|
@@ -10959,9 +10961,9 @@
|
|
|
10959
10961
|
}
|
|
10960
10962
|
|
|
10961
10963
|
gui.on('sidebar', function(e) {
|
|
10962
|
-
if (e.
|
|
10964
|
+
if (e.panels.includes('layers')) {
|
|
10963
10965
|
turnOn();
|
|
10964
|
-
} else if (e.prev
|
|
10966
|
+
} else if (e.prev.includes('layers')) {
|
|
10965
10967
|
turnOff();
|
|
10966
10968
|
}
|
|
10967
10969
|
});
|
|
@@ -11054,6 +11056,7 @@
|
|
|
11054
11056
|
isOpen = true;
|
|
11055
11057
|
tab.addClass('active').attr('aria-expanded', 'true');
|
|
11056
11058
|
render();
|
|
11059
|
+
el.addClass('open');
|
|
11057
11060
|
el.show();
|
|
11058
11061
|
}
|
|
11059
11062
|
|
|
@@ -11062,6 +11065,7 @@
|
|
|
11062
11065
|
stopDragging();
|
|
11063
11066
|
isOpen = false;
|
|
11064
11067
|
tab.removeClass('active').attr('aria-expanded', 'false');
|
|
11068
|
+
el.removeClass('open');
|
|
11065
11069
|
el.hide();
|
|
11066
11070
|
}
|
|
11067
11071
|
|
|
@@ -23691,9 +23695,10 @@ GUI and setting the size and crop of SVG output.</p><div><input type="text" clas
|
|
|
23691
23695
|
|
|
23692
23696
|
|
|
23693
23697
|
gui.state = {};
|
|
23694
|
-
var
|
|
23695
|
-
var
|
|
23698
|
+
var sidebarPanels = [];
|
|
23699
|
+
var lastSidebarPanels = ['console'];
|
|
23696
23700
|
var sidebarWidth = GUI.getSavedValue('sidebar_width') || 0;
|
|
23701
|
+
var sidebarPanelsSeparatorPosition = GUI.getSavedValue('sidebar_panels_separator_position') || 0;
|
|
23697
23702
|
var sidebarResizeFrame = null;
|
|
23698
23703
|
|
|
23699
23704
|
var msgCount = 0;
|
|
@@ -23744,45 +23749,53 @@ GUI and setting the size and crop of SVG output.</p><div><input type="text" clas
|
|
|
23744
23749
|
setSidebarWidth(sidebarWidth);
|
|
23745
23750
|
}
|
|
23746
23751
|
|
|
23747
|
-
|
|
23748
|
-
|
|
23752
|
+
if (sidebarPanelsSeparatorPosition) {
|
|
23753
|
+
setSidebarPanelsSeparatorPosition(sidebarPanelsSeparatorPosition);
|
|
23754
|
+
}
|
|
23755
|
+
|
|
23756
|
+
gui.getSidebarPanels = function() {
|
|
23757
|
+
return sidebarPanels;
|
|
23749
23758
|
};
|
|
23750
23759
|
|
|
23751
|
-
gui.
|
|
23752
|
-
var prev =
|
|
23753
|
-
|
|
23754
|
-
if (
|
|
23760
|
+
gui.setSidebarPanels = function(panels) {
|
|
23761
|
+
var prev = sidebarPanels;
|
|
23762
|
+
sidebarPanels = panels || [];
|
|
23763
|
+
if (sidebarPanels.length && gui.getMode()) {
|
|
23755
23764
|
gui.clearMode();
|
|
23756
23765
|
}
|
|
23757
|
-
if (
|
|
23758
|
-
if (
|
|
23759
|
-
|
|
23766
|
+
if (sidebarPanels.join('|') === prev.join('|')) return;
|
|
23767
|
+
if (sidebarPanels.length) {
|
|
23768
|
+
lastSidebarPanels = sidebarPanels;
|
|
23760
23769
|
}
|
|
23761
23770
|
gui.container
|
|
23762
|
-
.classed('sidebar-open',
|
|
23763
|
-
.classed('layers-open',
|
|
23764
|
-
.classed('console-open',
|
|
23765
|
-
gui.dispatchEvent('sidebar', {
|
|
23766
|
-
gui.dispatchEvent('resize'
|
|
23771
|
+
.classed('sidebar-open', sidebarPanels.length > 0)
|
|
23772
|
+
.classed('layers-open', sidebarPanels.includes('layers'))
|
|
23773
|
+
.classed('console-open', sidebarPanels.includes('console'));
|
|
23774
|
+
gui.dispatchEvent('sidebar', {panels: sidebarPanels, prev: prev});
|
|
23775
|
+
gui.dispatchEvent('resize');
|
|
23767
23776
|
};
|
|
23768
23777
|
|
|
23769
23778
|
gui.toggleSidebarPanel = function(name) {
|
|
23770
|
-
gui.
|
|
23779
|
+
gui.setSidebarPanels(sidebarPanels.includes(name)
|
|
23780
|
+
? sidebarPanels.filter((n) => n !== name)
|
|
23781
|
+
: [...sidebarPanels, name].sort()
|
|
23782
|
+
);
|
|
23771
23783
|
};
|
|
23772
23784
|
|
|
23773
23785
|
gui.toggleSidebar = function() {
|
|
23774
|
-
gui.
|
|
23786
|
+
gui.setSidebarPanels(sidebarPanels.length ? null : lastSidebarPanels);
|
|
23775
23787
|
};
|
|
23776
23788
|
|
|
23777
23789
|
gui.sidebarPanelIsOpen = function() {
|
|
23778
|
-
return
|
|
23790
|
+
return sidebarPanels.length > 0;
|
|
23779
23791
|
};
|
|
23780
23792
|
|
|
23781
23793
|
gui.consoleIsOpen = function() {
|
|
23782
|
-
return
|
|
23794
|
+
return sidebarPanels.includes('console');
|
|
23783
23795
|
};
|
|
23784
23796
|
|
|
23785
23797
|
initSidebarResizing();
|
|
23798
|
+
initSidebarPanelsResizing();
|
|
23786
23799
|
|
|
23787
23800
|
gui.getRuntimeStateContext = function() {
|
|
23788
23801
|
return getRuntimeStateContext(gui);
|
|
@@ -23869,6 +23882,40 @@ GUI and setting the size and crop of SVG output.</p><div><input type="text" clas
|
|
|
23869
23882
|
gui.dispatchEvent('resize', {source: 'sidebar-resize'});
|
|
23870
23883
|
});
|
|
23871
23884
|
}
|
|
23885
|
+
|
|
23886
|
+
function initSidebarPanelsResizing() {
|
|
23887
|
+
var handle = gui.container.findChild('.sidebar-panels-resize-handle');
|
|
23888
|
+
if (!handle) return;
|
|
23889
|
+
handle.on('mousedown', function(e) {
|
|
23890
|
+
if (!gui.sidebarPanelIsOpen()) return;
|
|
23891
|
+
e.preventDefault();
|
|
23892
|
+
e.stopPropagation();
|
|
23893
|
+
gui.container.addClass('sidebar-panels-resizing');
|
|
23894
|
+
window.addEventListener('mousemove', onMove);
|
|
23895
|
+
window.addEventListener('mouseup', onRelease);
|
|
23896
|
+
});
|
|
23897
|
+
|
|
23898
|
+
function onMove(e) {
|
|
23899
|
+
sidebarPanelsSeparatorPosition = clampSidebarPanelsSeparatorPosition(e.pageY);
|
|
23900
|
+
setSidebarPanelsSeparatorPosition(sidebarPanelsSeparatorPosition);
|
|
23901
|
+
}
|
|
23902
|
+
|
|
23903
|
+
function onRelease() {
|
|
23904
|
+
window.removeEventListener('mousemove', onMove);
|
|
23905
|
+
window.removeEventListener('mouseup', onRelease);
|
|
23906
|
+
gui.container.removeClass('sidebar-panels-resizing');
|
|
23907
|
+
GUI.setSavedValue('sidebar_panels_separator_position', sidebarPanelsSeparatorPosition);
|
|
23908
|
+
}
|
|
23909
|
+
}
|
|
23910
|
+
|
|
23911
|
+
function setSidebarPanelsSeparatorPosition(sidebarPanelsSeparatorPosition) {
|
|
23912
|
+
gui.container.node().style.setProperty('--sidebar-panels-separator-position', sidebarPanelsSeparatorPosition + '%');
|
|
23913
|
+
}
|
|
23914
|
+
|
|
23915
|
+
function clampSidebarPanelsSeparatorPosition(pageY) {
|
|
23916
|
+
var pct = 100 * (pageY - 29) / (window.innerHeight - 29);
|
|
23917
|
+
return Math.max(15, Math.min(85, pct));
|
|
23918
|
+
}
|
|
23872
23919
|
}
|
|
23873
23920
|
|
|
23874
23921
|
function createUndoTestApi(gui) {
|