mapshaper 0.6.75 → 0.6.77

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 CHANGED
@@ -1537,7 +1537,6 @@
1537
1537
  this.xmax = c;
1538
1538
  this.ymax = d;
1539
1539
  if (a > c || b > d) this.update();
1540
- // error("Bounds#setBounds() min/max reversed:", a, b, c, d);
1541
1540
  return this;
1542
1541
  };
1543
1542
 
@@ -5123,10 +5122,12 @@
5123
5122
  if (!P && info.prj) {
5124
5123
  P = parseCrsString(translatePrj(info.prj));
5125
5124
  }
5126
- if (!P && probablyDecimalDegreeBounds(getDatasetBounds(dataset))) {
5127
- // use wgs84 for probable latlong datasets with unknown datums
5128
- str = 'wgs84';
5129
- P = parseCrsString(str);
5125
+ if (!P) {
5126
+ if (probablyDecimalDegreeBounds(getDatasetBounds(dataset))) {
5127
+ // use wgs84 for probable latlong datasets with unknown datums
5128
+ str = 'wgs84';
5129
+ P = parseCrsString(str);
5130
+ }
5130
5131
  }
5131
5132
  return {
5132
5133
  crs: P || null,
@@ -7202,6 +7203,12 @@
7202
7203
  return bounds;
7203
7204
  }
7204
7205
 
7206
+ function datasetIsEmpty(dataset) {
7207
+ return dataset.layers.every(function(lyr) {
7208
+ return layerIsEmpty(lyr);
7209
+ });
7210
+ }
7211
+
7205
7212
  function datasetHasGeometry(dataset) {
7206
7213
  return utils.some(dataset.layers, function(lyr) {
7207
7214
  return layerHasGeometry(lyr);
@@ -7315,6 +7322,7 @@
7315
7322
  copyDatasetForExport: copyDatasetForExport,
7316
7323
  copyDatasetForRenaming: copyDatasetForRenaming,
7317
7324
  getDatasetBounds: getDatasetBounds,
7325
+ datasetIsEmpty: datasetIsEmpty,
7318
7326
  datasetHasGeometry: datasetHasGeometry,
7319
7327
  datasetHasPaths: datasetHasPaths,
7320
7328
  cleanupArcs: cleanupArcs,
@@ -13189,14 +13197,11 @@
13189
13197
  return findVertexIds(p2.x, p2.y, arcs);
13190
13198
  }
13191
13199
 
13192
- function snapVerticesToPoint(ids, p, arcs, final) {
13200
+ function snapVerticesToPoint(ids, p, arcs) {
13193
13201
  var data = arcs.getVertexData();
13194
13202
  ids.forEach(function(idx) {
13195
- if (final) {
13196
- // recalculate bounding box for arc
13197
- arcs.updateArcBounds(findArcIdFromVertexId(idx, data.ii));
13198
- }
13199
13203
  setVertexCoords(p[0], p[1], idx, arcs);
13204
+ arcs.updateArcBounds(findArcIdFromVertexId(idx, data.ii));
13200
13205
  });
13201
13206
  }
13202
13207
 
@@ -13452,7 +13457,7 @@
13452
13457
  // range = Math.min(w, h) + 1e-8,
13453
13458
  range = Math.max(w, h) + 1e-8,
13454
13459
  digits = 0;
13455
- while (range < 2000) {
13460
+ while (range < 2000 && digits < 1) {
13456
13461
  range *= 10;
13457
13462
  digits++;
13458
13463
  }
@@ -19959,8 +19964,8 @@
19959
19964
  }
19960
19965
 
19961
19966
  function parseScalebarUnits(str) {
19962
- var isMiles = /miles?$/.test(str.toLowerCase());
19963
- var isKm = /(k\.m\.|km|kilometers?|kilometres?)$/.test(str.toLowerCase());
19967
+ var isMiles = /(miles?|mi[.]?|英里)$/.test(str.toLowerCase());
19968
+ var isKm = /(k\.m\.|km|kilometers?|kilom.tres?|公里)$/.test(str.toLowerCase());
19964
19969
  var units = isMiles && 'mile' || isKm && 'km' || '';
19965
19970
  return units;
19966
19971
  }
@@ -29355,7 +29360,7 @@ ${svg}
29355
29360
  // * In TopoJSON input, it makes sense to think of the last object/layer
29356
29361
  // as the topmost one -- it corresponds to the painter's algorithm and
29357
29362
  // the way that objects are ordered in SVG.
29358
- var lyr = targ.layers[targ.layers.length - 1];
29363
+ var lyr = targ?.layers[targ.layers.length - 1];
29359
29364
  return targ ? {layer: lyr, dataset: targ.dataset} : null;
29360
29365
  };
29361
29366
 
@@ -45139,7 +45144,7 @@ ${svg}
45139
45144
  opts.target, getFormattedLayerList(job.catalog)));
45140
45145
  }
45141
45146
  if (!commandAcceptsEmptyTarget(name)) {
45142
- throw new UserError("No data is available");
45147
+ stop("No data is available");
45143
45148
  }
45144
45149
  }
45145
45150
 
@@ -45525,7 +45530,7 @@ ${svg}
45525
45530
  });
45526
45531
  }
45527
45532
 
45528
- var version = "0.6.75";
45533
+ var version = "0.6.77";
45529
45534
 
45530
45535
  // Parse command line args into commands and run them
45531
45536
  // 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.6.75",
3
+ "version": "0.6.77",
4
4
  "description": "A tool for editing vector datasets for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
package/www/index.html CHANGED
@@ -39,7 +39,7 @@
39
39
  <svg id="pointer-icon" version="1.1" xmlns="http://www.w3.org/2000/svg" width="15" height="22" viewBox="0 0 15 20"><rect x="7.4126" y="11.0354" width="3.9102" height="7.9841" transform="translate(-5.8889 6.0377) rotate(-27.5536)" fill="#30d4ef"/><polygon points="2.57 2.086 2.718 16.056 13.944 10.198 2.57 2.086" fill="#30d4ef"/></svg>
40
40
 
41
41
  <!-- adjusted height -->
42
- <svg id="ribbon-icon" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="15" height="26" viewBox="0 0 15 20">
42
+ <svg id="ribbon-icon" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="15" height="25" viewBox="0 1 15 20">
43
43
  <polygon points="8 14.5 13 19 13 4 3 4 3 19 8 14.5" fill="#30d4ef"/>
44
44
  </svg>
45
45
 
@@ -76,7 +76,7 @@
76
76
  <input type="text" value="label" class="clicktext" />
77
77
  </div></div>
78
78
  <div id="mode-buttons" class="page-header-buttons">
79
- <span class="basemap-btn header-btn btn">Basemap</span><span class="separator"></span><span class="simplify-btn header-btn btn">Simplify</span><span class="separator"></span><span class="console-btn header-btn btn">Console</span><span class="separator"></span><span class="export-btn header-btn btn">Export</span>
79
+ <span class="console-btn header-btn btn">Console</span><span class="basemap-btn header-btn btn">Basemap</span><span class="separator"></span><span class="separator"></span><span class="simplify-btn header-btn btn">Simplify</span><span class="separator"></span><span class="export-btn header-btn btn">Export</span>
80
80
  </div>
81
81
  <div id="splash-buttons" class="page-header-buttons">
82
82
  <a href="https://github.com/mbloch/mapshaper/wiki"><span id="wiki-btn" class="header-btn btn">Wiki</span></a><span class="separator"></span><a href="https://github.com/mbloch/mapshaper"><span id="github-btn" class="header-btn btn">GitHub</span></a>
@@ -98,11 +98,14 @@
98
98
  <div class="pin-all pinnable">
99
99
  <img class="eye-btn black-eye" src="images/eye.png">
100
100
  <img class="eye-btn green-eye" src="images/eye2.png">
101
- </div>
101
+ </div>
102
102
  <div class="layer-list"></div>
103
103
  <!-- <h4>Sources</h4> -->
104
- <h4>Source files</h4>
105
- <div class="file-list"></div>
104
+ <div class="no-layer-note">No data has been added</div>
105
+ <div class="source-file-section">
106
+ <h4>Source files</h4>
107
+ <div class="file-list"></div>
108
+ </div>
106
109
  <div>
107
110
  <div id="add-file-btn" class="dialog-btn btn">Add files</div>
108
111
  <div id="add-empty-btn" class="dialog-btn btn">Add empty layer</div>
@@ -112,34 +115,30 @@
112
115
  </div>
113
116
  </div>
114
117
 
115
- <div class="box-tool-options main-area popup-dialog">
116
- <div class="info-box controls">
117
- <div>
118
- <div class="select-btn btn dialog-btn">Select</div>
119
- <div class="clip-btn btn dialog-btn">Clip</div>
120
- <div class="erase-btn btn dialog-btn">Erase</div>
121
- <div class="rect-btn btn dialog-btn">Rectangle</div>
122
- <div class="frame-btn btn dialog-btn">Frame</div>
123
- <div class="info-btn btn dialog-btn">Coords</div>
124
- <!-- <div class="zoom-btn btn dialog-btn">Zoom In</div> -->
125
- <div class="cancel-btn btn dialog-btn">Cancel</div>
126
- </div>
118
+
119
+ <div class="box-tool-options sidebar-buttons">
120
+ <div>
121
+ <div class="select-btn btn sidebar-btn">Select</div>
122
+ <div class="clip-btn btn sidebar-btn">Clip</div>
123
+ <div class="erase-btn btn sidebar-btn">Erase</div>
124
+ <div class="rect-btn btn sidebar-btn">Rectangle</div>
125
+ <div class="frame-btn btn sidebar-btn">Frame</div>
126
+ <div class="info-btn btn sidebar-btn">Coords</div>
127
127
  <div class="box-coords selectable"></div>
128
+ <div class="cancel-btn btn sidebar-btn">Cancel</div>
128
129
  </div>
129
130
  </div>
130
131
 
131
- <div class="selection-tool-options main-area popup-dialog">
132
- <div class="info-box">
133
- <div>
134
- <div class="delete-btn btn dialog-btn">Delete</div>
135
- <div class="filter-btn btn dialog-btn">Keep</div>
136
- <div class="duplicate-btn btn dialog-btn">Duplicate</div>
137
- <div class="split-btn btn dialog-btn">Split</div>
138
- <div class="coords-btn btn dialog-btn toggle-btn">Coords</div>
139
- <div class="data-btn btn dialog-btn toggle-btn">Edit data</div>
140
- <div class="cancel-btn btn dialog-btn">Clear</div>
141
- </div>
132
+ <div class="selection-tool-options sidebar-buttons">
133
+ <div>
134
+ <div class="delete-btn btn sidebar-btn">Delete</div>
135
+ <div class="filter-btn btn sidebar-btn">Keep</div>
136
+ <div class="duplicate-btn btn sidebar-btn">Duplicate</div>
137
+ <div class="split-btn btn sidebar-btn">Split</div>
138
+ <div class="coords-btn btn sidebar-btn toggle-btn">Coords</div>
142
139
  <div class="box-coords selectable"></div>
140
+ <div class="data-btn btn sidebar-btn toggle-btn">Edit data</div>
141
+ <div class="cancel-btn btn sidebar-btn">Clear</div>
143
142
  </div>
144
143
  </div>
145
144
 
@@ -147,14 +146,13 @@
147
146
  <div class="info-box">
148
147
  <div class="close2-btn"></div>
149
148
  <h3>Export options</h3>
150
- <div style="height:3px"></div>
151
149
  <div class=export-layers>
152
150
  <h4 class="menu-title">Layers</h4>
153
151
  <div class="export-layer-list option-menu"></div>
154
152
  </div>
155
153
  <div class="export-zip-option option-menu">
156
154
 
157
- <div style="height:10px"></div>
155
+ <div style="height:6px"></div>
158
156
 
159
157
  </div>
160
158
  <h4>File format</h4>
@@ -170,7 +168,6 @@
170
168
  the -o command. Examples: bbox no-quantization
171
169
  precision=0.001. Click to see all options.</div></div></div></a>
172
170
 
173
-
174
171
  <!-- <div class="option-menu">
175
172
  <input id="ofile-name" class="text-input" type="text" placeholder="output file name" />
176
173
  </div> -->
@@ -250,63 +247,49 @@ a smoother appearance.</div></div></div></div>
250
247
  </div> <!-- .info-box -->
251
248
  </div> <!-- simplify-options -->
252
249
 
253
- <div id="splash-screen" class="main-area">
254
- <div>
255
- <h3 id="splash-screen-blurb">Mapshaper is an editor for map data</h3>
256
- </div>
257
- <div id="drop-areas" class="drop-area-wrapper main-area">
258
-
259
- <div class="file-catalog catalog-area">
260
- </div>
261
- <div class="file-catalog-spacer spacer"></div>
262
-
263
- <div id="import-drop" class="drop-area">
264
- <h4>Drop or paste files here or <span class="inline-btn btn" id="file-selection-btn"><span class="label-text">select</span></span> from a folder</h4>
265
- <div class="subtitle">Shapefile, GeoJSON, TopoJSON, KML and CSV files are supported</div>
266
- <div class="subtitle">Files can be gzipped or in a zip archive</div>
267
- </div>
268
- <div class="spacer"></div>
269
- <div id="import-quick-drop" class="drop-area">
270
- <h4>Quick import</h4>
271
- <div class="subtitle">Drop or paste files here to import with default settings</div>
272
- </div>
273
- </div>
274
- </div>
275
-
276
250
  <div id="import-options" class="main-area popup-dialog">
277
251
  <div class="info-box">
278
- <h3 class="list-header">Files</h3>
279
-
280
- <div class="dropped-file-list"></div>
281
-
282
- <div class="option-menu">
283
-
284
- <div id="path-import-options">
285
- <h4>Options</h4>
252
+ <div class="cancel-btn close2-btn"></div>
253
+ <h3 class="list-header">Import files</h3>
254
+ <div class="import-instructions">
255
+ <span><input type="checkbox" class="advanced-import-options" />with advanced options</span>
256
+ <div class="mini-drop-area">
257
+ <div class="subtitle">Drop, paste or <span class="add-btn inline-btn btn"><span class="label-text">select</span></span> files to import.</div>
258
+ <div class="subtitle">Shapefile, GeoJSON, TopoJSON, KML and CSV formats are supported. Files can be zipped or gzipped.</div>
259
+ </div>
286
260
  </div>
261
+ <div class="queued-file-section">
262
+ <!-- <h4>Files</h4> -->
263
+ <div class="dropped-file-list"></div>
264
+
265
+ <div class="option-menu">
287
266
 
288
- <div><input type="text" class="text-input advanced-options" placeholder="command line import options" />
289
- <a href="https://github.com/mbloch/mapshaper/wiki/Command-Reference#-i-input" target="_mapshaper_import_docs">
290
- <div class="tip-button">?<div class="tip-anchor">
291
- <div class="tip">Enter options from the command line
267
+ <div id="path-import-options">
268
+ <!-- <h4>Options</h4> -->
269
+ </div>
270
+
271
+ <div style="margin-top: 10px"><input type="text" class="text-input advanced-options" placeholder="import options" />
272
+ <a href="https://github.com/mbloch/mapshaper/wiki/Command-Reference#-i-input" target="_mapshaper_import_docs">
273
+ <div class="tip-button">?<div class="tip-anchor">
274
+ <div class="tip">Enter options from the command line
292
275
  interface. Examples: <span id="import-option-examples">snap no-topology
293
276
  encoding=big5</span>. Click to see all options.</div></div></div></div>
294
- </a>
277
+ </a>
295
278
 
296
- </div>
279
+ </div>
280
+
281
+ <!-- <div class="cancel-btn btn dialog-btn">Cancel</div>
282
+ <div class="add-btn btn dialog-btn">Select</div> -->
283
+ <div class="submit-btn btn dialog-btn default-btn disabled">Submit</div>
297
284
 
298
- <div id="import-buttons">
299
- <div class="cancel-btn btn dialog-btn">Cancel</div>
300
- <div class="add-btn btn dialog-btn">Select</div>
301
- <div class="submit-btn btn dialog-btn default-btn">Import</div>
302
285
  </div>
303
286
 
304
287
  </div> <!-- .info-box -->
305
288
  </div> <!-- import-options -->
306
289
 
307
-
308
290
  <!-- TODO: remove #mshp-main-page without causing the map to jitter when resized -->
309
291
  <div id="mshp-main-page">
292
+
310
293
  <div class="console main-area console-area">
311
294
  <div class="console-window"><div class="console-buffer selectable"></div></div>
312
295
  </div>