mapshaper 0.7.2 → 0.7.3
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/LICENSE +1 -1
- package/mapshaper.js +1 -1
- package/package.json +4 -2
- package/www/mapshaper.js +1 -1
- package/www/docs/_assets/cmd-search.js +0 -213
- package/www/docs/_assets/docs.css +0 -722
- package/www/docs/_assets/docs.js +0 -75
- package/www/docs/_assets/highlight.css +0 -10
- package/www/docs/essentials/command-line.html +0 -127
- package/www/docs/essentials/command-line.html.md +0 -112
- package/www/docs/essentials/web-app.html +0 -138
- package/www/docs/essentials/web-app.html.md +0 -106
- package/www/docs/examples/basics.html +0 -275
- package/www/docs/examples/basics.html.md +0 -370
- package/www/docs/examples/data/Makefile +0 -31
- package/www/docs/examples/data/globe.msx +0 -0
- package/www/docs/examples/data/globe.svg +0 -616
- package/www/docs/examples/data/globe.txt +0 -21
- package/www/docs/examples/data/globe.zip +0 -0
- package/www/docs/examples/data/ne_50m_admin_0_countries.geojson +0 -1
- package/www/docs/examples/data/ne_50m_admin_1_states_provinces_lakes.geojson +0 -1
- package/www/docs/examples/data/us-states.msx +0 -0
- package/www/docs/examples/data/us-states.svg +0 -56
- package/www/docs/examples/data/us-states.txt +0 -6
- package/www/docs/examples/data/us-states.zip +0 -0
- package/www/docs/examples/globe.html +0 -108
- package/www/docs/examples/globe.html.md +0 -64
- package/www/docs/examples/us-states.html +0 -88
- package/www/docs/examples/us-states.html.md +0 -44
- package/www/docs/formats/csv.html +0 -127
- package/www/docs/formats/csv.html.md +0 -97
- package/www/docs/formats/dbf.html +0 -87
- package/www/docs/formats/dbf.html.md +0 -39
- package/www/docs/formats/flatgeobuf.html +0 -85
- package/www/docs/formats/flatgeobuf.html.md +0 -41
- package/www/docs/formats/geojson.html +0 -107
- package/www/docs/formats/geojson.html.md +0 -65
- package/www/docs/formats/geopackage.html +0 -87
- package/www/docs/formats/geopackage.html.md +0 -42
- package/www/docs/formats/json.html +0 -83
- package/www/docs/formats/json.html.md +0 -35
- package/www/docs/formats/kml.html +0 -82
- package/www/docs/formats/kml.html.md +0 -39
- package/www/docs/formats/overview.html +0 -191
- package/www/docs/formats/overview.html.md +0 -34
- package/www/docs/formats/shapefile.html +0 -123
- package/www/docs/formats/shapefile.html.md +0 -84
- package/www/docs/formats/snapshot.html +0 -87
- package/www/docs/formats/snapshot.html.md +0 -39
- package/www/docs/formats/svg.html +0 -99
- package/www/docs/formats/svg.html.md +0 -51
- package/www/docs/formats/topojson.html +0 -102
- package/www/docs/formats/topojson.html.md +0 -54
- package/www/docs/gallery/index.html +0 -80
- package/www/docs/gallery/index.html.md +0 -29
- package/www/docs/guides/combining-layers.html +0 -109
- package/www/docs/guides/combining-layers.html.md +0 -89
- package/www/docs/guides/expressions.html +0 -600
- package/www/docs/guides/expressions.html.md +0 -376
- package/www/docs/guides/programmatic.html +0 -117
- package/www/docs/guides/programmatic.html.md +0 -91
- package/www/docs/guides/projections.html +0 -158
- package/www/docs/guides/projections.html.md +0 -118
- package/www/docs/guides/simplification.html +0 -110
- package/www/docs/guides/simplification.html.md +0 -96
- package/www/docs/guides/topology.html +0 -90
- package/www/docs/guides/topology.html.md +0 -63
- package/www/docs/images/cal-counties.png +0 -0
- package/www/docs/images/simplification-detail.png +0 -0
- package/www/docs/images/simplification-dp.png +0 -0
- package/www/docs/images/simplification-mod2.png +0 -0
- package/www/docs/images/tiger-counties.png +0 -0
- package/www/docs/index.html +0 -101
- package/www/docs/index.html.md +0 -59
- package/www/docs/reference.html +0 -1302
- package/www/docs/reference.html.md +0 -1817
- package/www/docs/whats-new.html +0 -77
- package/www/docs/whats-new.html.md +0 -59
- package/www/llms-full.txt +0 -4053
- package/www/llms.txt +0 -55
package/LICENSE
CHANGED
package/mapshaper.js
CHANGED
|
@@ -52127,7 +52127,7 @@ ${svg}
|
|
|
52127
52127
|
});
|
|
52128
52128
|
}
|
|
52129
52129
|
|
|
52130
|
-
var version = "0.7.
|
|
52130
|
+
var version = "0.7.3";
|
|
52131
52131
|
|
|
52132
52132
|
// Parse command line args into commands and run them
|
|
52133
52133
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mapshaper",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "A tool for editing vector datasets for mapping and GIS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shapefile",
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
"/www/**",
|
|
39
39
|
"!/www/nacis/**",
|
|
40
40
|
"/mapshaper.js",
|
|
41
|
-
"!.DS_Store"
|
|
41
|
+
"!.DS_Store",
|
|
42
|
+
"!/www/docs/**",
|
|
43
|
+
"!/www/llms*"
|
|
42
44
|
],
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"@ngageoint/geopackage": "^4.2.6",
|
package/www/mapshaper.js
CHANGED
|
@@ -52127,7 +52127,7 @@ ${svg}
|
|
|
52127
52127
|
});
|
|
52128
52128
|
}
|
|
52129
52129
|
|
|
52130
|
-
var version = "0.7.
|
|
52130
|
+
var version = "0.7.3";
|
|
52131
52131
|
|
|
52132
52132
|
// Parse command line args into commands and run them
|
|
52133
52133
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// Jump-to-command dropdown for the command reference page.
|
|
2
|
-
//
|
|
3
|
-
// The build script wraps each command in <section class="cmd-section"
|
|
4
|
-
// data-id="-clip" data-name="-clip" data-options="..."> and tags the H2
|
|
5
|
-
// above each group as <h2 class="cmd-category">. We use that to populate a
|
|
6
|
-
// dropdown of matching commands beneath the search input. Selecting an item
|
|
7
|
-
// jumps to the corresponding section -- the page itself is never filtered.
|
|
8
|
-
|
|
9
|
-
(function () {
|
|
10
|
-
'use strict';
|
|
11
|
-
|
|
12
|
-
var input = document.querySelector('.cmd-search-input');
|
|
13
|
-
var panel = document.querySelector('.cmd-search-results');
|
|
14
|
-
if (!input || !panel) return;
|
|
15
|
-
|
|
16
|
-
var statusEl = panel.querySelector('.cmd-search-status');
|
|
17
|
-
var listEl = panel.querySelector('.cmd-search-list');
|
|
18
|
-
var sections = Array.prototype.slice.call(
|
|
19
|
-
document.querySelectorAll('.cmd-section')
|
|
20
|
-
);
|
|
21
|
-
if (!sections.length) return;
|
|
22
|
-
|
|
23
|
-
// Build a flat command index. We walk the article in document order so we
|
|
24
|
-
// can attach the most recent h2.cmd-category to each section.
|
|
25
|
-
var article = sections[0].closest('.docs-article') || document;
|
|
26
|
-
var commands = (function () {
|
|
27
|
-
var out = [];
|
|
28
|
-
var currentCat = '';
|
|
29
|
-
var nodes = article.querySelectorAll('h2.cmd-category, section.cmd-section');
|
|
30
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
31
|
-
var n = nodes[i];
|
|
32
|
-
if (n.tagName === 'H2') {
|
|
33
|
-
currentCat = (n.textContent || '').trim();
|
|
34
|
-
} else {
|
|
35
|
-
var name = n.dataset.name || '';
|
|
36
|
-
var opts = n.dataset.options || '';
|
|
37
|
-
var id = n.dataset.id || '';
|
|
38
|
-
if (!id) continue;
|
|
39
|
-
out.push({
|
|
40
|
-
id: id,
|
|
41
|
-
name: name,
|
|
42
|
-
options: opts,
|
|
43
|
-
category: currentCat,
|
|
44
|
-
haystack: (name + ' ' + opts).toLowerCase(),
|
|
45
|
-
el: n
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return out;
|
|
50
|
-
})();
|
|
51
|
-
|
|
52
|
-
var MAX_RESULTS = 60;
|
|
53
|
-
var activeIdx = -1;
|
|
54
|
-
var results = [];
|
|
55
|
-
|
|
56
|
-
function render() {
|
|
57
|
-
var raw = input.value.trim();
|
|
58
|
-
var tokens = raw.toLowerCase().split(/\s+/).filter(Boolean);
|
|
59
|
-
|
|
60
|
-
if (!tokens.length) {
|
|
61
|
-
close();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Score-free matching: every token must appear in the name + options
|
|
66
|
-
// string. We deliberately don't search the full body text -- the dropdown
|
|
67
|
-
// is for jumping to a known command, not for free-text search.
|
|
68
|
-
results = commands.filter(function (c) {
|
|
69
|
-
return tokens.every(function (t) { return c.haystack.indexOf(t) !== -1; });
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
var truncated = results.length > MAX_RESULTS;
|
|
73
|
-
var shown = truncated ? results.slice(0, MAX_RESULTS) : results;
|
|
74
|
-
|
|
75
|
-
listEl.innerHTML = shown.map(function (c, i) {
|
|
76
|
-
return '<li role="option" id="cmd-result-' + i + '" class="cmd-result">' +
|
|
77
|
-
'<a href="#' + escapeAttr(c.id) + '" class="cmd-result-link" tabindex="-1">' +
|
|
78
|
-
'<span class="cmd-result-name">' + escapeHtml(c.name) + '</span>' +
|
|
79
|
-
(c.category
|
|
80
|
-
? '<span class="cmd-result-cat">' + escapeHtml(c.category) + '</span>'
|
|
81
|
-
: '') +
|
|
82
|
-
'</a>' +
|
|
83
|
-
'</li>';
|
|
84
|
-
}).join('');
|
|
85
|
-
|
|
86
|
-
if (!results.length) {
|
|
87
|
-
statusEl.textContent = 'No commands match \u201c' + raw + '\u201d.';
|
|
88
|
-
} else if (truncated) {
|
|
89
|
-
statusEl.textContent = 'Showing first ' + MAX_RESULTS + ' of ' +
|
|
90
|
-
results.length + ' matches.';
|
|
91
|
-
} else if (results.length === 1) {
|
|
92
|
-
statusEl.textContent = '1 match (press Enter to jump).';
|
|
93
|
-
} else {
|
|
94
|
-
statusEl.textContent = results.length + ' matches.';
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
open();
|
|
98
|
-
setActive(results.length ? 0 : -1);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function open() {
|
|
102
|
-
panel.hidden = false;
|
|
103
|
-
input.setAttribute('aria-expanded', 'true');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function close() {
|
|
107
|
-
panel.hidden = true;
|
|
108
|
-
input.setAttribute('aria-expanded', 'false');
|
|
109
|
-
input.removeAttribute('aria-activedescendant');
|
|
110
|
-
activeIdx = -1;
|
|
111
|
-
results = [];
|
|
112
|
-
listEl.innerHTML = '';
|
|
113
|
-
statusEl.textContent = '';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function setActive(idx) {
|
|
117
|
-
var items = listEl.querySelectorAll('.cmd-result');
|
|
118
|
-
if (activeIdx >= 0 && items[activeIdx]) {
|
|
119
|
-
items[activeIdx].classList.remove('is-active');
|
|
120
|
-
}
|
|
121
|
-
activeIdx = idx;
|
|
122
|
-
if (idx < 0 || !items[idx]) {
|
|
123
|
-
input.removeAttribute('aria-activedescendant');
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
items[idx].classList.add('is-active');
|
|
127
|
-
input.setAttribute('aria-activedescendant', 'cmd-result-' + idx);
|
|
128
|
-
// Keep the highlighted item visible inside the (scrollable) dropdown.
|
|
129
|
-
var el = items[idx];
|
|
130
|
-
var top = el.offsetTop;
|
|
131
|
-
var bottom = top + el.offsetHeight;
|
|
132
|
-
if (top < listEl.scrollTop) {
|
|
133
|
-
listEl.scrollTop = top;
|
|
134
|
-
} else if (bottom > listEl.scrollTop + listEl.clientHeight) {
|
|
135
|
-
listEl.scrollTop = bottom - listEl.clientHeight;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function jumpTo(idx) {
|
|
140
|
-
if (idx < 0 || idx >= results.length) return;
|
|
141
|
-
var c = results[idx];
|
|
142
|
-
// Use the anchor's href so the browser updates location.hash and triggers
|
|
143
|
-
// its native scroll-to-anchor behaviour (which respects scroll-margin-top).
|
|
144
|
-
var link = listEl.querySelectorAll('.cmd-result-link')[idx];
|
|
145
|
-
if (link) link.click();
|
|
146
|
-
close();
|
|
147
|
-
input.blur();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function escapeHtml(s) {
|
|
151
|
-
return String(s).replace(/[&<>"']/g, function (c) {
|
|
152
|
-
return ({ '&': '&', '<': '<', '>': '>',
|
|
153
|
-
'"': '"', "'": ''' })[c];
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
function escapeAttr(s) { return escapeHtml(s); }
|
|
157
|
-
|
|
158
|
-
input.addEventListener('input', render);
|
|
159
|
-
input.addEventListener('focus', function () {
|
|
160
|
-
if (input.value.trim()) render();
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
input.addEventListener('keydown', function (e) {
|
|
164
|
-
if (e.key === 'ArrowDown') {
|
|
165
|
-
if (panel.hidden) { render(); return; }
|
|
166
|
-
e.preventDefault();
|
|
167
|
-
if (results.length) setActive((activeIdx + 1) % results.length);
|
|
168
|
-
} else if (e.key === 'ArrowUp') {
|
|
169
|
-
if (panel.hidden) return;
|
|
170
|
-
e.preventDefault();
|
|
171
|
-
if (results.length) {
|
|
172
|
-
setActive(activeIdx <= 0 ? results.length - 1 : activeIdx - 1);
|
|
173
|
-
}
|
|
174
|
-
} else if (e.key === 'Enter') {
|
|
175
|
-
if (panel.hidden || activeIdx < 0) return;
|
|
176
|
-
e.preventDefault();
|
|
177
|
-
jumpTo(activeIdx);
|
|
178
|
-
} else if (e.key === 'Escape') {
|
|
179
|
-
if (!panel.hidden) {
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
close();
|
|
182
|
-
} else if (input.value) {
|
|
183
|
-
e.preventDefault();
|
|
184
|
-
input.value = '';
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// Mouse interaction with the dropdown.
|
|
190
|
-
listEl.addEventListener('mousemove', function (e) {
|
|
191
|
-
var li = e.target.closest('.cmd-result');
|
|
192
|
-
if (!li) return;
|
|
193
|
-
var idx = Array.prototype.indexOf.call(listEl.children, li);
|
|
194
|
-
if (idx !== activeIdx) setActive(idx);
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
listEl.addEventListener('click', function (e) {
|
|
198
|
-
var link = e.target.closest('.cmd-result-link');
|
|
199
|
-
if (!link) return;
|
|
200
|
-
// Let cmd/ctrl/middle-click open in new tab as normal; otherwise
|
|
201
|
-
// intercept so we can close the dropdown after navigation.
|
|
202
|
-
if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return;
|
|
203
|
-
// Default <a> click handles the scroll; just tidy up the UI.
|
|
204
|
-
setTimeout(close, 0);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// Click outside the wrap closes the dropdown.
|
|
208
|
-
document.addEventListener('click', function (e) {
|
|
209
|
-
if (panel.hidden) return;
|
|
210
|
-
if (e.target.closest('.cmd-search-wrap')) return;
|
|
211
|
-
close();
|
|
212
|
-
});
|
|
213
|
-
})();
|