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/CHANGELOG.md
CHANGED
package/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mapshaper",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.99",
|
|
4
4
|
"description": "A tool for editing vector datasets for mapping and GIS.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shapefile",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"files": [
|
|
36
36
|
"/bin/**",
|
|
37
37
|
"/www/**",
|
|
38
|
+
"!/www/basemap.js",
|
|
38
39
|
"!/www/nacis/",
|
|
39
40
|
"/mapshaper.js",
|
|
40
41
|
"!.DS_Store"
|
|
Binary file
|
|
Binary file
|
package/www/index.html
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<input type="text" value="label" class="clicktext" />
|
|
74
74
|
</div></div>
|
|
75
75
|
<div id="mode-buttons" class="page-header-buttons">
|
|
76
|
-
<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>
|
|
76
|
+
<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>
|
|
77
77
|
</div>
|
|
78
78
|
<div id="splash-buttons" class="page-header-buttons">
|
|
79
79
|
<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>
|
|
@@ -148,6 +148,18 @@
|
|
|
148
148
|
</div>
|
|
149
149
|
</div>
|
|
150
150
|
|
|
151
|
+
<div class="basemap-options main-area popup-dialog">
|
|
152
|
+
<div class="info-box">
|
|
153
|
+
<h3>Basemap options</h3>
|
|
154
|
+
<p>Basemaps are only displayed if the active layer has WGS84 or Web Mercator coordinates.</p>
|
|
155
|
+
<p class="basemap-error"></p>
|
|
156
|
+
<div class="basemap-styles"></div>
|
|
157
|
+
<div>
|
|
158
|
+
<div class="close-btn btn dialog-btn">Close</div>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
151
163
|
<div class="simplify-options main-area popup-dialog">
|
|
152
164
|
<div class="info-box">
|
|
153
165
|
<h3>Simplification menu</h3>
|
|
@@ -280,6 +292,7 @@ interface. Examples: "no-topology"
|
|
|
280
292
|
<div class="repair-btn text-btn colored-text">Repair</div>
|
|
281
293
|
</div>
|
|
282
294
|
<div class="map-layers"></div>
|
|
295
|
+
<div class="basemap-container"><div class="basemap"></div></div>
|
|
283
296
|
</div>
|
|
284
297
|
</div>
|
|
285
298
|
|
|
@@ -287,6 +300,7 @@ interface. Examples: "no-topology"
|
|
|
287
300
|
<div class="drop-area"></div>
|
|
288
301
|
</div>
|
|
289
302
|
|
|
303
|
+
<script src="basemap.js" type="text/javascript"></script>
|
|
290
304
|
<script src="zip.js" type="text/javascript"></script>
|
|
291
305
|
<script src="modules.js" type="text/javascript"></script>
|
|
292
306
|
<script src="mapshaper.js" type="text/javascript"></script>
|