@chrtco/sdk 0.10.44 → 0.10.45

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 CHANGED
@@ -30073,6 +30073,11 @@ function baseInlandWaterLayers(opts = {}) {
30073
30073
  ];
30074
30074
  }
30075
30075
 
30076
+ // src/atlas/tile-number.ts
30077
+ function tileNumber(property, fallback) {
30078
+ return ["to-number", ["coalesce", ["get", property], fallback], fallback];
30079
+ }
30080
+
30076
30081
  // src/atlas/land-layers.ts
30077
30082
  var LAND_SURFACE_MINZOOM = BAND_PRIORITY_RANGES["5"].minzoom;
30078
30083
  var LAND_SURFACE_LAYERS = (id) => id === "chrtland-base" || id === "chrtland-cover" || id.startsWith("chrtland-contour") || id === "chrtland-hillshade" || id === "chrtland-water" || id.startsWith("chrtland-fade-");
@@ -30139,7 +30144,7 @@ var LAND_THEMES = {
30139
30144
  exaggeration: 0.45
30140
30145
  }
30141
30146
  };
30142
- var FITS = ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]];
30147
+ var FITS = ["<=", tileNumber("min_z", 0), ["zoom"]];
30143
30148
  var ANCHOR = ["coalesce", ["get", "anchor"], "top"];
30144
30149
  var anchorOffset = (em) => [
30145
30150
  "match",
@@ -30175,7 +30180,7 @@ function landLayers(opts = {}) {
30175
30180
  type: "fill",
30176
30181
  source: src,
30177
30182
  "source-layer": "land_cover",
30178
- filter: ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]],
30183
+ filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
30179
30184
  paint: {
30180
30185
  "fill-color": [
30181
30186
  "match",
@@ -30210,10 +30215,10 @@ function landLayers(opts = {}) {
30210
30215
  }
30211
30216
  const isIndexContour = [
30212
30217
  "any",
30213
- ["<=", ["coalesce", ["get", "index_z"], 99], ["zoom"]],
30214
- ["==", ["get", "is_index"], 1]
30218
+ ["<=", tileNumber("index_z", 99), ["zoom"]],
30219
+ ["==", tileNumber("is_index", 0), 1]
30215
30220
  ];
30216
- const contourVisible = ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]];
30221
+ const contourVisible = ["<=", tileNumber("min_z", 0), ["zoom"]];
30217
30222
  layers.push(L({
30218
30223
  id: "chrtland-contour-index",
30219
30224
  type: "line",
@@ -30243,7 +30248,7 @@ function landLayers(opts = {}) {
30243
30248
  type: "fill",
30244
30249
  source: src,
30245
30250
  "source-layer": "land_water",
30246
- filter: ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]],
30251
+ filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
30247
30252
  paint: { "fill-color": inlandWaterColor(palette) }
30248
30253
  }));
30249
30254
  const d = FADE_PX / 2 / FADE_BANDS;
@@ -30284,7 +30289,7 @@ function landLayers(opts = {}) {
30284
30289
  source: src,
30285
30290
  "source-layer": "land_town",
30286
30291
  minzoom: 6.5,
30287
- filter: [">=", ["coalesce", ["get", "prank"], 0], 10],
30292
+ filter: [">=", tileNumber("prank", 0), 10],
30288
30293
  layout: {
30289
30294
  "text-field": [
30290
30295
  "case",
@@ -30300,16 +30305,16 @@ function landLayers(opts = {}) {
30300
30305
  6.5,
30301
30306
  11.5,
30302
30307
  9,
30303
- ["+", 10, ["*", 0.4, ["coalesce", ["get", "prank"], 10]]],
30308
+ ["+", 10, ["*", 0.4, tileNumber("prank", 10)]],
30304
30309
  13,
30305
- ["+", 13, ["*", 0.5, ["coalesce", ["get", "prank"], 10]]]
30310
+ ["+", 13, ["*", 0.5, tileNumber("prank", 10)]]
30306
30311
  ],
30307
30312
  "text-letter-spacing": ["case", ["==", ["get", "upcase"], true], 0.14, 0.02],
30308
30313
  "text-offset": anchorOffset(0.75),
30309
30314
  "text-anchor": ANCHOR,
30310
30315
  "text-padding": 10,
30311
30316
  "text-allow-overlap": false,
30312
- "symbol-sort-key": ["*", -1, ["coalesce", ["get", "pop"], 0]]
30317
+ "symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
30313
30318
  },
30314
30319
  paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.6 }
30315
30320
  }));
@@ -30322,7 +30327,7 @@ function landLayers(opts = {}) {
30322
30327
  filter: [
30323
30328
  "all",
30324
30329
  ["==", ["get", "enc_dup"], true],
30325
- ["<", ["coalesce", ["get", "prank"], 0], 10]
30330
+ ["<", tileNumber("prank", 0), 10]
30326
30331
  ],
30327
30332
  layout: {
30328
30333
  "text-field": ["get", "name"],
@@ -30334,7 +30339,7 @@ function landLayers(opts = {}) {
30334
30339
  "text-allow-overlap": false,
30335
30340
  // Within the tier, the bigger place wins the space: without this the
30336
30341
  // tie broke on data order and "West Gloucester" beat Gloucester.
30337
- "symbol-sort-key": ["*", -1, ["coalesce", ["get", "pop"], 0]]
30342
+ "symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
30338
30343
  },
30339
30344
  paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.4 }
30340
30345
  }));
@@ -30347,7 +30352,7 @@ function landLayers(opts = {}) {
30347
30352
  filter: [
30348
30353
  "all",
30349
30354
  FITS,
30350
- ["<", ["coalesce", ["get", "prank"], 0], 10],
30355
+ ["<", tileNumber("prank", 0), 10],
30351
30356
  ["!=", ["get", "enc_dup"], true]
30352
30357
  ],
30353
30358
  layout: {
@@ -30374,7 +30379,7 @@ function landLayers(opts = {}) {
30374
30379
  source: src,
30375
30380
  "source-layer": "land_summit",
30376
30381
  minzoom: 11.5,
30377
- filter: ["all", FITS, [">=", ["get", "peak_m"], 40]],
30382
+ filter: ["all", FITS, [">=", tileNumber("peak_m", 0), 40]],
30378
30383
  layout: {
30379
30384
  "text-field": ["concat", ["get", "name"], "\n", ["to-string", ["get", "peak_m"]], " m"],
30380
30385
  "text-font": FONT,