mapshaper 0.5.74 → 0.5.75
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 +41 -2
- package/package.json +1 -1
- package/www/index.html +2 -2
- package/www/mapshaper-gui.js +2472 -5776
- package/www/mapshaper.js +41 -2
- package/www/page.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
v0.5.75
|
|
2
|
+
* Added support for importing data by copy-pasting files onto the web UI (works in Chrome and Safari but not Firefox).
|
|
3
|
+
|
|
1
4
|
v0.5.74
|
|
2
5
|
* Added support for importing data in the GUI by pasting JSON and delimited text onto the browser window.
|
|
3
6
|
* Sped up drawing shapes in the GUI.
|
package/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.5.
|
|
3
|
+
var VERSION = "0.5.74";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -34176,6 +34176,32 @@ ${svg}
|
|
|
34176
34176
|
return d;
|
|
34177
34177
|
}
|
|
34178
34178
|
|
|
34179
|
+
function findNearestVertices(p, shp, arcs) {
|
|
34180
|
+
var p2 = findNearestVertex(p[0], p[1], shp, arcs);
|
|
34181
|
+
return findVertexIds(p2.x, p2.y, arcs);
|
|
34182
|
+
}
|
|
34183
|
+
|
|
34184
|
+
// p: point to snap
|
|
34185
|
+
// ids: ids of nearby vertices, possibly including an arc endpoint
|
|
34186
|
+
function snapPointToArcEndpoint(p, ids, arcs) {
|
|
34187
|
+
var p2, p3, dx, dy;
|
|
34188
|
+
ids.forEach(function(idx) {
|
|
34189
|
+
if (vertexIsArcStart(idx, arcs)) {
|
|
34190
|
+
p2 = getVertexCoords(idx + 1, arcs);
|
|
34191
|
+
} else if (vertexIsArcEnd(idx, arcs)) {
|
|
34192
|
+
p2 = getVertexCoords(idx - 1, arcs);
|
|
34193
|
+
}
|
|
34194
|
+
});
|
|
34195
|
+
if (!p2) return;
|
|
34196
|
+
dx = p2[0] - p[0];
|
|
34197
|
+
dy = p2[1] - p[1];
|
|
34198
|
+
if (Math.abs(dx) > Math.abs(dy)) {
|
|
34199
|
+
p[1] = p2[1]; // snap y coord
|
|
34200
|
+
} else {
|
|
34201
|
+
p[0] = p2[0];
|
|
34202
|
+
}
|
|
34203
|
+
}
|
|
34204
|
+
|
|
34179
34205
|
// Find ids of vertices with identical coordinates to x,y in an ArcCollection
|
|
34180
34206
|
// Caveat: does not exclude vertices that are not visible at the
|
|
34181
34207
|
// current level of simplification.
|
|
@@ -34238,6 +34264,18 @@ ${svg}
|
|
|
34238
34264
|
return minLen < Infinity ? {x: minX, y: minY} : null;
|
|
34239
34265
|
}
|
|
34240
34266
|
|
|
34267
|
+
var VertexUtils = /*#__PURE__*/Object.freeze({
|
|
34268
|
+
__proto__: null,
|
|
34269
|
+
findNearestVertices: findNearestVertices,
|
|
34270
|
+
snapPointToArcEndpoint: snapPointToArcEndpoint,
|
|
34271
|
+
findVertexIds: findVertexIds,
|
|
34272
|
+
getVertexCoords: getVertexCoords,
|
|
34273
|
+
vertexIsArcEnd: vertexIsArcEnd,
|
|
34274
|
+
vertexIsArcStart: vertexIsArcStart,
|
|
34275
|
+
setVertexCoords: setVertexCoords,
|
|
34276
|
+
findNearestVertex: findNearestVertex
|
|
34277
|
+
});
|
|
34278
|
+
|
|
34241
34279
|
// Returns x,y coordinates of the point that is at the midpoint of each polyline feature
|
|
34242
34280
|
// Uses 2d cartesian geometry
|
|
34243
34281
|
// TODO: optionally use spherical geometry
|
|
@@ -39097,7 +39135,8 @@ ${svg}
|
|
|
39097
39135
|
TopojsonImport,
|
|
39098
39136
|
Topology,
|
|
39099
39137
|
Units,
|
|
39100
|
-
SvgHatch
|
|
39138
|
+
SvgHatch,
|
|
39139
|
+
VertexUtils
|
|
39101
39140
|
);
|
|
39102
39141
|
|
|
39103
39142
|
// The entry point for the core mapshaper module
|
package/package.json
CHANGED
package/www/index.html
CHANGED
|
@@ -210,7 +210,7 @@ a smoother appearance.</div></div></div></div>
|
|
|
210
210
|
<div class="file-catalog-spacer spacer"></div>
|
|
211
211
|
|
|
212
212
|
<div id="import-drop" class="drop-area">
|
|
213
|
-
<h4>Drop files here or <span class="inline-btn btn" id="file-selection-btn"><span class="label-text">select</span></span> from a folder</h4>
|
|
213
|
+
<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>
|
|
214
214
|
<div class="subtitle">Shapefile, GeoJSON, TopoJSON, DBF and CSV files are supported</div>
|
|
215
215
|
<div class="subtitle">Files can be loose or in a zip archive</div>
|
|
216
216
|
|
|
@@ -218,7 +218,7 @@ a smoother appearance.</div></div></div></div>
|
|
|
218
218
|
<div class="spacer"></div>
|
|
219
219
|
<div id="import-quick-drop" class="drop-area">
|
|
220
220
|
<h4>Quick import</h4>
|
|
221
|
-
<div class="subtitle">Drop files here to import with default settings</div>
|
|
221
|
+
<div class="subtitle">Drop or paste files here to import with default settings</div>
|
|
222
222
|
</div>
|
|
223
223
|
</div>
|
|
224
224
|
</div>
|