@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.js CHANGED
@@ -29801,6 +29801,11 @@ function baseInlandWaterLayers(opts = {}) {
29801
29801
  ];
29802
29802
  }
29803
29803
 
29804
+ // src/atlas/tile-number.ts
29805
+ function tileNumber(property, fallback) {
29806
+ return ["to-number", ["coalesce", ["get", property], fallback], fallback];
29807
+ }
29808
+
29804
29809
  // src/atlas/land-layers.ts
29805
29810
  var LAND_SURFACE_MINZOOM = BAND_PRIORITY_RANGES["5"].minzoom;
29806
29811
  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-");
@@ -29867,7 +29872,7 @@ var LAND_THEMES = {
29867
29872
  exaggeration: 0.45
29868
29873
  }
29869
29874
  };
29870
- var FITS = ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]];
29875
+ var FITS = ["<=", tileNumber("min_z", 0), ["zoom"]];
29871
29876
  var ANCHOR = ["coalesce", ["get", "anchor"], "top"];
29872
29877
  var anchorOffset = (em) => [
29873
29878
  "match",
@@ -29903,7 +29908,7 @@ function landLayers(opts = {}) {
29903
29908
  type: "fill",
29904
29909
  source: src,
29905
29910
  "source-layer": "land_cover",
29906
- filter: ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]],
29911
+ filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
29907
29912
  paint: {
29908
29913
  "fill-color": [
29909
29914
  "match",
@@ -29938,10 +29943,10 @@ function landLayers(opts = {}) {
29938
29943
  }
29939
29944
  const isIndexContour = [
29940
29945
  "any",
29941
- ["<=", ["coalesce", ["get", "index_z"], 99], ["zoom"]],
29942
- ["==", ["get", "is_index"], 1]
29946
+ ["<=", tileNumber("index_z", 99), ["zoom"]],
29947
+ ["==", tileNumber("is_index", 0), 1]
29943
29948
  ];
29944
- const contourVisible = ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]];
29949
+ const contourVisible = ["<=", tileNumber("min_z", 0), ["zoom"]];
29945
29950
  layers.push(L({
29946
29951
  id: "chrtland-contour-index",
29947
29952
  type: "line",
@@ -29971,7 +29976,7 @@ function landLayers(opts = {}) {
29971
29976
  type: "fill",
29972
29977
  source: src,
29973
29978
  "source-layer": "land_water",
29974
- filter: ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]],
29979
+ filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
29975
29980
  paint: { "fill-color": inlandWaterColor(palette) }
29976
29981
  }));
29977
29982
  const d = FADE_PX / 2 / FADE_BANDS;
@@ -30012,7 +30017,7 @@ function landLayers(opts = {}) {
30012
30017
  source: src,
30013
30018
  "source-layer": "land_town",
30014
30019
  minzoom: 6.5,
30015
- filter: [">=", ["coalesce", ["get", "prank"], 0], 10],
30020
+ filter: [">=", tileNumber("prank", 0), 10],
30016
30021
  layout: {
30017
30022
  "text-field": [
30018
30023
  "case",
@@ -30028,16 +30033,16 @@ function landLayers(opts = {}) {
30028
30033
  6.5,
30029
30034
  11.5,
30030
30035
  9,
30031
- ["+", 10, ["*", 0.4, ["coalesce", ["get", "prank"], 10]]],
30036
+ ["+", 10, ["*", 0.4, tileNumber("prank", 10)]],
30032
30037
  13,
30033
- ["+", 13, ["*", 0.5, ["coalesce", ["get", "prank"], 10]]]
30038
+ ["+", 13, ["*", 0.5, tileNumber("prank", 10)]]
30034
30039
  ],
30035
30040
  "text-letter-spacing": ["case", ["==", ["get", "upcase"], true], 0.14, 0.02],
30036
30041
  "text-offset": anchorOffset(0.75),
30037
30042
  "text-anchor": ANCHOR,
30038
30043
  "text-padding": 10,
30039
30044
  "text-allow-overlap": false,
30040
- "symbol-sort-key": ["*", -1, ["coalesce", ["get", "pop"], 0]]
30045
+ "symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
30041
30046
  },
30042
30047
  paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.6 }
30043
30048
  }));
@@ -30050,7 +30055,7 @@ function landLayers(opts = {}) {
30050
30055
  filter: [
30051
30056
  "all",
30052
30057
  ["==", ["get", "enc_dup"], true],
30053
- ["<", ["coalesce", ["get", "prank"], 0], 10]
30058
+ ["<", tileNumber("prank", 0), 10]
30054
30059
  ],
30055
30060
  layout: {
30056
30061
  "text-field": ["get", "name"],
@@ -30062,7 +30067,7 @@ function landLayers(opts = {}) {
30062
30067
  "text-allow-overlap": false,
30063
30068
  // Within the tier, the bigger place wins the space: without this the
30064
30069
  // tie broke on data order and "West Gloucester" beat Gloucester.
30065
- "symbol-sort-key": ["*", -1, ["coalesce", ["get", "pop"], 0]]
30070
+ "symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
30066
30071
  },
30067
30072
  paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.4 }
30068
30073
  }));
@@ -30075,7 +30080,7 @@ function landLayers(opts = {}) {
30075
30080
  filter: [
30076
30081
  "all",
30077
30082
  FITS,
30078
- ["<", ["coalesce", ["get", "prank"], 0], 10],
30083
+ ["<", tileNumber("prank", 0), 10],
30079
30084
  ["!=", ["get", "enc_dup"], true]
30080
30085
  ],
30081
30086
  layout: {
@@ -30102,7 +30107,7 @@ function landLayers(opts = {}) {
30102
30107
  source: src,
30103
30108
  "source-layer": "land_summit",
30104
30109
  minzoom: 11.5,
30105
- filter: ["all", FITS, [">=", ["get", "peak_m"], 40]],
30110
+ filter: ["all", FITS, [">=", tileNumber("peak_m", 0), 40]],
30106
30111
  layout: {
30107
30112
  "text-field": ["concat", ["get", "name"], "\n", ["to-string", ["get", "peak_m"]], " m"],
30108
30113
  "text-font": FONT,