@basemaps/cli-vector 8.3.0 → 8.4.0
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/build/cli/cli.join.js +1 -1
- package/build/cli/cli.join.js.map +1 -1
- package/build/modify/layers/place_labels.d.ts +5 -4
- package/build/modify/layers/place_labels.js +41 -52
- package/build/modify/layers/place_labels.js.map +1 -1
- package/build/modify/layers/pois.js +3 -6
- package/build/modify/layers/pois.js.map +1 -1
- package/build/modify/layers/public_transport.js +2 -8
- package/build/modify/layers/public_transport.js.map +1 -1
- package/build/modify/parser.d.ts +15 -32
- package/build/modify/parser.js +15 -15
- package/build/modify/parser.js.map +1 -1
- package/build/modify/schema.d.ts +5 -7
- package/build/modify/shared.d.ts +2 -1
- package/build/modify/shared.js +5 -0
- package/build/modify/shared.js.map +1 -1
- package/build/stac.js +2 -1
- package/build/stac.js.map +1 -1
- package/dist/index.cjs +317 -294
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -65691,14 +65691,14 @@ var require_polygon_clipping_cjs = __commonJS({
|
|
|
65691
65691
|
if (windingsAfter[_i] === 0)
|
|
65692
65692
|
continue;
|
|
65693
65693
|
var _ring = ringsAfter[_i];
|
|
65694
|
-
var
|
|
65695
|
-
if (polysExclude.indexOf(
|
|
65694
|
+
var poly2 = _ring.poly;
|
|
65695
|
+
if (polysExclude.indexOf(poly2) !== -1)
|
|
65696
65696
|
continue;
|
|
65697
65697
|
if (_ring.isExterior)
|
|
65698
|
-
polysAfter.push(
|
|
65698
|
+
polysAfter.push(poly2);
|
|
65699
65699
|
else {
|
|
65700
|
-
if (polysExclude.indexOf(
|
|
65701
|
-
polysExclude.push(
|
|
65700
|
+
if (polysExclude.indexOf(poly2) === -1)
|
|
65701
|
+
polysExclude.push(poly2);
|
|
65702
65702
|
var _index = polysAfter.indexOf(_ring.poly);
|
|
65703
65703
|
if (_index !== -1)
|
|
65704
65704
|
polysAfter.splice(_index, 1);
|
|
@@ -65781,12 +65781,12 @@ var require_polygon_clipping_cjs = __commonJS({
|
|
|
65781
65781
|
return Segment2;
|
|
65782
65782
|
}();
|
|
65783
65783
|
var RingIn = /* @__PURE__ */ function() {
|
|
65784
|
-
function RingIn2(geomRing,
|
|
65784
|
+
function RingIn2(geomRing, poly2, isExterior) {
|
|
65785
65785
|
_classCallCheck(this, RingIn2);
|
|
65786
65786
|
if (!Array.isArray(geomRing) || geomRing.length === 0) {
|
|
65787
65787
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
65788
65788
|
}
|
|
65789
|
-
this.poly =
|
|
65789
|
+
this.poly = poly2;
|
|
65790
65790
|
this.isExterior = isExterior;
|
|
65791
65791
|
this.segments = [];
|
|
65792
65792
|
if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
|
|
@@ -65910,16 +65910,16 @@ var require_polygon_clipping_cjs = __commonJS({
|
|
|
65910
65910
|
}
|
|
65911
65911
|
};
|
|
65912
65912
|
for (var i = 0, iMax = geom.length; i < iMax; i++) {
|
|
65913
|
-
var
|
|
65914
|
-
if (
|
|
65915
|
-
this.bbox.ll.x =
|
|
65916
|
-
if (
|
|
65917
|
-
this.bbox.ll.y =
|
|
65918
|
-
if (
|
|
65919
|
-
this.bbox.ur.x =
|
|
65920
|
-
if (
|
|
65921
|
-
this.bbox.ur.y =
|
|
65922
|
-
this.polys.push(
|
|
65913
|
+
var poly2 = new PolyIn(geom[i], this);
|
|
65914
|
+
if (poly2.bbox.ll.x < this.bbox.ll.x)
|
|
65915
|
+
this.bbox.ll.x = poly2.bbox.ll.x;
|
|
65916
|
+
if (poly2.bbox.ll.y < this.bbox.ll.y)
|
|
65917
|
+
this.bbox.ll.y = poly2.bbox.ll.y;
|
|
65918
|
+
if (poly2.bbox.ur.x > this.bbox.ur.x)
|
|
65919
|
+
this.bbox.ur.x = poly2.bbox.ur.x;
|
|
65920
|
+
if (poly2.bbox.ur.y > this.bbox.ur.y)
|
|
65921
|
+
this.bbox.ur.y = poly2.bbox.ur.y;
|
|
65922
|
+
this.polys.push(poly2);
|
|
65923
65923
|
}
|
|
65924
65924
|
this.isSubject = isSubject;
|
|
65925
65925
|
}
|
|
@@ -70677,7 +70677,7 @@ var require_proj4_src = __commonJS({
|
|
|
70677
70677
|
return p;
|
|
70678
70678
|
}
|
|
70679
70679
|
var names$19 = ["Polyconic", "poly"];
|
|
70680
|
-
var
|
|
70680
|
+
var poly2 = {
|
|
70681
70681
|
init: init$18,
|
|
70682
70682
|
forward: forward$17,
|
|
70683
70683
|
inverse: inverse$17,
|
|
@@ -72157,7 +72157,7 @@ var require_proj4_src = __commonJS({
|
|
|
72157
72157
|
proj4.Proj.projections.add(gnom);
|
|
72158
72158
|
proj4.Proj.projections.add(cea);
|
|
72159
72159
|
proj4.Proj.projections.add(eqc);
|
|
72160
|
-
proj4.Proj.projections.add(
|
|
72160
|
+
proj4.Proj.projections.add(poly2);
|
|
72161
72161
|
proj4.Proj.projections.add(nzmg);
|
|
72162
72162
|
proj4.Proj.projections.add(mill);
|
|
72163
72163
|
proj4.Proj.projections.add(sinu);
|
|
@@ -72643,6 +72643,225 @@ var require_src3 = __commonJS({
|
|
|
72643
72643
|
}
|
|
72644
72644
|
});
|
|
72645
72645
|
|
|
72646
|
+
// node_modules/tinyqueue/tinyqueue.js
|
|
72647
|
+
var require_tinyqueue = __commonJS({
|
|
72648
|
+
"node_modules/tinyqueue/tinyqueue.js"(exports, module2) {
|
|
72649
|
+
(function(global2, factory) {
|
|
72650
|
+
typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = global2 || self, global2.TinyQueue = factory());
|
|
72651
|
+
})(exports, function() {
|
|
72652
|
+
"use strict";
|
|
72653
|
+
var TinyQueue = function TinyQueue2(data, compare) {
|
|
72654
|
+
if (data === void 0)
|
|
72655
|
+
data = [];
|
|
72656
|
+
if (compare === void 0)
|
|
72657
|
+
compare = defaultCompare;
|
|
72658
|
+
this.data = data;
|
|
72659
|
+
this.length = this.data.length;
|
|
72660
|
+
this.compare = compare;
|
|
72661
|
+
if (this.length > 0) {
|
|
72662
|
+
for (var i = (this.length >> 1) - 1; i >= 0; i--) {
|
|
72663
|
+
this._down(i);
|
|
72664
|
+
}
|
|
72665
|
+
}
|
|
72666
|
+
};
|
|
72667
|
+
TinyQueue.prototype.push = function push2(item) {
|
|
72668
|
+
this.data.push(item);
|
|
72669
|
+
this.length++;
|
|
72670
|
+
this._up(this.length - 1);
|
|
72671
|
+
};
|
|
72672
|
+
TinyQueue.prototype.pop = function pop() {
|
|
72673
|
+
if (this.length === 0) {
|
|
72674
|
+
return void 0;
|
|
72675
|
+
}
|
|
72676
|
+
var top = this.data[0];
|
|
72677
|
+
var bottom = this.data.pop();
|
|
72678
|
+
this.length--;
|
|
72679
|
+
if (this.length > 0) {
|
|
72680
|
+
this.data[0] = bottom;
|
|
72681
|
+
this._down(0);
|
|
72682
|
+
}
|
|
72683
|
+
return top;
|
|
72684
|
+
};
|
|
72685
|
+
TinyQueue.prototype.peek = function peek() {
|
|
72686
|
+
return this.data[0];
|
|
72687
|
+
};
|
|
72688
|
+
TinyQueue.prototype._up = function _up(pos) {
|
|
72689
|
+
var ref = this;
|
|
72690
|
+
var data = ref.data;
|
|
72691
|
+
var compare = ref.compare;
|
|
72692
|
+
var item = data[pos];
|
|
72693
|
+
while (pos > 0) {
|
|
72694
|
+
var parent = pos - 1 >> 1;
|
|
72695
|
+
var current = data[parent];
|
|
72696
|
+
if (compare(item, current) >= 0) {
|
|
72697
|
+
break;
|
|
72698
|
+
}
|
|
72699
|
+
data[pos] = current;
|
|
72700
|
+
pos = parent;
|
|
72701
|
+
}
|
|
72702
|
+
data[pos] = item;
|
|
72703
|
+
};
|
|
72704
|
+
TinyQueue.prototype._down = function _down(pos) {
|
|
72705
|
+
var ref = this;
|
|
72706
|
+
var data = ref.data;
|
|
72707
|
+
var compare = ref.compare;
|
|
72708
|
+
var halfLength = this.length >> 1;
|
|
72709
|
+
var item = data[pos];
|
|
72710
|
+
while (pos < halfLength) {
|
|
72711
|
+
var left = (pos << 1) + 1;
|
|
72712
|
+
var best = data[left];
|
|
72713
|
+
var right = left + 1;
|
|
72714
|
+
if (right < this.length && compare(data[right], best) < 0) {
|
|
72715
|
+
left = right;
|
|
72716
|
+
best = data[right];
|
|
72717
|
+
}
|
|
72718
|
+
if (compare(best, item) >= 0) {
|
|
72719
|
+
break;
|
|
72720
|
+
}
|
|
72721
|
+
data[pos] = best;
|
|
72722
|
+
pos = left;
|
|
72723
|
+
}
|
|
72724
|
+
data[pos] = item;
|
|
72725
|
+
};
|
|
72726
|
+
function defaultCompare(a, b) {
|
|
72727
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
72728
|
+
}
|
|
72729
|
+
return TinyQueue;
|
|
72730
|
+
});
|
|
72731
|
+
}
|
|
72732
|
+
});
|
|
72733
|
+
|
|
72734
|
+
// node_modules/polylabel/polylabel.js
|
|
72735
|
+
var require_polylabel = __commonJS({
|
|
72736
|
+
"node_modules/polylabel/polylabel.js"(exports, module2) {
|
|
72737
|
+
"use strict";
|
|
72738
|
+
var Queue2 = require_tinyqueue();
|
|
72739
|
+
if (Queue2.default)
|
|
72740
|
+
Queue2 = Queue2.default;
|
|
72741
|
+
module2.exports = polylabel2;
|
|
72742
|
+
module2.exports.default = polylabel2;
|
|
72743
|
+
function polylabel2(polygon, precision, debug) {
|
|
72744
|
+
precision = precision || 1;
|
|
72745
|
+
var minX, minY, maxX, maxY;
|
|
72746
|
+
for (var i = 0; i < polygon[0].length; i++) {
|
|
72747
|
+
var p = polygon[0][i];
|
|
72748
|
+
if (!i || p[0] < minX)
|
|
72749
|
+
minX = p[0];
|
|
72750
|
+
if (!i || p[1] < minY)
|
|
72751
|
+
minY = p[1];
|
|
72752
|
+
if (!i || p[0] > maxX)
|
|
72753
|
+
maxX = p[0];
|
|
72754
|
+
if (!i || p[1] > maxY)
|
|
72755
|
+
maxY = p[1];
|
|
72756
|
+
}
|
|
72757
|
+
var width = maxX - minX;
|
|
72758
|
+
var height = maxY - minY;
|
|
72759
|
+
var cellSize = Math.min(width, height);
|
|
72760
|
+
var h = cellSize / 2;
|
|
72761
|
+
if (cellSize === 0) {
|
|
72762
|
+
var degeneratePoleOfInaccessibility = [minX, minY];
|
|
72763
|
+
degeneratePoleOfInaccessibility.distance = 0;
|
|
72764
|
+
return degeneratePoleOfInaccessibility;
|
|
72765
|
+
}
|
|
72766
|
+
var cellQueue = new Queue2(void 0, compareMax);
|
|
72767
|
+
for (var x = minX; x < maxX; x += cellSize) {
|
|
72768
|
+
for (var y = minY; y < maxY; y += cellSize) {
|
|
72769
|
+
cellQueue.push(new Cell(x + h, y + h, h, polygon));
|
|
72770
|
+
}
|
|
72771
|
+
}
|
|
72772
|
+
var bestCell = getCentroidCell(polygon);
|
|
72773
|
+
var bboxCell = new Cell(minX + width / 2, minY + height / 2, 0, polygon);
|
|
72774
|
+
if (bboxCell.d > bestCell.d)
|
|
72775
|
+
bestCell = bboxCell;
|
|
72776
|
+
var numProbes = cellQueue.length;
|
|
72777
|
+
while (cellQueue.length) {
|
|
72778
|
+
var cell = cellQueue.pop();
|
|
72779
|
+
if (cell.d > bestCell.d) {
|
|
72780
|
+
bestCell = cell;
|
|
72781
|
+
if (debug)
|
|
72782
|
+
console.log("found best %d after %d probes", Math.round(1e4 * cell.d) / 1e4, numProbes);
|
|
72783
|
+
}
|
|
72784
|
+
if (cell.max - bestCell.d <= precision)
|
|
72785
|
+
continue;
|
|
72786
|
+
h = cell.h / 2;
|
|
72787
|
+
cellQueue.push(new Cell(cell.x - h, cell.y - h, h, polygon));
|
|
72788
|
+
cellQueue.push(new Cell(cell.x + h, cell.y - h, h, polygon));
|
|
72789
|
+
cellQueue.push(new Cell(cell.x - h, cell.y + h, h, polygon));
|
|
72790
|
+
cellQueue.push(new Cell(cell.x + h, cell.y + h, h, polygon));
|
|
72791
|
+
numProbes += 4;
|
|
72792
|
+
}
|
|
72793
|
+
if (debug) {
|
|
72794
|
+
console.log("num probes: " + numProbes);
|
|
72795
|
+
console.log("best distance: " + bestCell.d);
|
|
72796
|
+
}
|
|
72797
|
+
var poleOfInaccessibility = [bestCell.x, bestCell.y];
|
|
72798
|
+
poleOfInaccessibility.distance = bestCell.d;
|
|
72799
|
+
return poleOfInaccessibility;
|
|
72800
|
+
}
|
|
72801
|
+
function compareMax(a, b) {
|
|
72802
|
+
return b.max - a.max;
|
|
72803
|
+
}
|
|
72804
|
+
function Cell(x, y, h, polygon) {
|
|
72805
|
+
this.x = x;
|
|
72806
|
+
this.y = y;
|
|
72807
|
+
this.h = h;
|
|
72808
|
+
this.d = pointToPolygonDist(x, y, polygon);
|
|
72809
|
+
this.max = this.d + this.h * Math.SQRT2;
|
|
72810
|
+
}
|
|
72811
|
+
function pointToPolygonDist(x, y, polygon) {
|
|
72812
|
+
var inside = false;
|
|
72813
|
+
var minDistSq = Infinity;
|
|
72814
|
+
for (var k = 0; k < polygon.length; k++) {
|
|
72815
|
+
var ring = polygon[k];
|
|
72816
|
+
for (var i = 0, len = ring.length, j = len - 1; i < len; j = i++) {
|
|
72817
|
+
var a = ring[i];
|
|
72818
|
+
var b = ring[j];
|
|
72819
|
+
if (a[1] > y !== b[1] > y && x < (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1]) + a[0])
|
|
72820
|
+
inside = !inside;
|
|
72821
|
+
minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b));
|
|
72822
|
+
}
|
|
72823
|
+
}
|
|
72824
|
+
return minDistSq === 0 ? 0 : (inside ? 1 : -1) * Math.sqrt(minDistSq);
|
|
72825
|
+
}
|
|
72826
|
+
function getCentroidCell(polygon) {
|
|
72827
|
+
var area = 0;
|
|
72828
|
+
var x = 0;
|
|
72829
|
+
var y = 0;
|
|
72830
|
+
var points = polygon[0];
|
|
72831
|
+
for (var i = 0, len = points.length, j = len - 1; i < len; j = i++) {
|
|
72832
|
+
var a = points[i];
|
|
72833
|
+
var b = points[j];
|
|
72834
|
+
var f = a[0] * b[1] - b[0] * a[1];
|
|
72835
|
+
x += (a[0] + b[0]) * f;
|
|
72836
|
+
y += (a[1] + b[1]) * f;
|
|
72837
|
+
area += f * 3;
|
|
72838
|
+
}
|
|
72839
|
+
if (area === 0)
|
|
72840
|
+
return new Cell(points[0][0], points[0][1], 0, polygon);
|
|
72841
|
+
return new Cell(x / area, y / area, 0, polygon);
|
|
72842
|
+
}
|
|
72843
|
+
function getSegDistSq(px, py, a, b) {
|
|
72844
|
+
var x = a[0];
|
|
72845
|
+
var y = a[1];
|
|
72846
|
+
var dx = b[0] - x;
|
|
72847
|
+
var dy = b[1] - y;
|
|
72848
|
+
if (dx !== 0 || dy !== 0) {
|
|
72849
|
+
var t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);
|
|
72850
|
+
if (t > 1) {
|
|
72851
|
+
x = b[0];
|
|
72852
|
+
y = b[1];
|
|
72853
|
+
} else if (t > 0) {
|
|
72854
|
+
x += dx * t;
|
|
72855
|
+
y += dy * t;
|
|
72856
|
+
}
|
|
72857
|
+
}
|
|
72858
|
+
dx = px - x;
|
|
72859
|
+
dy = py - y;
|
|
72860
|
+
return dx * dx + dy * dy;
|
|
72861
|
+
}
|
|
72862
|
+
}
|
|
72863
|
+
});
|
|
72864
|
+
|
|
72646
72865
|
// ../../node_modules/readable-stream/lib/internal/streams/stream.js
|
|
72647
72866
|
var require_stream2 = __commonJS({
|
|
72648
72867
|
"../../node_modules/readable-stream/lib/internal/streams/stream.js"(exports, module2) {
|
|
@@ -80329,9 +80548,9 @@ var ulid2 = __toESM(require_index_umd(), 1);
|
|
|
80329
80548
|
var CliInfo = {
|
|
80330
80549
|
// Detect unlinked packages looks for this string since its a package name, slightly work around it
|
|
80331
80550
|
package: "@basemaps/cli",
|
|
80332
|
-
version: "v8.
|
|
80333
|
-
hash: "
|
|
80334
|
-
buildId: "
|
|
80551
|
+
version: "v8.4.0",
|
|
80552
|
+
hash: "f30c12a7491ec5556f62b3f35d985d2e89a15c39",
|
|
80553
|
+
buildId: "15866391498-1"
|
|
80335
80554
|
};
|
|
80336
80555
|
var CliDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
80337
80556
|
var CliId = ulid2.ulid();
|
|
@@ -86582,8 +86801,8 @@ var Bounds = class _Bounds {
|
|
|
86582
86801
|
let minY = multipoly[0][0][0][1];
|
|
86583
86802
|
let maxX = minX;
|
|
86584
86803
|
let maxY = minY;
|
|
86585
|
-
for (const [
|
|
86586
|
-
for (const [x, y] of
|
|
86804
|
+
for (const [poly2] of multipoly) {
|
|
86805
|
+
for (const [x, y] of poly2) {
|
|
86587
86806
|
if (x < minX)
|
|
86588
86807
|
minX = x;
|
|
86589
86808
|
else if (x > maxX)
|
|
@@ -86807,8 +87026,8 @@ function removeDegenerateEdges(polygons, bbox) {
|
|
|
86807
87026
|
}
|
|
86808
87027
|
function clipMultipolygon(polygons, bbox) {
|
|
86809
87028
|
const result = [];
|
|
86810
|
-
for (const
|
|
86811
|
-
const clipped = import_lineclip.default.polygon(
|
|
87029
|
+
for (const poly2 of polygons) {
|
|
87030
|
+
const clipped = import_lineclip.default.polygon(poly2[0], bbox);
|
|
86812
87031
|
if (clipped.length !== 0) {
|
|
86813
87032
|
if (!samePoint(clipped[0], clipped[clipped.length - 1]))
|
|
86814
87033
|
clipped.push(clipped[0]);
|
|
@@ -86965,10 +87184,10 @@ var Wgs84 = {
|
|
|
86965
87184
|
*/
|
|
86966
87185
|
multiPolygonToBbox(multipolygon) {
|
|
86967
87186
|
let ans = null;
|
|
86968
|
-
for (const
|
|
86969
|
-
if (
|
|
87187
|
+
for (const poly2 of multipolygon) {
|
|
87188
|
+
if (poly2.length === 0)
|
|
86970
87189
|
continue;
|
|
86971
|
-
const ring =
|
|
87190
|
+
const ring = poly2[0];
|
|
86972
87191
|
if (ring.length < 3)
|
|
86973
87192
|
continue;
|
|
86974
87193
|
const bbox = this.ringToBbox(ring);
|
|
@@ -87004,11 +87223,11 @@ function pointAtFrac(frac, a, b) {
|
|
|
87004
87223
|
}
|
|
87005
87224
|
function splitWgs84MultiPolygon(multipoly) {
|
|
87006
87225
|
const result = [];
|
|
87007
|
-
for (const
|
|
87008
|
-
result.push(
|
|
87226
|
+
for (const poly2 of clipMultipolygon(multipoly, WorldBounds)) {
|
|
87227
|
+
result.push(poly2);
|
|
87009
87228
|
}
|
|
87010
|
-
for (const
|
|
87011
|
-
result.push(
|
|
87229
|
+
for (const poly2 of clipMultipolygon(multipoly, NextWorldBounds)) {
|
|
87230
|
+
result.push(poly2.map((ring) => ring.map((point) => [point[0] - 360, point[1]])));
|
|
87012
87231
|
}
|
|
87013
87232
|
return result;
|
|
87014
87233
|
}
|
|
@@ -87199,7 +87418,7 @@ var Projection = class _Projection {
|
|
|
87199
87418
|
return multipoly;
|
|
87200
87419
|
const { toWgs84 } = this;
|
|
87201
87420
|
const { fromWgs84 } = targetProjection;
|
|
87202
|
-
return multipoly.map((
|
|
87421
|
+
return multipoly.map((poly2) => poly2.map((ring) => ring.map((p) => fromWgs84(toWgs84(p)))));
|
|
87203
87422
|
}
|
|
87204
87423
|
/**
|
|
87205
87424
|
* Convert source `[x, y]` coordinates to `[lon, lat]`
|
|
@@ -87920,8 +88139,8 @@ function locationTransform(location, tileMatrix, targetTileMatrix) {
|
|
|
87920
88139
|
}
|
|
87921
88140
|
function projectFeature(f, targetTileMatrix) {
|
|
87922
88141
|
if (f.geometry.type === "Polygon") {
|
|
87923
|
-
for (const
|
|
87924
|
-
for (const coord of
|
|
88142
|
+
for (const poly2 of f.geometry.coordinates) {
|
|
88143
|
+
for (const coord of poly2) {
|
|
87925
88144
|
const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
|
|
87926
88145
|
coord[0] = output.lon;
|
|
87927
88146
|
coord[1] = output.lat;
|
|
@@ -87929,8 +88148,8 @@ function projectFeature(f, targetTileMatrix) {
|
|
|
87929
88148
|
}
|
|
87930
88149
|
} else if (f.geometry.type === "MultiPolygon") {
|
|
87931
88150
|
for (const multiPoly of f.geometry.coordinates) {
|
|
87932
|
-
for (const
|
|
87933
|
-
for (const coord of
|
|
88151
|
+
for (const poly2 of multiPoly) {
|
|
88152
|
+
for (const coord of poly2) {
|
|
87934
88153
|
const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
|
|
87935
88154
|
coord[0] = output.lon;
|
|
87936
88155
|
coord[1] = output.lat;
|
|
@@ -90567,6 +90786,7 @@ var VectorStac = class {
|
|
|
90567
90786
|
...layers
|
|
90568
90787
|
],
|
|
90569
90788
|
properties: {
|
|
90789
|
+
datetime: CliDate,
|
|
90570
90790
|
"proj:epsg": tileMatrix.projection.code,
|
|
90571
90791
|
"linz_basemaps:generated": {
|
|
90572
90792
|
package: CliInfo.package,
|
|
@@ -90649,7 +90869,7 @@ async function createStacFiles(filePaths, targetPath, filename, tileMatrix, titl
|
|
|
90649
90869
|
};
|
|
90650
90870
|
const stacCollection = vectorStac.createStacCollection(unionBbox, layers, filename, title);
|
|
90651
90871
|
let stacCatalog = vectorStac.createStacCatalog();
|
|
90652
|
-
const catalogPath = new URL("catalog.json", targetPath);
|
|
90872
|
+
const catalogPath = new URL("topographic/catalog.json", targetPath);
|
|
90653
90873
|
if (await Fsa.exists(catalogPath))
|
|
90654
90874
|
stacCatalog = await Fsa.readJson(catalogPath);
|
|
90655
90875
|
stacCatalog.links.push({
|
|
@@ -90961,93 +91181,79 @@ function handleKindPeak(feature, logger) {
|
|
|
90961
91181
|
}
|
|
90962
91182
|
|
|
90963
91183
|
// src/modify/parser.ts
|
|
91184
|
+
var optionalString = z.preprocess((value) => {
|
|
91185
|
+
if (value === "0" || value === null) {
|
|
91186
|
+
return void 0;
|
|
91187
|
+
} else {
|
|
91188
|
+
return value;
|
|
91189
|
+
}
|
|
91190
|
+
}, z.string().optional());
|
|
90964
91191
|
var zPlaceLabelsProperties = z.object({
|
|
90965
91192
|
/** @example "Kaitaia" */
|
|
90966
91193
|
label: z.string(),
|
|
91194
|
+
/** @example 8 */
|
|
91195
|
+
zoom_level: z.number(),
|
|
90967
91196
|
/** @example "TWN1" */
|
|
90968
91197
|
style: z.string(),
|
|
91198
|
+
/** @example "cape" */
|
|
91199
|
+
natural: optionalString,
|
|
90969
91200
|
/** @example "city" */
|
|
90970
|
-
place:
|
|
90971
|
-
/** @example
|
|
90972
|
-
|
|
90973
|
-
/** @example "0" */
|
|
90974
|
-
natural: z.string(),
|
|
90975
|
-
/** @example "0" */
|
|
90976
|
-
water: z.string()
|
|
90977
|
-
});
|
|
90978
|
-
var zPlaceLabelsTippecanoe = z.object({
|
|
90979
|
-
/** @example "place_labels" */
|
|
90980
|
-
layer: z.string(),
|
|
90981
|
-
/** @example 8 */
|
|
90982
|
-
minzoom: z.number(),
|
|
90983
|
-
/** @example 8 */
|
|
90984
|
-
maxzoom: z.number()
|
|
91201
|
+
place: optionalString,
|
|
91202
|
+
/** @example "bay" */
|
|
91203
|
+
water: optionalString
|
|
90985
91204
|
});
|
|
90986
91205
|
|
|
90987
91206
|
// src/modify/layers/place_labels.ts
|
|
90988
91207
|
var PlaceLabelsFeatures = /* @__PURE__ */ new Map();
|
|
90989
91208
|
function handleLayerPlaceLabels(feature, logger) {
|
|
90990
91209
|
logger.trace({}, "HandlePlaceLabels:Start");
|
|
90991
|
-
|
|
90992
|
-
const
|
|
90993
|
-
|
|
90994
|
-
throw new Error("Label property is not a string");
|
|
90995
|
-
const zoomLevel = feature.properties["zoom_level"];
|
|
90996
|
-
if (typeof zoomLevel !== "number")
|
|
90997
|
-
throw new Error("Zoom level is not a number");
|
|
90998
|
-
const storedFeature = PlaceLabelsFeatures.get(label);
|
|
91210
|
+
const newFeature = createNewFeature(feature, logger);
|
|
91211
|
+
const name = newFeature.properties.name;
|
|
91212
|
+
const storedFeature = PlaceLabelsFeatures.get(name);
|
|
90999
91213
|
if (storedFeature == null) {
|
|
91000
|
-
|
|
91001
|
-
if (newFeature == null)
|
|
91002
|
-
return null;
|
|
91003
|
-
PlaceLabelsFeatures.set(label, newFeature);
|
|
91214
|
+
PlaceLabelsFeatures.set(name, newFeature);
|
|
91004
91215
|
logger.trace({}, "HandlePlaceLabels:End");
|
|
91005
91216
|
return newFeature;
|
|
91006
91217
|
}
|
|
91007
|
-
storedFeature.tippecanoe.minzoom =
|
|
91008
|
-
storedFeature.tippecanoe.maxzoom =
|
|
91218
|
+
storedFeature.tippecanoe.minzoom = newFeature.tippecanoe.minzoom;
|
|
91219
|
+
storedFeature.tippecanoe.maxzoom = newFeature.tippecanoe.minzoom;
|
|
91009
91220
|
logger.trace({}, "HandlePlaceLabels:End");
|
|
91010
|
-
return storedFeature;
|
|
91221
|
+
return structuredClone(storedFeature);
|
|
91011
91222
|
}
|
|
91012
|
-
function createNewFeature(feature,
|
|
91013
|
-
let properties;
|
|
91014
|
-
let tippecanoe2;
|
|
91223
|
+
function createNewFeature(feature, logger) {
|
|
91015
91224
|
try {
|
|
91016
|
-
properties = zPlaceLabelsProperties.parse({
|
|
91017
|
-
label,
|
|
91225
|
+
const properties = zPlaceLabelsProperties.parse({
|
|
91226
|
+
label: feature.properties["label"],
|
|
91227
|
+
zoom_level: feature.properties["zoom_level"],
|
|
91018
91228
|
style: feature.properties["style"],
|
|
91019
|
-
place: feature.properties["place"],
|
|
91020
|
-
adminlevel: feature.properties["adminlevel"],
|
|
91021
91229
|
natural: feature.properties["natural"],
|
|
91230
|
+
place: feature.properties["place"],
|
|
91022
91231
|
water: feature.properties["water"]
|
|
91023
91232
|
});
|
|
91024
|
-
tippecanoe2 =
|
|
91233
|
+
const tippecanoe2 = {
|
|
91025
91234
|
layer: "place_labels",
|
|
91026
|
-
minzoom:
|
|
91027
|
-
maxzoom:
|
|
91028
|
-
}
|
|
91235
|
+
minzoom: properties.zoom_level,
|
|
91236
|
+
maxzoom: properties.zoom_level
|
|
91237
|
+
};
|
|
91238
|
+
const newFeature = {
|
|
91239
|
+
type: feature.type,
|
|
91240
|
+
properties: {
|
|
91241
|
+
name: properties.label,
|
|
91242
|
+
kind: convertStyleToKind(properties.style, tippecanoe2.minzoom),
|
|
91243
|
+
natural: properties.natural,
|
|
91244
|
+
place: properties.place,
|
|
91245
|
+
water: properties.water
|
|
91246
|
+
},
|
|
91247
|
+
geometry: feature.geometry,
|
|
91248
|
+
tippecanoe: tippecanoe2
|
|
91249
|
+
};
|
|
91250
|
+
return newFeature;
|
|
91029
91251
|
} catch (e) {
|
|
91030
91252
|
if (e instanceof z.ZodError) {
|
|
91031
|
-
logger.trace({
|
|
91032
|
-
|
|
91033
|
-
|
|
91034
|
-
|
|
91035
|
-
}
|
|
91036
|
-
}
|
|
91037
|
-
const newFeature = {
|
|
91038
|
-
type: feature.type,
|
|
91039
|
-
properties: {
|
|
91040
|
-
name: properties.label,
|
|
91041
|
-
kind: convertStyleToKind(properties.style, tippecanoe2.minzoom),
|
|
91042
|
-
place: properties.place,
|
|
91043
|
-
adminlevel: properties.adminlevel,
|
|
91044
|
-
natural: properties.natural,
|
|
91045
|
-
water: properties.water
|
|
91046
|
-
},
|
|
91047
|
-
geometry: feature.geometry,
|
|
91048
|
-
tippecanoe: tippecanoe2
|
|
91049
|
-
};
|
|
91050
|
-
return newFeature;
|
|
91253
|
+
logger.trace({ properties: feature.properties }, "Failed to parse required properties.");
|
|
91254
|
+
}
|
|
91255
|
+
throw e;
|
|
91256
|
+
}
|
|
91051
91257
|
}
|
|
91052
91258
|
function convertStyleToKind(style, minzoom) {
|
|
91053
91259
|
if (style.startsWith("ANT"))
|
|
@@ -91067,190 +91273,8 @@ function convertStyleToKind(style, minzoom) {
|
|
|
91067
91273
|
return "";
|
|
91068
91274
|
}
|
|
91069
91275
|
|
|
91070
|
-
//
|
|
91071
|
-
var
|
|
91072
|
-
constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
|
|
91073
|
-
this.data = data;
|
|
91074
|
-
this.length = this.data.length;
|
|
91075
|
-
this.compare = compare;
|
|
91076
|
-
if (this.length > 0) {
|
|
91077
|
-
for (let i = (this.length >> 1) - 1; i >= 0; i--)
|
|
91078
|
-
this._down(i);
|
|
91079
|
-
}
|
|
91080
|
-
}
|
|
91081
|
-
push(item) {
|
|
91082
|
-
this.data.push(item);
|
|
91083
|
-
this._up(this.length++);
|
|
91084
|
-
}
|
|
91085
|
-
pop() {
|
|
91086
|
-
if (this.length === 0)
|
|
91087
|
-
return void 0;
|
|
91088
|
-
const top = this.data[0];
|
|
91089
|
-
const bottom = this.data.pop();
|
|
91090
|
-
if (--this.length > 0) {
|
|
91091
|
-
this.data[0] = bottom;
|
|
91092
|
-
this._down(0);
|
|
91093
|
-
}
|
|
91094
|
-
return top;
|
|
91095
|
-
}
|
|
91096
|
-
peek() {
|
|
91097
|
-
return this.data[0];
|
|
91098
|
-
}
|
|
91099
|
-
_up(pos) {
|
|
91100
|
-
const { data, compare } = this;
|
|
91101
|
-
const item = data[pos];
|
|
91102
|
-
while (pos > 0) {
|
|
91103
|
-
const parent = pos - 1 >> 1;
|
|
91104
|
-
const current = data[parent];
|
|
91105
|
-
if (compare(item, current) >= 0)
|
|
91106
|
-
break;
|
|
91107
|
-
data[pos] = current;
|
|
91108
|
-
pos = parent;
|
|
91109
|
-
}
|
|
91110
|
-
data[pos] = item;
|
|
91111
|
-
}
|
|
91112
|
-
_down(pos) {
|
|
91113
|
-
const { data, compare } = this;
|
|
91114
|
-
const halfLength = this.length >> 1;
|
|
91115
|
-
const item = data[pos];
|
|
91116
|
-
while (pos < halfLength) {
|
|
91117
|
-
let bestChild = (pos << 1) + 1;
|
|
91118
|
-
const right = bestChild + 1;
|
|
91119
|
-
if (right < this.length && compare(data[right], data[bestChild]) < 0) {
|
|
91120
|
-
bestChild = right;
|
|
91121
|
-
}
|
|
91122
|
-
if (compare(data[bestChild], item) >= 0)
|
|
91123
|
-
break;
|
|
91124
|
-
data[pos] = data[bestChild];
|
|
91125
|
-
pos = bestChild;
|
|
91126
|
-
}
|
|
91127
|
-
data[pos] = item;
|
|
91128
|
-
}
|
|
91129
|
-
};
|
|
91130
|
-
|
|
91131
|
-
// ../../node_modules/polylabel/polylabel.js
|
|
91132
|
-
function polylabel(polygon, precision = 1, debug = false) {
|
|
91133
|
-
let minX = Infinity;
|
|
91134
|
-
let minY = Infinity;
|
|
91135
|
-
let maxX = -Infinity;
|
|
91136
|
-
let maxY = -Infinity;
|
|
91137
|
-
for (const [x, y] of polygon[0]) {
|
|
91138
|
-
if (x < minX)
|
|
91139
|
-
minX = x;
|
|
91140
|
-
if (y < minY)
|
|
91141
|
-
minY = y;
|
|
91142
|
-
if (x > maxX)
|
|
91143
|
-
maxX = x;
|
|
91144
|
-
if (y > maxY)
|
|
91145
|
-
maxY = y;
|
|
91146
|
-
}
|
|
91147
|
-
const width = maxX - minX;
|
|
91148
|
-
const height = maxY - minY;
|
|
91149
|
-
const cellSize = Math.max(precision, Math.min(width, height));
|
|
91150
|
-
if (cellSize === precision) {
|
|
91151
|
-
const result2 = [minX, minY];
|
|
91152
|
-
result2.distance = 0;
|
|
91153
|
-
return result2;
|
|
91154
|
-
}
|
|
91155
|
-
const cellQueue = new TinyQueue([], (a, b) => b.max - a.max);
|
|
91156
|
-
let bestCell = getCentroidCell(polygon);
|
|
91157
|
-
const bboxCell = new Cell(minX + width / 2, minY + height / 2, 0, polygon);
|
|
91158
|
-
if (bboxCell.d > bestCell.d)
|
|
91159
|
-
bestCell = bboxCell;
|
|
91160
|
-
let numProbes = 2;
|
|
91161
|
-
function potentiallyQueue(x, y, h2) {
|
|
91162
|
-
const cell = new Cell(x, y, h2, polygon);
|
|
91163
|
-
numProbes++;
|
|
91164
|
-
if (cell.max > bestCell.d + precision)
|
|
91165
|
-
cellQueue.push(cell);
|
|
91166
|
-
if (cell.d > bestCell.d) {
|
|
91167
|
-
bestCell = cell;
|
|
91168
|
-
if (debug)
|
|
91169
|
-
console.log(`found best ${Math.round(1e4 * cell.d) / 1e4} after ${numProbes} probes`);
|
|
91170
|
-
}
|
|
91171
|
-
}
|
|
91172
|
-
let h = cellSize / 2;
|
|
91173
|
-
for (let x = minX; x < maxX; x += cellSize) {
|
|
91174
|
-
for (let y = minY; y < maxY; y += cellSize) {
|
|
91175
|
-
potentiallyQueue(x + h, y + h, h);
|
|
91176
|
-
}
|
|
91177
|
-
}
|
|
91178
|
-
while (cellQueue.length) {
|
|
91179
|
-
const { max, x, y, h: ch } = cellQueue.pop();
|
|
91180
|
-
if (max - bestCell.d <= precision)
|
|
91181
|
-
break;
|
|
91182
|
-
h = ch / 2;
|
|
91183
|
-
potentiallyQueue(x - h, y - h, h);
|
|
91184
|
-
potentiallyQueue(x + h, y - h, h);
|
|
91185
|
-
potentiallyQueue(x - h, y + h, h);
|
|
91186
|
-
potentiallyQueue(x + h, y + h, h);
|
|
91187
|
-
}
|
|
91188
|
-
if (debug) {
|
|
91189
|
-
console.log(`num probes: ${numProbes}
|
|
91190
|
-
best distance: ${bestCell.d}`);
|
|
91191
|
-
}
|
|
91192
|
-
const result = [bestCell.x, bestCell.y];
|
|
91193
|
-
result.distance = bestCell.d;
|
|
91194
|
-
return result;
|
|
91195
|
-
}
|
|
91196
|
-
function Cell(x, y, h, polygon) {
|
|
91197
|
-
this.x = x;
|
|
91198
|
-
this.y = y;
|
|
91199
|
-
this.h = h;
|
|
91200
|
-
this.d = pointToPolygonDist(x, y, polygon);
|
|
91201
|
-
this.max = this.d + this.h * Math.SQRT2;
|
|
91202
|
-
}
|
|
91203
|
-
function pointToPolygonDist(x, y, polygon) {
|
|
91204
|
-
let inside = false;
|
|
91205
|
-
let minDistSq = Infinity;
|
|
91206
|
-
for (const ring of polygon) {
|
|
91207
|
-
for (let i = 0, len = ring.length, j = len - 1; i < len; j = i++) {
|
|
91208
|
-
const a = ring[i];
|
|
91209
|
-
const b = ring[j];
|
|
91210
|
-
if (a[1] > y !== b[1] > y && x < (b[0] - a[0]) * (y - a[1]) / (b[1] - a[1]) + a[0])
|
|
91211
|
-
inside = !inside;
|
|
91212
|
-
minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b));
|
|
91213
|
-
}
|
|
91214
|
-
}
|
|
91215
|
-
return minDistSq === 0 ? 0 : (inside ? 1 : -1) * Math.sqrt(minDistSq);
|
|
91216
|
-
}
|
|
91217
|
-
function getCentroidCell(polygon) {
|
|
91218
|
-
let area = 0;
|
|
91219
|
-
let x = 0;
|
|
91220
|
-
let y = 0;
|
|
91221
|
-
const points = polygon[0];
|
|
91222
|
-
for (let i = 0, len = points.length, j = len - 1; i < len; j = i++) {
|
|
91223
|
-
const a = points[i];
|
|
91224
|
-
const b = points[j];
|
|
91225
|
-
const f = a[0] * b[1] - b[0] * a[1];
|
|
91226
|
-
x += (a[0] + b[0]) * f;
|
|
91227
|
-
y += (a[1] + b[1]) * f;
|
|
91228
|
-
area += f * 3;
|
|
91229
|
-
}
|
|
91230
|
-
const centroid = new Cell(x / area, y / area, 0, polygon);
|
|
91231
|
-
if (area === 0 || centroid.d < 0)
|
|
91232
|
-
return new Cell(points[0][0], points[0][1], 0, polygon);
|
|
91233
|
-
return centroid;
|
|
91234
|
-
}
|
|
91235
|
-
function getSegDistSq(px, py, a, b) {
|
|
91236
|
-
let x = a[0];
|
|
91237
|
-
let y = a[1];
|
|
91238
|
-
let dx = b[0] - x;
|
|
91239
|
-
let dy = b[1] - y;
|
|
91240
|
-
if (dx !== 0 || dy !== 0) {
|
|
91241
|
-
const t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);
|
|
91242
|
-
if (t > 1) {
|
|
91243
|
-
x = b[0];
|
|
91244
|
-
y = b[1];
|
|
91245
|
-
} else if (t > 0) {
|
|
91246
|
-
x += dx * t;
|
|
91247
|
-
y += dy * t;
|
|
91248
|
-
}
|
|
91249
|
-
}
|
|
91250
|
-
dx = px - x;
|
|
91251
|
-
dy = py - y;
|
|
91252
|
-
return dx * dx + dy * dy;
|
|
91253
|
-
}
|
|
91276
|
+
// src/modify/shared.ts
|
|
91277
|
+
var poly = __toESM(require_polylabel(), 1);
|
|
91254
91278
|
|
|
91255
91279
|
// src/modify/consts.ts
|
|
91256
91280
|
var MajorHighWays = /* @__PURE__ */ new Set([
|
|
@@ -91277,7 +91301,7 @@ var MajorHighWays = /* @__PURE__ */ new Set([
|
|
|
91277
91301
|
]);
|
|
91278
91302
|
|
|
91279
91303
|
// src/modify/shared.ts
|
|
91280
|
-
var
|
|
91304
|
+
var polylabel = poly.default;
|
|
91281
91305
|
function handleRoadFeature(feature, options, logger) {
|
|
91282
91306
|
logger.trace({}, "HandleRoadFeature:Start");
|
|
91283
91307
|
feature = structuredClone(feature);
|
|
@@ -91310,6 +91334,11 @@ function handleRoadFeature(feature, options, logger) {
|
|
|
91310
91334
|
logger.trace({}, "HandleRoadFeature:End");
|
|
91311
91335
|
return feature;
|
|
91312
91336
|
}
|
|
91337
|
+
function getInaccessibilityPole(geometry, logger) {
|
|
91338
|
+
const coordinates = getCoordinates(geometry, logger);
|
|
91339
|
+
const inaccessibilityPole = polylabel(coordinates);
|
|
91340
|
+
return { type: "Point", coordinates: inaccessibilityPole };
|
|
91341
|
+
}
|
|
91313
91342
|
function getCoordinates(geometry, logger) {
|
|
91314
91343
|
switch (geometry.type) {
|
|
91315
91344
|
case "MultiPolygon":
|
|
@@ -91333,10 +91362,7 @@ function handleLayerPois(feature, logger) {
|
|
|
91333
91362
|
}
|
|
91334
91363
|
feature.properties["building"] = bldgUse;
|
|
91335
91364
|
if (feature.geometry.type === "Polygon" || feature.geometry.type === "MultiPolygon") {
|
|
91336
|
-
|
|
91337
|
-
const inaccessibilityPole = polylabel2(coordinates);
|
|
91338
|
-
const point = { type: "Point", coordinates: inaccessibilityPole };
|
|
91339
|
-
feature.geometry = point;
|
|
91365
|
+
feature.geometry = getInaccessibilityPole(feature.geometry, logger);
|
|
91340
91366
|
}
|
|
91341
91367
|
}
|
|
91342
91368
|
logger.trace({}, "HandlePois:End");
|
|
@@ -91358,10 +91384,7 @@ function handleLayerPublicTransport(feature, options, logger) {
|
|
|
91358
91384
|
function handleKindAerodrome(feature, logger) {
|
|
91359
91385
|
logger.trace({}, "HandleKindAerodrome:Start");
|
|
91360
91386
|
feature = structuredClone(feature);
|
|
91361
|
-
|
|
91362
|
-
const inaccessibilityPole = polylabel2(coordinates);
|
|
91363
|
-
const point = { type: "Point", coordinates: inaccessibilityPole };
|
|
91364
|
-
feature.geometry = point;
|
|
91387
|
+
feature.geometry = getInaccessibilityPole(feature.geometry, logger);
|
|
91365
91388
|
logger.trace({}, "HandleKindAerodrome:End");
|
|
91366
91389
|
return feature;
|
|
91367
91390
|
}
|
|
@@ -93211,7 +93234,7 @@ async function upload(file, bucketPath, logger) {
|
|
|
93211
93234
|
if (path4.protocol === "file:")
|
|
93212
93235
|
await (0, import_promises.mkdir)((0, import_path3.dirname)(path4.pathname), { recursive: true });
|
|
93213
93236
|
if (filename.endsWith("catalog.json"))
|
|
93214
|
-
path4 = new URL(filename
|
|
93237
|
+
path4 = new URL(`topographic/${filename}`, bucketPath);
|
|
93215
93238
|
await Fsa.write(path4, stream);
|
|
93216
93239
|
logger.info({ file, path: path4 }, "Load:Finish");
|
|
93217
93240
|
return path4;
|