mapshaper 0.5.100 → 0.5.103
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 +9 -0
- package/mapshaper.js +38 -13
- package/package.json +1 -1
- package/www/images/thumb-map.jpg +0 -0
- package/www/images/thumb-satellite.jpg +0 -0
- package/www/mapshaper-gui.js +8 -5
- package/www/mapshaper.js +38 -13
package/CHANGELOG.md
CHANGED
package/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.5.
|
|
3
|
+
var VERSION = "0.5.103";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -33173,7 +33173,6 @@ ${svg}
|
|
|
33173
33173
|
return coords;
|
|
33174
33174
|
}
|
|
33175
33175
|
|
|
33176
|
-
|
|
33177
33176
|
function appendArr(dest, src) {
|
|
33178
33177
|
for (var i=0; i<src.length; i++) dest.push(src[i]);
|
|
33179
33178
|
}
|
|
@@ -33213,20 +33212,46 @@ ${svg}
|
|
|
33213
33212
|
}
|
|
33214
33213
|
}
|
|
33215
33214
|
|
|
33216
|
-
|
|
33217
|
-
|
|
33218
|
-
|
|
33219
|
-
|
|
33220
|
-
|
|
33215
|
+
// Use the median of intervals computed by projecting segments.
|
|
33216
|
+
// We're probing a number of points, because @proj might only be valid in
|
|
33217
|
+
// a sub-region of the dataset bbox (e.g. +proj=tpers)
|
|
33218
|
+
function findDensifyInterval(bounds, xy, proj) {
|
|
33219
|
+
var steps = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];
|
|
33220
|
+
var points = [];
|
|
33221
|
+
for (var i=0; i<steps.length; i++) {
|
|
33222
|
+
for (var j=0; j<steps.length; j++) {
|
|
33223
|
+
points.push([steps[i], steps[j]]);
|
|
33224
|
+
}
|
|
33225
|
+
}
|
|
33226
|
+
var intervals = points.map(function(pos) {
|
|
33227
|
+
var x = bounds.xmin + bounds.width() * pos[0];
|
|
33228
|
+
var y = bounds.ymin + bounds.height() * pos[1];
|
|
33229
|
+
var a = proj(x, y);
|
|
33230
|
+
var b = proj(x + xy[0], y + xy[1]);
|
|
33231
|
+
return a && b ? geom.distance2D(a[0], a[1], b[0], b[1]) : Infinity;
|
|
33232
|
+
}).filter(function(int) {return int < Infinity;});
|
|
33233
|
+
return intervals.length > 0 ? utils.findMedian(intervals) : Infinity;
|
|
33234
|
+
}
|
|
33235
|
+
|
|
33236
|
+
// Kludgy way to get a useful interval for densifying a bounding box.
|
|
33237
|
+
// Uses a fraction of average bbox side length)
|
|
33238
|
+
// TODO: improve
|
|
33239
|
+
function findDensifyInterval2(bb, proj) {
|
|
33240
|
+
var a = proj(bb.centerX(), bb.centerY()),
|
|
33221
33241
|
c = proj(bb.centerX(), bb.ymin), // right center
|
|
33222
33242
|
d = proj(bb.xmax, bb.centerY()); // bottom center
|
|
33223
|
-
|
|
33224
|
-
var intervalA = a && b ? geom.distance2D(a[0], a[1], b[0], b[1]) : Infinity;
|
|
33225
|
-
// interval B: a fraction of avg bbox side length
|
|
33226
|
-
// (added this for bbox densification)
|
|
33227
|
-
var intervalB = c && d ? (geom.distance2D(a[0], a[1], c[0], c[1]) +
|
|
33243
|
+
var interval = a && c && d ? (geom.distance2D(a[0], a[1], c[0], c[1]) +
|
|
33228
33244
|
geom.distance2D(a[0], a[1], d[0], d[1])) / 5000 : Infinity;
|
|
33229
|
-
|
|
33245
|
+
return interval;
|
|
33246
|
+
}
|
|
33247
|
+
|
|
33248
|
+
// Returns an interval in projected units
|
|
33249
|
+
function getDefaultDensifyInterval(arcs, proj) {
|
|
33250
|
+
var xy = getAvgSegment2(arcs),
|
|
33251
|
+
bb = arcs.getBounds(),
|
|
33252
|
+
intervalA = findDensifyInterval(bb, xy, proj),
|
|
33253
|
+
intervalB = findDensifyInterval2(bb, proj),
|
|
33254
|
+
interval = Math.min(intervalA, intervalB);
|
|
33230
33255
|
if (interval == Infinity) {
|
|
33231
33256
|
error('Densification error');
|
|
33232
33257
|
}
|
package/package.json
CHANGED
package/www/images/thumb-map.jpg
CHANGED
|
Binary file
|
|
Binary file
|
package/www/mapshaper-gui.js
CHANGED
|
@@ -4053,8 +4053,6 @@
|
|
|
4053
4053
|
}
|
|
4054
4054
|
}
|
|
4055
4055
|
|
|
4056
|
-
// import { cloneShape } from '../paths/mapshaper-shape-utils';
|
|
4057
|
-
// import { copyRecord } from '../datatable/mapshaper-data-utils';
|
|
4058
4056
|
var snapVerticesToPoint = internal.snapVerticesToPoint;
|
|
4059
4057
|
var cloneShape = internal.cloneShape;
|
|
4060
4058
|
var copyRecord = internal.copyRecord;
|
|
@@ -8133,12 +8131,12 @@
|
|
|
8133
8131
|
var darkStroke = "#334",
|
|
8134
8132
|
lightStroke = "#b7d9ea",
|
|
8135
8133
|
violet = "#cc6acc",
|
|
8136
|
-
violetFill = "rgba(249,
|
|
8134
|
+
violetFill = "rgba(249, 120, 249, 0.20)",
|
|
8137
8135
|
gold = "#efc100",
|
|
8138
8136
|
black = "black",
|
|
8139
8137
|
grey = "#888",
|
|
8140
8138
|
selectionFill = "rgba(237, 214, 0, 0.12)",
|
|
8141
|
-
hoverFill = "rgba(255,
|
|
8139
|
+
hoverFill = "rgba(255, 120, 255, 0.12)",
|
|
8142
8140
|
activeStyle = { // outline style for the active layer
|
|
8143
8141
|
type: 'outline',
|
|
8144
8142
|
strokeColors: [lightStroke, darkStroke],
|
|
@@ -10238,11 +10236,16 @@
|
|
|
10238
10236
|
});
|
|
10239
10237
|
}
|
|
10240
10238
|
|
|
10239
|
+
function drawLayers(action) {
|
|
10240
|
+
// This seems to smooth out navigation and keep overlay and basemap in sync.
|
|
10241
|
+
requestAnimationFrame(function() {drawLayers2(action);});
|
|
10242
|
+
}
|
|
10243
|
+
|
|
10241
10244
|
// action:
|
|
10242
10245
|
// 'nav' map was panned/zoomed -- only map extent has changed
|
|
10243
10246
|
// 'hover' highlight has changed -- only draw overlay
|
|
10244
10247
|
// (default) anything could have changed
|
|
10245
|
-
function
|
|
10248
|
+
function drawLayers2(action) {
|
|
10246
10249
|
var layersMayHaveChanged = !action;
|
|
10247
10250
|
var contentLayers = getDrawableContentLayers();
|
|
10248
10251
|
var furnitureLayers = getDrawableFurnitureLayers();
|
package/www/mapshaper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
-
var VERSION = "0.5.
|
|
3
|
+
var VERSION = "0.5.103";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var utils = /*#__PURE__*/Object.freeze({
|
|
@@ -33173,7 +33173,6 @@ ${svg}
|
|
|
33173
33173
|
return coords;
|
|
33174
33174
|
}
|
|
33175
33175
|
|
|
33176
|
-
|
|
33177
33176
|
function appendArr(dest, src) {
|
|
33178
33177
|
for (var i=0; i<src.length; i++) dest.push(src[i]);
|
|
33179
33178
|
}
|
|
@@ -33213,20 +33212,46 @@ ${svg}
|
|
|
33213
33212
|
}
|
|
33214
33213
|
}
|
|
33215
33214
|
|
|
33216
|
-
|
|
33217
|
-
|
|
33218
|
-
|
|
33219
|
-
|
|
33220
|
-
|
|
33215
|
+
// Use the median of intervals computed by projecting segments.
|
|
33216
|
+
// We're probing a number of points, because @proj might only be valid in
|
|
33217
|
+
// a sub-region of the dataset bbox (e.g. +proj=tpers)
|
|
33218
|
+
function findDensifyInterval(bounds, xy, proj) {
|
|
33219
|
+
var steps = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9];
|
|
33220
|
+
var points = [];
|
|
33221
|
+
for (var i=0; i<steps.length; i++) {
|
|
33222
|
+
for (var j=0; j<steps.length; j++) {
|
|
33223
|
+
points.push([steps[i], steps[j]]);
|
|
33224
|
+
}
|
|
33225
|
+
}
|
|
33226
|
+
var intervals = points.map(function(pos) {
|
|
33227
|
+
var x = bounds.xmin + bounds.width() * pos[0];
|
|
33228
|
+
var y = bounds.ymin + bounds.height() * pos[1];
|
|
33229
|
+
var a = proj(x, y);
|
|
33230
|
+
var b = proj(x + xy[0], y + xy[1]);
|
|
33231
|
+
return a && b ? geom.distance2D(a[0], a[1], b[0], b[1]) : Infinity;
|
|
33232
|
+
}).filter(function(int) {return int < Infinity;});
|
|
33233
|
+
return intervals.length > 0 ? utils.findMedian(intervals) : Infinity;
|
|
33234
|
+
}
|
|
33235
|
+
|
|
33236
|
+
// Kludgy way to get a useful interval for densifying a bounding box.
|
|
33237
|
+
// Uses a fraction of average bbox side length)
|
|
33238
|
+
// TODO: improve
|
|
33239
|
+
function findDensifyInterval2(bb, proj) {
|
|
33240
|
+
var a = proj(bb.centerX(), bb.centerY()),
|
|
33221
33241
|
c = proj(bb.centerX(), bb.ymin), // right center
|
|
33222
33242
|
d = proj(bb.xmax, bb.centerY()); // bottom center
|
|
33223
|
-
|
|
33224
|
-
var intervalA = a && b ? geom.distance2D(a[0], a[1], b[0], b[1]) : Infinity;
|
|
33225
|
-
// interval B: a fraction of avg bbox side length
|
|
33226
|
-
// (added this for bbox densification)
|
|
33227
|
-
var intervalB = c && d ? (geom.distance2D(a[0], a[1], c[0], c[1]) +
|
|
33243
|
+
var interval = a && c && d ? (geom.distance2D(a[0], a[1], c[0], c[1]) +
|
|
33228
33244
|
geom.distance2D(a[0], a[1], d[0], d[1])) / 5000 : Infinity;
|
|
33229
|
-
|
|
33245
|
+
return interval;
|
|
33246
|
+
}
|
|
33247
|
+
|
|
33248
|
+
// Returns an interval in projected units
|
|
33249
|
+
function getDefaultDensifyInterval(arcs, proj) {
|
|
33250
|
+
var xy = getAvgSegment2(arcs),
|
|
33251
|
+
bb = arcs.getBounds(),
|
|
33252
|
+
intervalA = findDensifyInterval(bb, xy, proj),
|
|
33253
|
+
intervalB = findDensifyInterval2(bb, proj),
|
|
33254
|
+
interval = Math.min(intervalA, intervalB);
|
|
33230
33255
|
if (interval == Infinity) {
|
|
33231
33256
|
error('Densification error');
|
|
33232
33257
|
}
|