@chrtco/sdk 0.10.36 → 0.10.38
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/dist/index.cjs +177 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +177 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -368,7 +368,7 @@ var BASE_REGION = "CHRT_BASE";
|
|
|
368
368
|
var BASE_MINZOOM = 0;
|
|
369
369
|
var BASE_MAXZOOM = 11;
|
|
370
370
|
var RELIEF_MINZOOM = 9;
|
|
371
|
-
var RELIEF_MAXZOOM =
|
|
371
|
+
var RELIEF_MAXZOOM = 13;
|
|
372
372
|
var RELIEF_TILE_SIZE = 512;
|
|
373
373
|
var BUILD_PARAM = "v";
|
|
374
374
|
function tileTemplate(base, region, extension, buildId) {
|
|
@@ -24353,6 +24353,23 @@ function buildPlaceNameLayers(sourceId) {
|
|
|
24353
24353
|
}
|
|
24354
24354
|
var DRGNOTE_SOURCE_LAYER = "DRGNOTE";
|
|
24355
24355
|
var DRGNOTE_LABEL_PRIORITY = 300;
|
|
24356
|
+
var BRGNOTE_SOURCE_LAYER = "BRGNOTE";
|
|
24357
|
+
var BRGNOTE_MINZOOM = 13;
|
|
24358
|
+
var BRGNOTE_LABEL_PRIORITY = 320;
|
|
24359
|
+
var BRGNOTE_CATBRG_TEXT = {
|
|
24360
|
+
"1": "FIXED BRIDGE",
|
|
24361
|
+
"2": "OPENING BRIDGE",
|
|
24362
|
+
"3": "SWING BRIDGE",
|
|
24363
|
+
"4": "VERT LIFT BRIDGE",
|
|
24364
|
+
"5": "BASCULE BRIDGE",
|
|
24365
|
+
"6": "PONTOON BRIDGE",
|
|
24366
|
+
"7": "DRAW BRIDGE",
|
|
24367
|
+
"8": "TRANSPORTER BRIDGE",
|
|
24368
|
+
"9": "FOOTBRIDGE",
|
|
24369
|
+
"10": "VIADUCT",
|
|
24370
|
+
"11": "AQUEDUCT",
|
|
24371
|
+
"12": "SUSPENSION BRIDGE"
|
|
24372
|
+
};
|
|
24356
24373
|
var DRGNOTE_MINZOOM = 13;
|
|
24357
24374
|
var DRGNOTE_FULL_ZOOM = 16;
|
|
24358
24375
|
var DRGNOTE_MIN_TEXT_PX = 1;
|
|
@@ -24542,6 +24559,147 @@ function buildDredgeNoteLayers(sourceId, palette = "DAY", depthUnits = "meters")
|
|
|
24542
24559
|
}
|
|
24543
24560
|
];
|
|
24544
24561
|
}
|
|
24562
|
+
function buildBridgeNoteLayers(sourceId, palette = "DAY", depthUnits = "meters") {
|
|
24563
|
+
const imperial = depthUnits === "feet";
|
|
24564
|
+
const unit = imperial ? " FT" : " M";
|
|
24565
|
+
const measure = (prop) => imperial ? [
|
|
24566
|
+
"concat",
|
|
24567
|
+
["to-string", ["floor", ["+", 0.5, ["*", 3.28084, ["to-number", ["get", prop]]]]]],
|
|
24568
|
+
unit
|
|
24569
|
+
] : [
|
|
24570
|
+
"concat",
|
|
24571
|
+
["to-string", ["/", ["floor", ["+", 0.5, ["*", 10, ["to-number", ["get", prop]]]]], 10]],
|
|
24572
|
+
unit
|
|
24573
|
+
];
|
|
24574
|
+
const clearance = (prop, prefix, suffix = "") => [
|
|
24575
|
+
"case",
|
|
24576
|
+
[
|
|
24577
|
+
"all",
|
|
24578
|
+
["!", ["get", "conflict"]],
|
|
24579
|
+
["!=", ["to-string", ["get", prop]], ""]
|
|
24580
|
+
],
|
|
24581
|
+
["concat", "\n", prefix, measure(prop), suffix],
|
|
24582
|
+
""
|
|
24583
|
+
];
|
|
24584
|
+
const clearances = [
|
|
24585
|
+
"concat",
|
|
24586
|
+
clearance("horclr_m", "HOR CL "),
|
|
24587
|
+
clearance("verclr_m", "VERT CL "),
|
|
24588
|
+
clearance("verccl_m", "VERT CL ", " DOWN"),
|
|
24589
|
+
clearance("vercop_m", "VERT CL ", " UP"),
|
|
24590
|
+
clearance("cable_m", "OVHD PWR CAB AUTH CL ")
|
|
24591
|
+
];
|
|
24592
|
+
const typeText = [
|
|
24593
|
+
"match",
|
|
24594
|
+
["to-string", ["get", "cat"]],
|
|
24595
|
+
...Object.entries(BRGNOTE_CATBRG_TEXT).flatMap(([k, v]) => [k, v]),
|
|
24596
|
+
"BRIDGE"
|
|
24597
|
+
];
|
|
24598
|
+
const fullName = ["upcase", ["to-string", ["coalesce", ["get", "name"], ""]]];
|
|
24599
|
+
const shortName = [
|
|
24600
|
+
"let",
|
|
24601
|
+
"n",
|
|
24602
|
+
fullName,
|
|
24603
|
+
[
|
|
24604
|
+
"case",
|
|
24605
|
+
[">", ["index-of", " ", ["var", "n"]], 0],
|
|
24606
|
+
["slice", ["var", "n"], 0, ["index-of", " ", ["var", "n"]]],
|
|
24607
|
+
["var", "n"]
|
|
24608
|
+
]
|
|
24609
|
+
];
|
|
24610
|
+
const named = (which) => [
|
|
24611
|
+
"case",
|
|
24612
|
+
[">", ["length", ["to-string", ["coalesce", ["get", "name"], ""]]], 0],
|
|
24613
|
+
["concat", which, "\n", typeText, clearances],
|
|
24614
|
+
["concat", typeText, clearances]
|
|
24615
|
+
];
|
|
24616
|
+
const alone = (body) => [
|
|
24617
|
+
"let",
|
|
24618
|
+
"b",
|
|
24619
|
+
body,
|
|
24620
|
+
[
|
|
24621
|
+
"case",
|
|
24622
|
+
["==", ["slice", ["var", "b"], 0, 1], "\n"],
|
|
24623
|
+
["slice", ["var", "b"], 1],
|
|
24624
|
+
["var", "b"]
|
|
24625
|
+
]
|
|
24626
|
+
];
|
|
24627
|
+
const noteField = [
|
|
24628
|
+
"step",
|
|
24629
|
+
["to-number", ["coalesce", ["get", "rung"], 0]],
|
|
24630
|
+
named(fullName),
|
|
24631
|
+
// rung 0
|
|
24632
|
+
1,
|
|
24633
|
+
named(shortName),
|
|
24634
|
+
// rung 1
|
|
24635
|
+
2,
|
|
24636
|
+
["concat", typeText, clearances],
|
|
24637
|
+
3,
|
|
24638
|
+
alone(clearances),
|
|
24639
|
+
4,
|
|
24640
|
+
alone([
|
|
24641
|
+
"concat",
|
|
24642
|
+
clearance("verclr_m", "VERT CL "),
|
|
24643
|
+
clearance("verccl_m", "VERT CL ", " DOWN"),
|
|
24644
|
+
clearance("vercop_m", "VERT CL ", " UP")
|
|
24645
|
+
])
|
|
24646
|
+
];
|
|
24647
|
+
return [
|
|
24648
|
+
{
|
|
24649
|
+
id: "chrt-bridge-note-label",
|
|
24650
|
+
type: "symbol",
|
|
24651
|
+
source: sourceId,
|
|
24652
|
+
"source-layer": BRGNOTE_SOURCE_LAYER,
|
|
24653
|
+
minzoom: BRGNOTE_MINZOOM,
|
|
24654
|
+
layout: {
|
|
24655
|
+
"text-field": noteField,
|
|
24656
|
+
"text-font": ["Open Sans Regular"],
|
|
24657
|
+
// Fitted at build time against the land the note has to sit on, in px
|
|
24658
|
+
// at z15, then doubled per zoom — the same geographic sizing DRGNOTE
|
|
24659
|
+
// uses, and for the same reason: a note that keeps its proportion to
|
|
24660
|
+
// its own bridge is how the eye tells which crossing it describes.
|
|
24661
|
+
//
|
|
24662
|
+
// The zoom test is the DIRECT input of this interpolate. Nested any
|
|
24663
|
+
// deeper it is invalid in a paint or layout property and MapLibre
|
|
24664
|
+
// drops the whole layer, silently — which is exactly how CHRTland's
|
|
24665
|
+
// contours went unrendered on every client (see zoom-expression-guard).
|
|
24666
|
+
"text-size": [
|
|
24667
|
+
"interpolate",
|
|
24668
|
+
["exponential", 2],
|
|
24669
|
+
["zoom"],
|
|
24670
|
+
15,
|
|
24671
|
+
["to-number", ["coalesce", ["get", imperial ? "size_ft" : "size_m"], 4]],
|
|
24672
|
+
16,
|
|
24673
|
+
["*", 2, ["to-number", ["coalesce", ["get", imperial ? "size_ft" : "size_m"], 4]]]
|
|
24674
|
+
],
|
|
24675
|
+
"text-transform": "uppercase",
|
|
24676
|
+
"text-letter-spacing": 0.08,
|
|
24677
|
+
"text-line-height": 1.2,
|
|
24678
|
+
// Every break here is an explicit "\n" this expression chose. A wrap
|
|
24679
|
+
// on top of that would re-flow lines nothing measured.
|
|
24680
|
+
"text-max-width": 512,
|
|
24681
|
+
// NOT rotated. A dredge note lies along its channel because the
|
|
24682
|
+
// channel has a direction; a bridge note sits on the bank and reads
|
|
24683
|
+
// horizontally, as the paper chart sets it.
|
|
24684
|
+
"text-anchor": "center",
|
|
24685
|
+
"text-padding": 3,
|
|
24686
|
+
"text-allow-overlap": false,
|
|
24687
|
+
"text-ignore-placement": false,
|
|
24688
|
+
"text-optional": true
|
|
24689
|
+
},
|
|
24690
|
+
paint: {
|
|
24691
|
+
"text-color": resolveColor("CHBLK", palette),
|
|
24692
|
+
// Haloed against the land tint it sits on, not the water.
|
|
24693
|
+
"text-halo-color": resolveColor("LANDA", palette),
|
|
24694
|
+
"text-halo-width": 1
|
|
24695
|
+
},
|
|
24696
|
+
metadata: {
|
|
24697
|
+
"chrt:bridgeNote": true,
|
|
24698
|
+
"chrt:labelPriority": BRGNOTE_LABEL_PRIORITY
|
|
24699
|
+
}
|
|
24700
|
+
}
|
|
24701
|
+
];
|
|
24702
|
+
}
|
|
24545
24703
|
|
|
24546
24704
|
// src/atlas/feature-decimation.ts
|
|
24547
24705
|
function getGridSizeForZoom(zoom) {
|
|
@@ -30122,6 +30280,15 @@ function generateStyle(palette = "DAY", opts = {}) {
|
|
|
30122
30280
|
),
|
|
30123
30281
|
DRGNOTE_LABEL_PRIORITY
|
|
30124
30282
|
);
|
|
30283
|
+
spliceByLabelPriority(
|
|
30284
|
+
labelLayers,
|
|
30285
|
+
buildBridgeNoteLayers(
|
|
30286
|
+
sourceId,
|
|
30287
|
+
palette,
|
|
30288
|
+
opts.depthUnits ?? "meters"
|
|
30289
|
+
),
|
|
30290
|
+
BRGNOTE_LABEL_PRIORITY
|
|
30291
|
+
);
|
|
30125
30292
|
layers.push(...labelLayers);
|
|
30126
30293
|
} else {
|
|
30127
30294
|
const emitBand = (base, code) => bandFan === "legacy" ? makeBandVariants(base, code) : makeCollapsedBandVariant(base, code, isDominanceExempt(base));
|
|
@@ -30218,6 +30385,15 @@ function generateStyle(palette = "DAY", opts = {}) {
|
|
|
30218
30385
|
),
|
|
30219
30386
|
DRGNOTE_LABEL_PRIORITY
|
|
30220
30387
|
);
|
|
30388
|
+
spliceByLabelPriority(
|
|
30389
|
+
labelLayers,
|
|
30390
|
+
buildBridgeNoteLayers(
|
|
30391
|
+
sourceId,
|
|
30392
|
+
palette,
|
|
30393
|
+
opts.depthUnits ?? "meters"
|
|
30394
|
+
),
|
|
30395
|
+
BRGNOTE_LABEL_PRIORITY
|
|
30396
|
+
);
|
|
30221
30397
|
layers.push(...labelLayers);
|
|
30222
30398
|
}
|
|
30223
30399
|
const symbolSet = opts.symbolSet ?? "s52";
|