mapshaper 0.5.116 → 0.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.5.116",
3
+ "version": "0.6.0",
4
4
  "description": "A tool for editing vector datasets for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
@@ -9,6 +9,7 @@
9
9
  "cartography",
10
10
  "simplification",
11
11
  "topology",
12
+ "csv",
12
13
  "gis"
13
14
  ],
14
15
  "author": "Matthew Bloch <masiyou@gmail.com>",
@@ -19,16 +20,14 @@
19
20
  "url": "https://github.com/mbloch/mapshaper"
20
21
  },
21
22
  "engines": {
22
- "node": ">=6.0.0"
23
+ "node": ">=12.0.0"
23
24
  },
24
25
  "scripts": {
25
- "test": "mocha -r esm --parallel --jobs 4 --check-leaks -R dot",
26
+ "test": "mocha test",
26
27
  "build": "rollup --config",
27
28
  "prepublishOnly": "npm test; ./pre-publish",
28
29
  "postpublish": "./release_web_ui; ./release_github_version",
29
- "browserify_old": "browserify -r sync-request -r mproj -r buffer -r iconv-lite -r fs -r flatbush -r rw -r path -r d3-scale-chromatic -r d3-color -r d3-interpolate -o www/modules.js",
30
- "browserify": "browserify -r sync-request -r mproj -r buffer -r iconv-lite -r fs -r flatbush -r rw -r path -r d3-scale-chromatic -r d3-color -r d3-interpolate -r kdbush -r @tmcw/togeojson -o www/modules.js",
31
- "watch": "rollup --config --watch",
30
+ "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",
32
31
  "dev": "rollup --config --watch"
33
32
  },
34
33
  "main": "./mapshaper.js",
@@ -50,7 +49,7 @@
50
49
  "delaunator": "^5.0.0",
51
50
  "flatbush": "^3.2.1",
52
51
  "geokdbush": "^1.1.0",
53
- "iconv-lite": "0.4.24",
52
+ "iconv-lite": "^0.6.3",
54
53
  "kdbush": "^3.0.0",
55
54
  "mproj": "0.0.35",
56
55
  "opn": "^5.3.0",
@@ -59,16 +58,22 @@
59
58
  "tinyqueue": "^2.0.3"
60
59
  },
61
60
  "devDependencies": {
62
- "@rollup/plugin-node-resolve": "^13.0.6",
61
+ "@rollup/plugin-node-resolve": "^13.3.0",
63
62
  "browserify": "^17.0.0",
64
63
  "csv-spectrum": "^1.0.0",
65
- "deep-eql": ">=0.1.3",
66
- "esm": "^3.2.25",
67
- "mocha": "^8.4.0",
68
- "rollup": "^2.60.0",
64
+ "mocha": "^10.0.0",
65
+ "rollup": "^2.73.0",
69
66
  "shell-quote": "^1.6.1",
70
67
  "underscore": "^1.13.1"
71
68
  },
69
+ "mocha": {
70
+ "reporter": "dot",
71
+ "node-option": [
72
+ "experimental-specifier-resolution=node"
73
+ ],
74
+ "parallel": true,
75
+ "jobs": 4
76
+ },
72
77
  "bin": {
73
78
  "mapshaper": "./bin/mapshaper",
74
79
  "mapshaper-gui": "./bin/mapshaper-gui",
package/www/elements.css CHANGED
@@ -67,10 +67,10 @@ div.tip {
67
67
  z-index: 500;
68
68
  cursor: pointer;
69
69
  text-align: center;
70
- font-size: 13px;
70
+ font-size: 14px;
71
71
  line-height: 1;
72
72
  font-weight: normal;
73
- color: #799FCB;
73
+ color: #1385B7;
74
74
  }
75
75
 
76
76
  .tip-button .tip-anchor {
Binary file
package/www/index.html CHANGED
@@ -130,7 +130,8 @@
130
130
 
131
131
  <div class="export-options main-area popup-dialog">
132
132
  <div class="info-box">
133
- <h3>Export menu</h3>
133
+ <div class="close2-btn"></div>
134
+ <h3>Export options</h3>
134
135
  <div style="height:3px"></div>
135
136
  <div class=export-layers>
136
137
  <h4 class="menu-title">Layers</h4>
@@ -140,22 +141,23 @@
140
141
  <div class="export-formats option-menu">
141
142
  </div>
142
143
 
143
- <div class="option-menu"><input type="text" class="advanced-options" placeholder="export options" /><div class="tip-button">?<div class="tip-anchor">
144
+ <div class="option-menu"><input type="text" class="advanced-options" placeholder="command line options" /><div class="tip-button">?<div class="tip-anchor">
144
145
  <div class="tip">Enter options from the command line interface for the -o command. Examples: "bbox" "no-quantization"
145
146
  "precision=0.001"</div></div></div></div>
146
- <div class="cancel-btn btn dialog-btn">Cancel</div>
147
+ <!-- <div class="cancel-btn btn dialog-btn">Cancel</div> -->
147
148
  <div class="save-btn btn dialog-btn">Export</div>
148
149
  </div>
149
150
  </div>
150
151
 
151
152
  <div class="basemap-options main-area popup-dialog">
152
153
  <div class="info-box">
154
+ <div class="close2-btn"></div>
153
155
  <h3>Basemap options</h3>
154
156
  <p class="basemap-note">Your data will be displayed using the Mercator projection.</p>
155
157
  <p class="basemap-warning"></p>
156
158
  <div class="basemap-styles"></div>
157
159
  <div>
158
- <div class="close-btn btn dialog-btn">Close</div>
160
+ <!-- <div class="close-btn btn dialog-btn">Close</div> -->
159
161
  <div class="clear-btn btn dialog-btn disabled">Clear</div>
160
162
  <div class="fade-btn btn dialog-btn disabled">Fade</div>
161
163
  <!-- <div class="hide-btn btn dialog-btn disabled">Hide</div> -->
@@ -165,7 +167,8 @@
165
167
 
166
168
  <div class="simplify-options main-area popup-dialog">
167
169
  <div class="info-box">
168
- <h3>Simplification menu</h3>
170
+ <div class="close2-btn"></div>
171
+ <h3>Simplification</h3>
169
172
  <div class="option-menu">
170
173
  <div><label for="import-retain-opt"><input type="checkbox" class="checkbox import-retain-opt"/>prevent shape removal</label>
171
174
  <div class="tip-button">?<div class="tip-anchor">
@@ -208,7 +211,7 @@ a smoother appearance.</div></div></div></div>
208
211
  </div> <!-- option menu -->
209
212
 
210
213
  <div>
211
- <div class="cancel-btn btn dialog-btn">Cancel</div>
214
+ <!-- <div class="cancel-btn btn dialog-btn">Cancel</div> -->
212
215
  <div class="submit-btn btn dialog-btn">Apply</div>
213
216
  </div>
214
217
  </div> <!-- .info-box -->
@@ -310,7 +310,6 @@
310
310
 
311
311
  // tests if filename is a type that can be used
312
312
  GUI.isReadableFileType = function(filename) {
313
- var ext = internal.getFileExtension(filename).toLowerCase();
314
313
  return !!internal.guessInputFileType(filename) || internal.couldBeDsvFile(filename) ||
315
314
  internal.isZipFile(filename);
316
315
  };
@@ -1354,7 +1353,6 @@
1354
1353
  }
1355
1354
  }
1356
1355
  model.updated({select: true});
1357
-
1358
1356
  }
1359
1357
 
1360
1358
  function clearQueuedFiles() {
@@ -1451,9 +1449,8 @@
1451
1449
  }
1452
1450
 
1453
1451
 
1454
- // TODO: support .cpg
1455
1452
  function isShapefilePart(name) {
1456
- return /\.(shp|shx|dbf|prj)$/i.test(name);
1453
+ return /\.(shp|shx|dbf|prj|cpg)$/i.test(name);
1457
1454
  }
1458
1455
 
1459
1456
  function readImportOpts() {
@@ -2131,7 +2128,7 @@
2131
2128
 
2132
2129
  // init settings menu
2133
2130
  new SimpleButton(menu.findChild('.submit-btn').addClass('default-btn')).on('click', onSubmit);
2134
- new SimpleButton(menu.findChild('.cancel-btn')).on('click', function() {
2131
+ new SimpleButton(menu.findChild('.close2-btn')).on('click', function() {
2135
2132
  if (el.visible()) {
2136
2133
  // cancel just hides menu if slider is visible
2137
2134
  menu.hide();
@@ -2264,7 +2261,7 @@
2264
2261
  menu.hide();
2265
2262
  setTimeout(function() {
2266
2263
  var opts = getSimplifyOptions();
2267
- mapshaper.simplify(dataset, opts);
2264
+ mapshaper.cmd.simplify(dataset, opts);
2268
2265
  gui.session.simplificationApplied(getSimplifyOptionsAsString());
2269
2266
  updateZ(gui.map.getActiveLayer()); // question: does this update all display layers?
2270
2267
  model.updated({
@@ -3159,7 +3156,7 @@
3159
3156
  var layersArr = [];
3160
3157
  var toggleBtn = null; // checkbox <input> for toggling layer selection
3161
3158
  var exportBtn = gui.container.findChild('.export-btn');
3162
- new SimpleButton(menu.findChild('.cancel-btn')).on('click', gui.clearMode);
3159
+ new SimpleButton(menu.findChild('.close2-btn')).on('click', gui.clearMode);
3163
3160
 
3164
3161
  if (!GUI.exportIsSupported()) {
3165
3162
  exportBtn.on('click', function() {
@@ -4415,7 +4412,8 @@
4415
4412
  return self;
4416
4413
  }
4417
4414
 
4418
- var Buffer = require('buffer').Buffer; // works with browserify
4415
+ // Fall back to browserify's Buffer polyfill
4416
+ var B = typeof Buffer != 'undefined' ? Buffer : require('buffer').Buffer;
4419
4417
 
4420
4418
  // This module provides a way for multiple jobs to run together asynchronously
4421
4419
  // while keeping job-level context variables (like "defs") separate.
@@ -5490,10 +5488,10 @@
5490
5488
 
5491
5489
  function createBuffer(arg, arg2) {
5492
5490
  if (isInteger(arg)) {
5493
- return Buffer.allocUnsafe ? Buffer.allocUnsafe(arg) : new Buffer(arg);
5491
+ return B.allocUnsafe ? B.allocUnsafe(arg) : new B(arg);
5494
5492
  } else {
5495
5493
  // check allocUnsafe to make sure Buffer.from() will accept strings (it didn't before Node v5.10)
5496
- return Buffer.from && Buffer.allocUnsafe ? Buffer.from(arg, arg2) : new Buffer(arg, arg2);
5494
+ return B.from && B.allocUnsafe ? B.from(arg, arg2) : new B(arg, arg2);
5497
5495
  }
5498
5496
  }
5499
5497
 
@@ -9764,7 +9762,7 @@
9764
9762
  var menu = gui.container.findChild('.basemap-options');
9765
9763
  // var hideBtn = new SimpleButton(menu.findChild('.hide-btn'));
9766
9764
  var fadeBtn = new SimpleButton(menu.findChild('.fade-btn'));
9767
- var closeBtn = new SimpleButton(menu.findChild('.close-btn'));
9765
+ var closeBtn = new SimpleButton(menu.findChild('.close2-btn'));
9768
9766
  var clearBtn = new SimpleButton(menu.findChild('.clear-btn'));
9769
9767
  var list = menu.findChild('.basemap-styles');
9770
9768
  var container = gui.container.findChild('.basemap-container');