mapshaper 0.5.98 → 0.5.99
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/CHANGELOG.md +3 -0
- package/mapshaper.js +46 -10
- package/package.json +2 -1
- package/www/images/thumb-map.jpg +0 -0
- package/www/images/thumb-satellite.jpg +0 -0
- package/www/index.html +15 -1
- package/www/mapshaper-gui.js +707 -388
- package/www/mapshaper.js +46 -10
- package/www/page.css +89 -4
package/www/mapshaper.js
CHANGED
|
@@ -1771,6 +1771,8 @@
|
|
|
1771
1771
|
// avoid re-allocating memory
|
|
1772
1772
|
var xx2 = new Float64Array(data.xx.buffer, 0, n-1);
|
|
1773
1773
|
var yy2 = new Float64Array(data.yy.buffer, 0, n-1);
|
|
1774
|
+
var zz2 = arcs.isFlat() ? null : new Float64Array(data.zz.buffer, 0, n-1);
|
|
1775
|
+
var z = arcs.getRetainedInterval();
|
|
1774
1776
|
var count = 0;
|
|
1775
1777
|
var found = false;
|
|
1776
1778
|
for (var j=0; j<nn.length; j++) {
|
|
@@ -1784,24 +1786,31 @@
|
|
|
1784
1786
|
utils.copyElements(data.yy, 0, yy2, 0, i);
|
|
1785
1787
|
utils.copyElements(data.xx, i+1, xx2, i, n-i-1);
|
|
1786
1788
|
utils.copyElements(data.yy, i+1, yy2, i, n-i-1);
|
|
1787
|
-
|
|
1789
|
+
if (zz2) {
|
|
1790
|
+
utils.copyElements(data.zz, 0, zz2, 0, i);
|
|
1791
|
+
utils.copyElements(data.zz, i+1, zz2, i, n-i-1);
|
|
1792
|
+
}
|
|
1793
|
+
arcs.updateVertexData(nn, xx2, yy2, zz2);
|
|
1794
|
+
arcs.setRetainedInterval(z);
|
|
1788
1795
|
}
|
|
1789
1796
|
|
|
1790
1797
|
function insertVertex(arcs, i, p) {
|
|
1791
|
-
// TODO: add extra bytes to the buffers, to reduce new memory allocation
|
|
1792
1798
|
var data = arcs.getVertexData();
|
|
1793
1799
|
var nn = data.nn;
|
|
1794
1800
|
var n = data.xx.length;
|
|
1795
1801
|
var count = 0;
|
|
1796
1802
|
var found = false;
|
|
1797
|
-
var xx2, yy2;
|
|
1803
|
+
var xx2, yy2, zz2;
|
|
1798
1804
|
// avoid re-allocating memory on each insertion
|
|
1799
1805
|
if (data.xx.buffer.byteLength >= data.xx.length * 8 + 8) {
|
|
1800
1806
|
xx2 = new Float64Array(data.xx.buffer, 0, n+1);
|
|
1801
1807
|
yy2 = new Float64Array(data.yy.buffer, 0, n+1);
|
|
1802
1808
|
} else {
|
|
1803
|
-
xx2 = new Float64Array(new ArrayBuffer((n +
|
|
1804
|
-
yy2 = new Float64Array(new ArrayBuffer((n +
|
|
1809
|
+
xx2 = new Float64Array(new ArrayBuffer((n + 50) * 8), 0, n+1);
|
|
1810
|
+
yy2 = new Float64Array(new ArrayBuffer((n + 50) * 8), 0, n+1);
|
|
1811
|
+
}
|
|
1812
|
+
if (!arcs.isFlat()) {
|
|
1813
|
+
zz2 = new Float64Array(new ArrayBuffer((n + 1) * 8), 0, n+1);
|
|
1805
1814
|
}
|
|
1806
1815
|
for (var j=0; j<nn.length; j++) {
|
|
1807
1816
|
count += nn[j];
|
|
@@ -1816,7 +1825,12 @@
|
|
|
1816
1825
|
utils.copyElements(data.yy, i, yy2, i+1, n-i);
|
|
1817
1826
|
xx2[i] = p[0];
|
|
1818
1827
|
yy2[i] = p[1];
|
|
1819
|
-
|
|
1828
|
+
if (zz2) {
|
|
1829
|
+
zz2[i] = Infinity;
|
|
1830
|
+
utils.copyElements(data.zz, 0, zz2, 0, i);
|
|
1831
|
+
utils.copyElements(data.zz, i, zz2, i+1, n-i);
|
|
1832
|
+
}
|
|
1833
|
+
arcs.updateVertexData(nn, xx2, yy2, zz2);
|
|
1820
1834
|
}
|
|
1821
1835
|
|
|
1822
1836
|
var ArcUtils = /*#__PURE__*/Object.freeze({
|
|
@@ -4663,8 +4677,8 @@
|
|
|
4663
4677
|
if (isLatLngCRS(P)) {
|
|
4664
4678
|
return xy.concat();
|
|
4665
4679
|
}
|
|
4666
|
-
proj =
|
|
4667
|
-
return proj(xy);
|
|
4680
|
+
proj = getProjTransform(P, getCRS('wgs84'));
|
|
4681
|
+
return proj(xy[0], xy[1]);
|
|
4668
4682
|
}
|
|
4669
4683
|
|
|
4670
4684
|
function getProjInfo(dataset) {
|
|
@@ -4810,6 +4824,21 @@
|
|
|
4810
4824
|
return P && P.is_latlong || false;
|
|
4811
4825
|
}
|
|
4812
4826
|
|
|
4827
|
+
function isWGS84(P) {
|
|
4828
|
+
if (!isLatLngCRS(P)) return false;
|
|
4829
|
+
var proj4 = crsToProj4(P);
|
|
4830
|
+
return proj4.toLowerCase().includes('84');
|
|
4831
|
+
}
|
|
4832
|
+
|
|
4833
|
+
function isWebMercator(P) {
|
|
4834
|
+
if (!P) return false;
|
|
4835
|
+
var str = crsToProj4(P);
|
|
4836
|
+
// e.g. +proj=merc +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +wktext +a=6378137 +b=6378137 +nadgrids=@null
|
|
4837
|
+
// e.g. +proj=merc +a=6378137 +b=6378137
|
|
4838
|
+
// TODO: support https://proj.org/operations/projections/webmerc.html
|
|
4839
|
+
return str.includes('+proj=merc') && str.includes('+a=6378137') && str.includes('+b=6378137');
|
|
4840
|
+
}
|
|
4841
|
+
|
|
4813
4842
|
function isLatLngDataset(dataset) {
|
|
4814
4843
|
return isLatLngCRS(getDatasetCRS(dataset));
|
|
4815
4844
|
}
|
|
@@ -4864,6 +4893,8 @@
|
|
|
4864
4893
|
getScaleFactorAtXY: getScaleFactorAtXY,
|
|
4865
4894
|
isProjectedCRS: isProjectedCRS,
|
|
4866
4895
|
isLatLngCRS: isLatLngCRS,
|
|
4896
|
+
isWGS84: isWGS84,
|
|
4897
|
+
isWebMercator: isWebMercator,
|
|
4867
4898
|
isLatLngDataset: isLatLngDataset,
|
|
4868
4899
|
printProjections: printProjections,
|
|
4869
4900
|
translatePrj: translatePrj,
|
|
@@ -8357,8 +8388,8 @@
|
|
|
8357
8388
|
}
|
|
8358
8389
|
|
|
8359
8390
|
function getBoundsPrecisionForDisplay(bbox) {
|
|
8360
|
-
var w = bbox[2] - bbox[0],
|
|
8361
|
-
h = bbox[3] - bbox[1],
|
|
8391
|
+
var w = Math.abs(bbox[2] - bbox[0]),
|
|
8392
|
+
h = Math.abs(bbox[3] - bbox[1]),
|
|
8362
8393
|
range = Math.min(w, h) + 1e-8,
|
|
8363
8394
|
digits = 0;
|
|
8364
8395
|
while (range < 2000) {
|
|
@@ -29177,6 +29208,9 @@ ${svg}
|
|
|
29177
29208
|
} else if (dataType === null) {
|
|
29178
29209
|
// data field is empty
|
|
29179
29210
|
return null; // kludge
|
|
29211
|
+
} else if (dataType === undefined) {
|
|
29212
|
+
// no data field was given
|
|
29213
|
+
stop('Expected a data field to classify or the non-adjacent option');
|
|
29180
29214
|
} else {
|
|
29181
29215
|
stop('Unable to determine which classification method to use.');
|
|
29182
29216
|
}
|
|
@@ -34312,6 +34346,7 @@ ${svg}
|
|
|
34312
34346
|
// old simplification data will not be optimal after reprojection;
|
|
34313
34347
|
// re-using for now to avoid error in web ui
|
|
34314
34348
|
zz = data.zz,
|
|
34349
|
+
z = arcs.getRetainedInterval(),
|
|
34315
34350
|
p;
|
|
34316
34351
|
|
|
34317
34352
|
for (var i=0, n=xx.length; i<n; i++) {
|
|
@@ -34320,6 +34355,7 @@ ${svg}
|
|
|
34320
34355
|
yy[i] = p[1];
|
|
34321
34356
|
}
|
|
34322
34357
|
arcs.updateVertexData(data.nn, xx, yy, zz);
|
|
34358
|
+
arcs.setRetainedInterval(z);
|
|
34323
34359
|
}
|
|
34324
34360
|
|
|
34325
34361
|
function projectArcs2(arcs, proj) {
|
package/www/page.css
CHANGED
|
@@ -107,14 +107,19 @@ body {
|
|
|
107
107
|
height: 29px;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
.basemap-on .coordinate-info {
|
|
111
|
+
left: 100px;
|
|
112
|
+
}
|
|
113
|
+
|
|
110
114
|
.coordinate-info {
|
|
111
115
|
z-index: 1;
|
|
112
116
|
position: absolute;
|
|
113
|
-
bottom:
|
|
114
|
-
left:
|
|
117
|
+
bottom: 7px;
|
|
118
|
+
left: 7px;
|
|
115
119
|
padding: 2px 5px 2px 5px;
|
|
116
120
|
font-size: 11px;
|
|
117
121
|
pointer-events: none;
|
|
122
|
+
background: rgba(255,255,255,0.4);
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
.mapshaper-logo {
|
|
@@ -977,8 +982,88 @@ img.close-btn:hover,
|
|
|
977
982
|
height: 100%;
|
|
978
983
|
}
|
|
979
984
|
|
|
985
|
+
.basemap-options {
|
|
986
|
+
pointer-events: none;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
.basemap-options .info-box {
|
|
990
|
+
width: min-content;
|
|
991
|
+
pointer-events: initial;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
.basemap-container {
|
|
995
|
+
z-index: -1;
|
|
996
|
+
position: absolute;
|
|
997
|
+
top: 0;
|
|
998
|
+
left: 0;
|
|
999
|
+
right: 0;
|
|
1000
|
+
bottom: 0;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
.basemap {
|
|
1004
|
+
display: none;
|
|
1005
|
+
position: relative;
|
|
1006
|
+
height: 100%;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
.info-box p {
|
|
1010
|
+
line-height: 1.2;
|
|
1011
|
+
font-size: 90%;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
.basemap-styles {
|
|
1015
|
+
white-space: nowrap;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
.basemap-error {
|
|
1019
|
+
color: #cc0000;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
.basemap-note {
|
|
1023
|
+
width: 100%;
|
|
1024
|
+
text-align: center;
|
|
1025
|
+
z-index: -2;
|
|
1026
|
+
bottom: 8px;
|
|
1027
|
+
font-size: 22px;
|
|
1028
|
+
color: #aaa;
|
|
1029
|
+
position: absolute;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
.basemap-styles > div {
|
|
1033
|
+
display: inline-block;
|
|
1034
|
+
margin-bottom: 8px;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
.basemap-styles > div:nth-child(even) {
|
|
1038
|
+
position: relative;
|
|
1039
|
+
left: 6px;
|
|
1040
|
+
margin-left: 2px;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
.basemap-style-btn img {
|
|
1044
|
+
display: block;
|
|
1045
|
+
left: -3px;
|
|
1046
|
+
position: relative;
|
|
1047
|
+
border: 3px solid transparent;
|
|
1048
|
+
width: 120px;
|
|
1049
|
+
height: 90px;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
div.basemap-style-btn.active img {
|
|
1053
|
+
border: 3px solid #e8ba52;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
.basemap-style-btn:hover img {
|
|
1057
|
+
cursor: pointer;
|
|
1058
|
+
border: 3px solid #ead683;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
.mapbox-improve-map {
|
|
1062
|
+
display: none;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
980
1065
|
.mshp-main-map {
|
|
981
|
-
background-color: #fff;
|
|
1066
|
+
/* background-color: #fff; */
|
|
982
1067
|
}
|
|
983
1068
|
|
|
984
1069
|
.map-layers.symbol-hit {
|
|
@@ -1067,7 +1152,7 @@ img.close-btn:hover,
|
|
|
1067
1152
|
clear: right;
|
|
1068
1153
|
white-space: nowrap;
|
|
1069
1154
|
display: inline-block;
|
|
1070
|
-
padding:
|
|
1155
|
+
padding: 3px 7px 5px 7px;
|
|
1071
1156
|
line-height: 11px;
|
|
1072
1157
|
cursor: pointer;
|
|
1073
1158
|
}
|