mapshaper 0.6.76 → 0.6.78
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 +30 -20
- package/package.json +1 -1
- package/www/index.html +35 -48
- package/www/mapshaper-gui.js +1208 -1043
- package/www/mapshaper.js +30 -20
- package/www/page.css +64 -110
package/www/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
|
|
|
@@ -4279,6 +4278,10 @@
|
|
|
4279
4278
|
return data;
|
|
4280
4279
|
}
|
|
4281
4280
|
|
|
4281
|
+
function layerHasAttributeData(lyr) {
|
|
4282
|
+
return lyr.data && lyr.data.getFields().length > 0;
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4282
4285
|
function layerHasNonNullData(lyr) {
|
|
4283
4286
|
return lyr.data && getFirstNonEmptyRecord(lyr.data.getRecords()) ? true : false;
|
|
4284
4287
|
}
|
|
@@ -4552,6 +4555,7 @@
|
|
|
4552
4555
|
__proto__: null,
|
|
4553
4556
|
insertFieldValues: insertFieldValues,
|
|
4554
4557
|
getLayerDataTable: getLayerDataTable,
|
|
4558
|
+
layerHasAttributeData: layerHasAttributeData,
|
|
4555
4559
|
layerHasNonNullData: layerHasNonNullData,
|
|
4556
4560
|
layerHasGeometry: layerHasGeometry,
|
|
4557
4561
|
layerIsGeometric: layerIsGeometric,
|
|
@@ -5123,10 +5127,12 @@
|
|
|
5123
5127
|
if (!P && info.prj) {
|
|
5124
5128
|
P = parseCrsString(translatePrj(info.prj));
|
|
5125
5129
|
}
|
|
5126
|
-
if (!P
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
+
if (!P) {
|
|
5131
|
+
if (probablyDecimalDegreeBounds(getDatasetBounds(dataset))) {
|
|
5132
|
+
// use wgs84 for probable latlong datasets with unknown datums
|
|
5133
|
+
str = 'wgs84';
|
|
5134
|
+
P = parseCrsString(str);
|
|
5135
|
+
}
|
|
5130
5136
|
}
|
|
5131
5137
|
return {
|
|
5132
5138
|
crs: P || null,
|
|
@@ -7202,6 +7208,12 @@
|
|
|
7202
7208
|
return bounds;
|
|
7203
7209
|
}
|
|
7204
7210
|
|
|
7211
|
+
function datasetIsEmpty(dataset) {
|
|
7212
|
+
return dataset.layers.every(function(lyr) {
|
|
7213
|
+
return layerIsEmpty(lyr);
|
|
7214
|
+
});
|
|
7215
|
+
}
|
|
7216
|
+
|
|
7205
7217
|
function datasetHasGeometry(dataset) {
|
|
7206
7218
|
return utils.some(dataset.layers, function(lyr) {
|
|
7207
7219
|
return layerHasGeometry(lyr);
|
|
@@ -7315,6 +7327,7 @@
|
|
|
7315
7327
|
copyDatasetForExport: copyDatasetForExport,
|
|
7316
7328
|
copyDatasetForRenaming: copyDatasetForRenaming,
|
|
7317
7329
|
getDatasetBounds: getDatasetBounds,
|
|
7330
|
+
datasetIsEmpty: datasetIsEmpty,
|
|
7318
7331
|
datasetHasGeometry: datasetHasGeometry,
|
|
7319
7332
|
datasetHasPaths: datasetHasPaths,
|
|
7320
7333
|
cleanupArcs: cleanupArcs,
|
|
@@ -13449,7 +13462,7 @@
|
|
|
13449
13462
|
// range = Math.min(w, h) + 1e-8,
|
|
13450
13463
|
range = Math.max(w, h) + 1e-8,
|
|
13451
13464
|
digits = 0;
|
|
13452
|
-
while (range < 2000) {
|
|
13465
|
+
while (range < 2000 && digits < 1) {
|
|
13453
13466
|
range *= 10;
|
|
13454
13467
|
digits++;
|
|
13455
13468
|
}
|
|
@@ -18017,11 +18030,10 @@
|
|
|
18017
18030
|
opts = utils.extend({}, opts);
|
|
18018
18031
|
opts.rfc7946 = !opts.gj2008; // use RFC 7946 as the default
|
|
18019
18032
|
var extension = opts.extension || "json";
|
|
18020
|
-
var layerGroups
|
|
18033
|
+
var layerGroups;
|
|
18021
18034
|
|
|
18022
18035
|
if (opts.rfc7946) {
|
|
18023
|
-
|
|
18024
|
-
if (warn) message(warn);
|
|
18036
|
+
warnIfNotWgs84(dataset);
|
|
18025
18037
|
}
|
|
18026
18038
|
|
|
18027
18039
|
if (opts.file) {
|
|
@@ -18112,14 +18124,12 @@
|
|
|
18112
18124
|
return feat;
|
|
18113
18125
|
}
|
|
18114
18126
|
|
|
18115
|
-
function
|
|
18127
|
+
function warnIfNotWgs84(dataset) {
|
|
18116
18128
|
var P = getDatasetCRS(dataset);
|
|
18117
|
-
|
|
18118
|
-
|
|
18119
|
-
|
|
18120
|
-
|
|
18121
|
-
}
|
|
18122
|
-
return str;
|
|
18129
|
+
if (P && isLatLngCRS(P) || datasetIsEmpty(dataset)) return;
|
|
18130
|
+
var str = 'RFC 7946 warning: non-WGS84 GeoJSON output.';
|
|
18131
|
+
if (P) str += ' Tip: use "-proj wgs84" to convert.';
|
|
18132
|
+
message(str);
|
|
18123
18133
|
}
|
|
18124
18134
|
|
|
18125
18135
|
function getDatasetBbox(dataset, rfc7946) {
|
|
@@ -18389,7 +18399,7 @@
|
|
|
18389
18399
|
'default': GeoJSON,
|
|
18390
18400
|
exportGeoJSON: exportGeoJSON,
|
|
18391
18401
|
exportLayerAsGeoJSON: exportLayerAsGeoJSON,
|
|
18392
|
-
|
|
18402
|
+
warnIfNotWgs84: warnIfNotWgs84,
|
|
18393
18403
|
getDatasetBbox: getDatasetBbox,
|
|
18394
18404
|
exportDatasetAsGeoJSON: exportDatasetAsGeoJSON,
|
|
18395
18405
|
preserveOriginalCRS: preserveOriginalCRS,
|
|
@@ -29352,7 +29362,7 @@ ${svg}
|
|
|
29352
29362
|
// * In TopoJSON input, it makes sense to think of the last object/layer
|
|
29353
29363
|
// as the topmost one -- it corresponds to the painter's algorithm and
|
|
29354
29364
|
// the way that objects are ordered in SVG.
|
|
29355
|
-
var lyr = targ
|
|
29365
|
+
var lyr = targ?.layers[targ.layers.length - 1];
|
|
29356
29366
|
return targ ? {layer: lyr, dataset: targ.dataset} : null;
|
|
29357
29367
|
};
|
|
29358
29368
|
|
|
@@ -45136,7 +45146,7 @@ ${svg}
|
|
|
45136
45146
|
opts.target, getFormattedLayerList(job.catalog)));
|
|
45137
45147
|
}
|
|
45138
45148
|
if (!commandAcceptsEmptyTarget(name)) {
|
|
45139
|
-
|
|
45149
|
+
stop("No data is available");
|
|
45140
45150
|
}
|
|
45141
45151
|
}
|
|
45142
45152
|
|
|
@@ -45522,7 +45532,7 @@ ${svg}
|
|
|
45522
45532
|
});
|
|
45523
45533
|
}
|
|
45524
45534
|
|
|
45525
|
-
var version = "0.6.
|
|
45535
|
+
var version = "0.6.78";
|
|
45526
45536
|
|
|
45527
45537
|
// Parse command line args into commands and run them
|
|
45528
45538
|
// Function takes an optional Node-style callback. A Promise is returned if no callback is given.
|
package/www/page.css
CHANGED
|
@@ -31,7 +31,7 @@ html, body {
|
|
|
31
31
|
|
|
32
32
|
body {
|
|
33
33
|
overflow: hidden;
|
|
34
|
-
background-color: #
|
|
34
|
+
background-color: #f8fdff;
|
|
35
35
|
font: 14px/1.4 'Source Sans Pro', Arial, sans-serif;
|
|
36
36
|
color: #444;
|
|
37
37
|
user-select: none;
|
|
@@ -40,6 +40,10 @@ body {
|
|
|
40
40
|
cursor: default;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
body.map-view {
|
|
44
|
+
background-color: #fff;
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
.fade-out {
|
|
44
48
|
animation: fadeOut ease forwards 0.6s;
|
|
45
49
|
}
|
|
@@ -56,8 +60,6 @@ body {
|
|
|
56
60
|
|
|
57
61
|
.selectable,.selectable * {
|
|
58
62
|
user-select: default;
|
|
59
|
-
-webkit-user-select: text;
|
|
60
|
-
-moz-user-select: text;
|
|
61
63
|
cursor: text;
|
|
62
64
|
}
|
|
63
65
|
|
|
@@ -178,12 +180,16 @@ body {
|
|
|
178
180
|
text-decoration: none;
|
|
179
181
|
}
|
|
180
182
|
|
|
183
|
+
#mode-buttons.page-header-buttons {
|
|
184
|
+
display: none;
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
181
188
|
.page-header-buttons {
|
|
182
189
|
z-index: 20;
|
|
183
190
|
position: absolute;
|
|
184
191
|
top: 0px;
|
|
185
192
|
right: 0px;
|
|
186
|
-
display: none;
|
|
187
193
|
margin: 0 6px 3px 0;
|
|
188
194
|
}
|
|
189
195
|
|
|
@@ -202,6 +208,7 @@ body {
|
|
|
202
208
|
.page-header .header-btn.disabled,
|
|
203
209
|
.page-header .header-btn.disabled:hover {
|
|
204
210
|
background-color: transparent;
|
|
211
|
+
opacity: 0.5;
|
|
205
212
|
}
|
|
206
213
|
|
|
207
214
|
.page-header .btn.header-btn.active,
|
|
@@ -331,105 +338,28 @@ div.alert-box {
|
|
|
331
338
|
|
|
332
339
|
/* --- Splash screen -------------- */
|
|
333
340
|
|
|
334
|
-
.
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
.splash-screen #splash-buttons {
|
|
339
|
-
display: block;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
.queued-files.splash-screen #import-options-drop-area {
|
|
343
|
-
display: block;
|
|
344
|
-
z-index: 2;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
#import-options-drop-area .drop-area {
|
|
348
|
-
height: 100%;
|
|
341
|
+
.import-instructions {
|
|
342
|
+
margin: 7px 0 0 0;
|
|
349
343
|
}
|
|
350
344
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
345
|
+
.mini-drop-area {
|
|
346
|
+
border: 1.5px dashed #bbb;
|
|
347
|
+
max-width: 240px;
|
|
348
|
+
border-radius: 9px;
|
|
354
349
|
font-size: 15px;
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
#splash-screen .subtitle {
|
|
363
|
-
color: #777;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
.splash-screen #import-options .info-box {
|
|
367
|
-
margin-top: 40px;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
.queued-files #import-options {
|
|
371
|
-
display: block;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
#splash-screen *,
|
|
375
|
-
#import-options-drop-area * {
|
|
376
|
-
box-sizing: border-box;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
.drop-area {
|
|
380
|
-
border: 2px dashed #a2a2a2;
|
|
381
|
-
border-radius: 19px;
|
|
382
|
-
background-color: #f8fdff;
|
|
383
|
-
overflow: hidden;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
#splash-screen .drop-area.dragover,
|
|
387
|
-
body.dragover #import-options-drop-area .drop-area {
|
|
388
|
-
border-color: #333;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
#drop-areas {
|
|
392
|
-
margin-top: 30px;
|
|
350
|
+
line-height: 1.5;
|
|
351
|
+
color: #888;
|
|
352
|
+
/* background-color: #FFFEF8;*/
|
|
353
|
+
padding: 6px 4px 7px 7px;
|
|
354
|
+
padding: 11px 14px;
|
|
355
|
+
margin: 9px -1px 3px -1px;
|
|
356
|
+
min-height: 120px;
|
|
393
357
|
}
|
|
394
358
|
|
|
395
|
-
.drop-area-wrapper {
|
|
396
|
-
padding: 16px 16px 15px 16px;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
.catalog-mode #import-drop,
|
|
400
|
-
.catalog-mode #import-quick-drop,
|
|
401
359
|
.catalog-mode .file-catalog {
|
|
402
360
|
height: 32%;
|
|
403
361
|
}
|
|
404
362
|
|
|
405
|
-
#import-drop {
|
|
406
|
-
height: 61.6%;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
#import-quick-drop {
|
|
410
|
-
height: 37%;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.queued-files #splash-screen {
|
|
414
|
-
display: none;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
/* between the two drop areas */
|
|
418
|
-
#splash-screen .spacer {
|
|
419
|
-
height: 1.6%;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
#splash-screen h3 {
|
|
423
|
-
margin: 11px 0 0 0;
|
|
424
|
-
color: #333;
|
|
425
|
-
font-size: 18px;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
#splash-screen h4 {
|
|
429
|
-
color: #333;
|
|
430
|
-
font-size: 17px;
|
|
431
|
-
margin: 11px 0 0 0;
|
|
432
|
-
}
|
|
433
363
|
|
|
434
364
|
#file-selection-btn.inline-btn {
|
|
435
365
|
padding: 2px 4px 3px 3px;
|
|
@@ -509,7 +439,7 @@ body.dragover #import-options-drop-area .drop-area {
|
|
|
509
439
|
}
|
|
510
440
|
|
|
511
441
|
.dropped-file-list {
|
|
512
|
-
margin-bottom:
|
|
442
|
+
margin-bottom: 4px;
|
|
513
443
|
max-height: 300px;
|
|
514
444
|
overflow-y: auto;
|
|
515
445
|
}
|
|
@@ -532,6 +462,19 @@ body.dragover #import-options-drop-area .drop-area {
|
|
|
532
462
|
margin-right: 16px;
|
|
533
463
|
}
|
|
534
464
|
|
|
465
|
+
#import-options .queued-file-section {
|
|
466
|
+
display: none;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.queued-files #import-options .queued-file-section {
|
|
470
|
+
margin-top: 10px;
|
|
471
|
+
display: block;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.queued-files #import-options .import-instructions {
|
|
475
|
+
display: none;
|
|
476
|
+
}
|
|
477
|
+
|
|
535
478
|
|
|
536
479
|
#import-options .dropped-file-list p {
|
|
537
480
|
line-height: 1;
|
|
@@ -546,12 +489,22 @@ body.dragover #import-options-drop-area .drop-area {
|
|
|
546
489
|
text-align: center;
|
|
547
490
|
}
|
|
548
491
|
|
|
549
|
-
.info-box,.popup
|
|
492
|
+
.info-box,.popup {
|
|
550
493
|
border-radius: 9px;
|
|
551
|
-
border: 1px solid #
|
|
552
|
-
box-shadow: 0
|
|
553
|
-
|
|
494
|
+
border: 1px solid #d5d5d5;
|
|
495
|
+
box-shadow: 0 1px 7px rgba(0,0,0,0.18);
|
|
496
|
+
background-color: #fff;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.contextmenu {
|
|
500
|
+
position: absolute;
|
|
501
|
+
border-radius: 6px;
|
|
502
|
+
border: 1px solid #d5d5d5;
|
|
503
|
+
box-shadow: 0 1px 7px rgba(0,0,0,0.18);
|
|
554
504
|
background-color: #fff;
|
|
505
|
+
font-size: 13px;
|
|
506
|
+
z-index: 40;
|
|
507
|
+
padding: 4px 0;
|
|
555
508
|
}
|
|
556
509
|
|
|
557
510
|
.contextmenu-item {
|
|
@@ -571,6 +524,10 @@ body.dragover #import-options-drop-area .drop-area {
|
|
|
571
524
|
/* border: 1px solid #aaa; */
|
|
572
525
|
}
|
|
573
526
|
|
|
527
|
+
.info-box label {
|
|
528
|
+
cursor: pointer;
|
|
529
|
+
}
|
|
530
|
+
|
|
574
531
|
.sidebar-buttons {
|
|
575
532
|
display: none;
|
|
576
533
|
position: absolute;
|
|
@@ -605,7 +562,7 @@ body.dragover #import-options-drop-area .drop-area {
|
|
|
605
562
|
.info-box h4 {
|
|
606
563
|
font-size: 1.085em;
|
|
607
564
|
font-weight: normal;
|
|
608
|
-
margin:
|
|
565
|
+
margin: 4px 0 2px 0;
|
|
609
566
|
}
|
|
610
567
|
|
|
611
568
|
.info-box p {
|
|
@@ -827,6 +784,11 @@ body.simplify .layer-control-btn {
|
|
|
827
784
|
z-index: 90;
|
|
828
785
|
}
|
|
829
786
|
|
|
787
|
+
.layer-control .no-layer-note {
|
|
788
|
+
color: #777;
|
|
789
|
+
margin: 4px 0 6px 0;
|
|
790
|
+
}
|
|
791
|
+
|
|
830
792
|
.layer-menu .layer-list {
|
|
831
793
|
margin: 6px 0 7px 0;
|
|
832
794
|
}
|
|
@@ -868,7 +830,7 @@ img.close-btn {
|
|
|
868
830
|
|
|
869
831
|
.close2-btn {
|
|
870
832
|
display: inline-block;
|
|
871
|
-
background-color: #
|
|
833
|
+
background-color: #e5e5e5;
|
|
872
834
|
background-image: url("images/close2.png");
|
|
873
835
|
background-size: cover;
|
|
874
836
|
float: right;
|
|
@@ -1044,13 +1006,6 @@ img.close-btn:hover,
|
|
|
1044
1006
|
}*/
|
|
1045
1007
|
|
|
1046
1008
|
|
|
1047
|
-
.contextmenu {
|
|
1048
|
-
font-size: 13px;
|
|
1049
|
-
position: absolute;
|
|
1050
|
-
z-index: 40;
|
|
1051
|
-
padding: 5px 0;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
1009
|
/* --- Popup -------------------- */
|
|
1055
1010
|
|
|
1056
1011
|
.popup {
|
|
@@ -1354,7 +1309,6 @@ div.basemap-style-btn.active img {
|
|
|
1354
1309
|
white-space: nowrap;
|
|
1355
1310
|
border-radius: 6px;
|
|
1356
1311
|
border: 1px solid #ddd;
|
|
1357
|
-
box-shadow: 0 2px 5px rgba(0,0,0,0.35);
|
|
1358
1312
|
box-shadow: 0 1px 7px rgba(0,0,0,0.12);
|
|
1359
1313
|
}
|
|
1360
1314
|
|
|
@@ -1397,7 +1351,7 @@ div.basemap-style-btn.active img {
|
|
|
1397
1351
|
.contextmenu-item {
|
|
1398
1352
|
background-color: #fff;
|
|
1399
1353
|
white-space: nowrap;
|
|
1400
|
-
padding: 6px
|
|
1354
|
+
padding: 6px 10px 7px 10px;
|
|
1401
1355
|
line-height: 11px;
|
|
1402
1356
|
cursor: pointer;
|
|
1403
1357
|
}
|