@johnmorrisdotca/chikyu-earth 0.46.2 → 0.46.4

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.46.4 - 2026-11-13
4
+
5
+ - **Cloud-free ground from NASA's Landsat mosaic** (MODULES-1263). `tiles-finer="gibs"` now reads NASA's Landsat annual true-colour mosaic (`Landsat_WELD_CorrectedReflectance_TrueColor_Global_Annual`, 30 m, no cloud, land only, the year 2000) instead of a daily picture, which was often solid cloud over the ground. It is off unless a page sets it. Streets, fields and rivers show at 150 km where our level 5 is a blur. The daily MODIS Terra picture stays as `tiles-finer-layer="today"`; `landsat` is the default's short name. The mosaic has one picture a year, so no day is searched for; `tiles-finer-date` names another year it has (1984, 1985, 1988 to 1990, 1998, 1999). Where it has no data (the oceans, Antarctica, the far north, a tile that is all black) our own tiles stay, silently. Tiles now carry transparency: black and nearly black pixels (no data, and the mosaic's sea) are clear, so our blue sea and our picture show through, and a daily picture's black wedges between passes are no longer drawn black. The colours are brought to the look of our own pictures by a gain fitted over six places on land (0.76, 0.66, 0.55), so the finer land does not look like a sticker. The credit line adds the Landsat data's own line. The grid support takes the 31.25 m matrix (levels 0 to 11). It is old (2000) and made of separate scenes, so a straight scene edge shows here and there.
6
+
3
7
  ## 0.46.2 - 2026-11-13
4
8
 
5
9
  - **Finer than the package's own tiles, from NASA's imagery service** (MODULES-1263, step 2). `tiles-finer="gibs"` on `<chikyu-earth-realistic>` and `<chikyu-space>` (off unless set) reads a daily true-colour picture in the browser, and only when the view is closer than the tiles already underneath. The layer is MODIS Terra (the VIIRS layer has no days after 2026-11-02), and the day is the most recent one with a picture: the page asks for one tile, the one under the middle of the view, for each day in turn from the UTC day before the one on show back at most 10 days, one at a time, and keeps the answer for the session; if no day answers it says nothing and keeps the package's own tiles, and it never fetches the capabilities file. A day before the layer's first day asks nothing. The clouds are left in, and a daily picture has black wedges between satellite passes: a wholly black tile is not shown, a partly black one is. A page can name the layer and the day rule (`latest`, the default, `previous-day`, `shown` or one day). A tile that is missing, black, or still out after two seconds stays out, the coarser picture remains, and that tile is not asked for again while it is in view. The 48 tile and 72 MB limits, and six requests at a time, are unchanged. A tile fades in over a third of a second, or at once for a reader who asked for less motion, and then nothing is drawn for it. The credit line shows NASA's acknowledgement while those tiles are on screen. `gibsTiles` is the same source from `@johnmorrisdotca/chikyu-earth/door`. A map source may now name its own grid; the package's own folder is unchanged.
package/NOTICE.md CHANGED
@@ -76,7 +76,7 @@ The service's page "Data Use Guidance and Acknowledgements" (https://www.earthda
76
76
 
77
77
  The tile matrix was read the same day from `https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/1.0.0/WMTSCapabilities.xml`. Geographic tiles are 512 pixels, the corner of the matrix is longitude -180 and latitude 90, and a pixel is 0.5625/2^level degrees. Levels 0, 1 and 2 run past the Earth (2×1, 3×2 and 5×3 tiles); from level 3 the matrix covers the Earth in 10×5 tiles and doubles from there. A successful tile for the static shaded-relief layer answered `access-control-allow-origin: *` and `cache-control: public, max-age=259200`. A successful tile for a daily true-colour layer on the same day answered `access-control-allow-origin: *` and `cache-control: max-age=0, no-store`. No key is sent.
78
78
 
79
- The default layer is `MODIS_Terra_CorrectedReflectance_TrueColor` (250 m, JPEG), whose days in that document run from 2000-02-24 to 2026-11-13 with gaps; the page looks for the most recent day that answers with a picture, from the day before the moment on show back at most 10 days, one tile a day (checked against the live service on 2026-11-13: 2026-11-13 answered 200 with an all-black picture, 2026-11-12 and 2026-11-11 with pictures; the daily tiles answer `cache-control: max-age=0, no-store, no-cache, must-revalidate` and `access-control-allow-origin: *`, and carry `layer-time-actual`). `VIIRS_SNPP_CorrectedReflectance_TrueColor` has days from 2015-11-24 to 2026-11-02 with gaps. `BlueMarble_ShadedRelief_Bathymetry` (500 m) has no day. A day before the first day, or in a gap of the list that was read, is not requested; a day after the last listed day is, because a daily layer goes on growing. The daily layers are true colour with the clouds left in, and a day's picture has black gaps between passes.
79
+ The default layer is `Landsat_WELD_CorrectedReflectance_TrueColor_Global_Annual` (NASA GWELDYR, "NASA Global Web-Enabled Landsat Data Annual Global 30 m V031", LP DAAC, concept id C2763268459-LPCLOUD; 31.25m matrix, JPEG, levels 0 to 11, a picture a year: 1984 to 1985, 1988 to 1990 and 1998 to 2000, the page uses 2000-12-01). Checked against the live service on 2026-11-13, with a few requests each: tiles answer 200 with `content-type: image/jpeg`, `cache-control: public, max-age=2592000`, `access-control-allow-origin: *`, `layer-time-actual: 2000-12-01T00:00:00Z`; the tile addresses are the ones this package's grid names (Vancouver level 9 row 72 column 101, level 10 row 144 column 202, level 11 row 289 column 404; Tokyo 9/96/568; Paris 10/146/648; the Sahara 9/115/337). Coverage as seen: land at 49 N, 35 N, 25 N and in the Amazon; no data (a 200 with an all-black, 4,723-byte picture, the same as a daily layer's) over the Pacific, Antarctica, Greenland at 72 N, Svalbard at 78 N and at the pole. The picture is cloud-free and sharp (streets and fields at level 9) but of the year 2000, and straight scene edges show in places (for example west of Tokyo). The page treats a wholly black tile as no picture, clears black and nearly black pixels (luminance up to 20 clear, from 32 opaque: the sea in the mosaic is about (7, 25, 12) and a dark wooded slope (8, 39, 6) to (22, 54, 7)), and multiplies the colours by 0.76, 0.66 and 0.55: the median, over six land places (Paris, the Sahara, the Amazon, Kansas, Siberia, Australia), of the package's own level 5 over this layer's mean colour in the same 2.25 degree square (0.75 0.77 0.77 0.70 0.81 0.68 red, 0.65 0.71 0.70 0.61 0.61 0.56 green, 0.53 0.64 0.59 0.51 0.54 0.53 blue). Layer-specific credit: NASA's acknowledgement is the one the data-use page asks for; the layer's metadata names the product and its data centre only, so the credit line names the Global Web-Enabled Landsat Data and LP DAAC as well. Other layers checked and not used as the default: `ASTER_GDEM_Color_Shaded_Relief` (31.25m, colour-coded height, not true colour); `MODIS_Terra_L3_SurfaceReflectance_Bands143_8Day` (500 m, an 8-day true-colour composite, speckled with cloud); `HLS_S30_Nadir_BRDF_Adjusted_Reflectance` and the L30 twin (31.25m daily scenes, 600 KB PNG tiles, solid cloud over Paris on 2026-11-05); `BlueMarble_NextGeneration` (500 m, the package's own source); no Blue Marble at 250 m exists on the service. `MODIS_Terra_CorrectedReflectance_TrueColor` (250 m, JPEG, days 2000-02-24 to 2026-11-13 with gaps; the name `today`): the page looks for the most recent day that answers with a picture, from the day before the moment on show back at most 10 days, one tile a day (2026-11-13 answered 200 with an all-black picture, 2026-11-12 and 2026-11-11 with pictures; the daily tiles answer `cache-control: max-age=0, no-store, no-cache, must-revalidate` and `access-control-allow-origin: *`, and carry `layer-time-actual`). `VIIRS_SNPP_CorrectedReflectance_TrueColor` has days from 2015-11-24 to 2026-11-02 with gaps. `BlueMarble_ShadedRelief_Bathymetry` (500 m) has no day. A daily layer's day before its first day, or in a gap of the list that was read, is not requested; a day after the last listed day is, because a daily layer goes on growing. The daily layers are true colour with the clouds left in, and a day's picture has black gaps between passes, which the page clears.
80
80
 
81
81
  The 500 m maps could fill one more level (65536 across for the day map); the pyramid stops at level 5 (day) and level 4 (night) for now. Where the pyramid is hosted: GitHub Pages of this public repository, which costs nothing (docs/guides/earth-tiles.md). It adds 3,412 files and 35.4 MB to the site (852 files and 10.3 MB before the 500 m levels; the levels above day 4 and night 3 go out only when the repository variable EARTH_TILES_ALL is yes, see docs/guides/earth-tiles.md). The source files are downloaded by the build (688 MB, once, kept by CI's cache) and are not part of the site.
82
82
 
package/README.md CHANGED
@@ -611,7 +611,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
611
611
 
612
612
  ## How to cite
613
613
 
614
- > Morris, J. (2026). *Chikyu Earth* (version 0.46.2) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
614
+ > Morris, J. (2026). *Chikyu Earth* (version 0.46.4) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
615
615
 
616
616
  GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
617
617
 
@@ -44,19 +44,37 @@ interface DayRange {
44
44
  }
45
45
  interface GibsLayer {
46
46
  id: string;
47
- matrix: "250m" | "500m";
48
- /** Empty for a picture that has no day (the shaded relief). */
47
+ matrix: "31.25m" | "250m" | "500m";
48
+ /** Empty for a picture that has no day (the shaded relief, and the annual Landsat mosaics, which have `years`). */
49
49
  ranges: readonly DayRange[];
50
50
  /** True when the picture is one day of the satellite and clouds are left in. */
51
51
  clouds: boolean;
52
+ /** For a layer with one picture a year: the years' times, as the service names them (`yyyy-mm-dd`), oldest first. The newest is the one used unless a page names another of them. */
53
+ years?: readonly string[];
54
+ /**
55
+ * For a layer that shows water as nearly black (the Landsat mosaics): the luminance (0 to 255) below which a pixel is clear and from which it is opaque, so the sea is left to the package's blue ocean and the picture is a land picture. Left out, only the black of no data is cleared (`NODATA_BELOW` and `NODATA_FULL`).
56
+ */
57
+ clear?: readonly [number, number];
58
+ /** Multiplies each colour, to bring the picture to the look of the package's own pictures (found by comparing them over land, see NOTICE.md). */
59
+ gain?: readonly [number, number, number];
60
+ /** A sentence about the layer's own data, added to NASA's acknowledgement while its tiles are on the screen. */
61
+ credit?: {
62
+ en: string;
63
+ ja: string;
64
+ };
52
65
  }
53
66
  /**
54
67
  * The layers a page may ask for. The ranges are the days the capabilities document listed on 2026-11-13; a day outside them is not requested.
55
68
  * The two daily layers are true colour with the clouds left in. The shaded relief is the same kind of picture as the package's own level 5, and is only a stand-in.
56
69
  */
57
70
  export declare const GIBS_LAYERS: Readonly<Record<string, GibsLayer>>;
58
- /** The layer a page gets without naming one: MODIS Terra true colour, whose days run to the present (the VIIRS layer's lagged days behind by ten days or more when this was read). */
59
- export declare const GIBS_DEFAULT_LAYER = "MODIS_Terra_CorrectedReflectance_TrueColor";
71
+ /**
72
+ * The layer a page gets without naming one: the Landsat annual true-colour mosaic (30 m, no cloud, land only; the year 2000, the newest it has). The daily layers are a named choice: `today` for MODIS Terra.
73
+ * A layer id is taken as it is, and these short names stand for two of them.
74
+ */
75
+ export declare const GIBS_DEFAULT_LAYER = "Landsat_WELD_CorrectedReflectance_TrueColor_Global_Annual";
76
+ /** The short names `tiles-finer-layer` takes besides a layer's own id: `landsat` (the default) and `today` (the daily picture of MODIS Terra, with its clouds). */
77
+ export declare const GIBS_NAMES: Readonly<Record<string, string>>;
60
78
  /** How many days, counting the first, the default rule looks back for a day with imagery. */
61
79
  export declare const GIBS_LOOKBACK_DAYS = 10;
62
80
  /**
@@ -133,7 +151,16 @@ export interface GibsTilesOptions extends EarthTilesOptions {
133
151
  date?: string;
134
152
  /** Called when the default rule has found its day, so the view draws again and asks for the tiles. */
135
153
  changed?: () => void;
154
+ /** How many milliseconds a tile is given to arrive (`GIBS_SLOW_MS`, 2000, when left out). A page on a slow link can give it longer. */
155
+ slowMs?: number;
136
156
  }
157
+ /**
158
+ * Where a tile's luminance (0 to 255) is at or below this, the picture has no data there (the service paints it black) and the loader draws it clear; from `NODATA_FULL` it is opaque, and between the two a share, so the edge of a gap is not a hard
159
+ * black line. A layer may set its own limits (`clear`).
160
+ */
161
+ export declare const NODATA_BELOW = 3;
162
+ /** The luminance from which a pixel is wholly opaque (see `NODATA_BELOW`). */
163
+ export declare const NODATA_FULL = 14;
137
164
  /**
138
165
  * A map source that reads NASA's imagery service directly. It declares its own grid (512 pixel tiles, the Geographic matrix, which is not the package's pyramid). `need` names no tile for a day outside the layer's range.
139
166
  * `load` gives a tile two seconds, and treats a 404 or an all-black tile as no imagery. The clouds are not taken out of the daily layers.
package/dist/door/gibs.js CHANGED
@@ -53,6 +53,22 @@ const INFO = {
53
53
  * The two daily layers are true colour with the clouds left in. The shaded relief is the same kind of picture as the package's own level 5, and is only a stand-in.
54
54
  */
55
55
  export const GIBS_LAYERS = {
56
+ Landsat_WELD_CorrectedReflectance_TrueColor_Global_Annual: {
57
+ id: "Landsat_WELD_CorrectedReflectance_TrueColor_Global_Annual",
58
+ matrix: "31.25m",
59
+ clouds: false,
60
+ ranges: [],
61
+ // as the capabilities document listed them on 2026-11-13: 1983-12-01 to 1985-12-01, 1988-12-01 to 1990-12-01, 1998-12-01 to 2000-12-01, a picture a year
62
+ years: ["1983-12-01", "1984-12-01", "1985-12-01", "1988-12-01", "1989-12-01", "1990-12-01", "1998-12-01", "1999-12-01", "2000-12-01"],
63
+ // per channel, the median over six land places of our level 5 divided by this layer's mean (NOTICE.md): the package's pictures are darker and warmer
64
+ gain: [0.76, 0.66, 0.55],
65
+ // the sea is (7, 25, 12) there and a dark wooded slope (8, 39, 6) to (22, 54, 7): clear below a luminance of 20, opaque from 32
66
+ clear: [20, 32],
67
+ credit: {
68
+ en: "Landsat imagery: NASA Global Web-Enabled Landsat Data (GWELD), annual 30 m mosaic, distributed by NASA's LP DAAC.",
69
+ ja: "Landsat画像:NASAのGlobal Web-Enabled Landsat Data(GWELD)の年間30 mモザイク。NASAのLP DAACが配布しています。",
70
+ },
71
+ },
56
72
  VIIRS_SNPP_CorrectedReflectance_TrueColor: {
57
73
  id: "VIIRS_SNPP_CorrectedReflectance_TrueColor",
58
74
  matrix: "250m",
@@ -86,9 +102,17 @@ export const GIBS_LAYERS = {
86
102
  },
87
103
  BlueMarble_ShadedRelief_Bathymetry: { id: "BlueMarble_ShadedRelief_Bathymetry", matrix: "500m", clouds: false, ranges: [] },
88
104
  };
89
- /** The layer a page gets without naming one: MODIS Terra true colour, whose days run to the present (the VIIRS layer's lagged days behind by ten days or more when this was read). */
90
- export const GIBS_DEFAULT_LAYER = "MODIS_Terra_CorrectedReflectance_TrueColor";
105
+ /**
106
+ * The layer a page gets without naming one: the Landsat annual true-colour mosaic (30 m, no cloud, land only; the year 2000, the newest it has). The daily layers are a named choice: `today` for MODIS Terra.
107
+ * A layer id is taken as it is, and these short names stand for two of them.
108
+ */
109
+ export const GIBS_DEFAULT_LAYER = "Landsat_WELD_CorrectedReflectance_TrueColor_Global_Annual";
91
110
  const DEFAULT_LAYER = GIBS_DEFAULT_LAYER;
111
+ /** The short names `tiles-finer-layer` takes besides a layer's own id: `landsat` (the default) and `today` (the daily picture of MODIS Terra, with its clouds). */
112
+ export const GIBS_NAMES = {
113
+ landsat: GIBS_DEFAULT_LAYER,
114
+ today: "MODIS_Terra_CorrectedReflectance_TrueColor",
115
+ };
92
116
  /** How many days, counting the first, the default rule looks back for a day with imagery. */
93
117
  export const GIBS_LOOKBACK_DAYS = 10;
94
118
  /**
@@ -172,6 +196,11 @@ function fixedDay(rule, ms) {
172
196
  }
173
197
  /** A day the layer can serve for a fixed rule (`latest`, the default, starts at the day before `ms`), or `undefined` when it lands where the layer has no imagery (nothing is requested). */
174
198
  export function gibsDay(layer, rule, ms) {
199
+ if (layer.years) {
200
+ // one picture a year: the year a page names if the layer has it (any day of that year), else the newest
201
+ const named = /^\d{4}/.test(rule) ? layer.years.find((time) => time.slice(0, 4) === rule.slice(0, 4)) : undefined;
202
+ return named ?? layer.years[layer.years.length - 1];
203
+ }
175
204
  if (layer.ranges.length === 0)
176
205
  return "default";
177
206
  const named = fixedDay(rule, ms) ?? previousUtcDay(ms);
@@ -200,6 +229,13 @@ export function forgetGibsDays() {
200
229
  settled.clear();
201
230
  probing.clear();
202
231
  }
232
+ /**
233
+ * Where a tile's luminance (0 to 255) is at or below this, the picture has no data there (the service paints it black) and the loader draws it clear; from `NODATA_FULL` it is opaque, and between the two a share, so the edge of a gap is not a hard
234
+ * black line. A layer may set its own limits (`clear`).
235
+ */
236
+ export const NODATA_BELOW = 3;
237
+ /** The luminance from which a pixel is wholly opaque (see `NODATA_BELOW`). */
238
+ export const NODATA_FULL = 14;
203
239
  const anySignal = (signals) => (typeof AbortSignal.any === "function" ? AbortSignal.any(signals) : signals[0]);
204
240
  async function pictureIsBlank(image) {
205
241
  const CanvasCtor = globalThis.OffscreenCanvas;
@@ -233,8 +269,9 @@ async function pictureIsBlank(image) {
233
269
  * ```
234
270
  */
235
271
  export function gibsTiles(options) {
236
- const known = GIBS_LAYERS[options.layer ?? DEFAULT_LAYER];
237
- const layer = known ?? { id: options.layer ?? DEFAULT_LAYER, matrix: "250m", clouds: true, ranges: [] };
272
+ const wanted = options.layer ? (GIBS_NAMES[options.layer] ?? options.layer) : DEFAULT_LAYER;
273
+ const known = GIBS_LAYERS[wanted];
274
+ const layer = known ?? { id: wanted, matrix: "250m", clouds: true, ranges: [] };
238
275
  const grid = gibsGrid(layer.matrix);
239
276
  const rule = options.date ?? "latest";
240
277
  const get = options.fetch ?? ((url, init) => globalThis.fetch(url, init));
@@ -249,7 +286,7 @@ export function gibsTiles(options) {
249
286
  if (!gridOnEarth(level, parts.col, parts.row, grid.extent))
250
287
  throw new RangeError(`"${key}" is off the Earth`);
251
288
  const url = `${TILE_URL}/${layer.id}/default/${day}/${layer.matrix}/${parts.level}/${parts.row}/${parts.col}.jpg`;
252
- const timer = AbortSignal.timeout(GIBS_SLOW_MS);
289
+ const timer = AbortSignal.timeout(options.slowMs && options.slowMs > 0 ? options.slowMs : GIBS_SLOW_MS);
253
290
  let response;
254
291
  try {
255
292
  response = await get(url, { mode: "cors", signal: anySignal([signal, timer]) });
@@ -296,7 +333,7 @@ export function gibsTiles(options) {
296
333
  if (!known)
297
334
  return undefined;
298
335
  const ms = options.time().getTime();
299
- if (fixedDay(rule, ms) !== undefined || layer.ranges.length === 0)
336
+ if (layer.years || fixedDay(rule, ms) !== undefined || layer.ranges.length === 0)
300
337
  return gibsDay(layer, rule, ms);
301
338
  const start = previousUtcDay(ms);
302
339
  const settledKey = `${layer.id}|${start}`;
@@ -309,7 +346,10 @@ export function gibsTiles(options) {
309
346
  const source = {
310
347
  kind: "tiles",
311
348
  layer: "day",
312
- info: INFO,
349
+ info: layer.credit ? { ...INFO, credit: { en: `${GIBS_CREDIT.en} ${layer.credit.en}`, ja: `${GIBS_CREDIT.ja}${layer.credit.ja}` } } : INFO,
350
+ holes: true,
351
+ // the loader draws the tile with these on the graphics card: clear where it is dark, and each colour multiplied (nothing is done to the pixels on the processor)
352
+ look: { clear: layer.clear ?? [NODATA_BELOW, NODATA_FULL], ...(layer.gain ? { gain: layer.gain } : {}) },
313
353
  grid,
314
354
  need(place, detail) {
315
355
  if (gridLevelFor(grid, detail, 0) === undefined)
@@ -349,13 +389,14 @@ export function createFinerHolder(time, changed) {
349
389
  source(read, ownOnly) {
350
390
  if (ownOnly || read("tiles-finer") !== "gibs")
351
391
  return undefined;
352
- const next = `${read("tiles-finer-layer") ?? ""}\n${read("tiles-finer-date") ?? ""}`;
392
+ const next = `${read("tiles-finer-layer") ?? ""}\n${read("tiles-finer-date") ?? ""}\n${read("tiles-finer-timeout") ?? ""}`;
353
393
  if (held && key === next)
354
394
  return held;
355
395
  key = next;
356
396
  const layer = read("tiles-finer-layer");
357
397
  const date = read("tiles-finer-date");
358
- held = gibsTiles({ time, ...(changed ? { changed } : {}), ...(layer ? { layer } : {}), ...(date ? { date } : {}) });
398
+ const slow = Number(read("tiles-finer-timeout"));
399
+ held = gibsTiles({ time, ...(changed ? { changed } : {}), ...(slow > 0 ? { slowMs: slow } : {}), ...(layer ? { layer } : {}), ...(date ? { date } : {}) });
359
400
  return held;
360
401
  },
361
402
  };
@@ -188,7 +188,7 @@ export declare function gridKeys(grid: MapGrid, place: MapPlace, detail: number,
188
188
  * The Geographic (EPSG:4326) tile matrix NASA's imagery service publishes, read from its capabilities on 2026-11-13.
189
189
  * A pixel is `0.5625 / 2^level` degrees. Tiles are 512 pixels, the corner of column 0 and row 0 is longitude -180 and latitude 90, and a level has as many tiles as it takes to cover the Earth, so levels 0, 1 and 2 run past it.
190
190
  *
191
- * @param matrix - `250m` (levels 0 to 8) or `500m` (levels 0 to 7).
191
+ * @param matrix - `250m` (levels 0 to 8), `500m` (levels 0 to 7) or `31.25m` (levels 0 to 11, the Landsat and shaded-relief layers).
192
192
  * @returns The grid.
193
193
  *
194
194
  * @example
@@ -198,4 +198,4 @@ export declare function gridKeys(grid: MapGrid, place: MapPlace, detail: number,
198
198
  * console.log(gibsGrid("250m").levels[3]);
199
199
  * ```
200
200
  */
201
- export declare function gibsGrid(matrix: "250m" | "500m"): MapGrid;
201
+ export declare function gibsGrid(matrix: "31.25m" | "250m" | "500m"): MapGrid;
package/dist/door/grid.js CHANGED
@@ -220,7 +220,7 @@ export function gridKeys(grid, place, detail, prefix = "") {
220
220
  * The Geographic (EPSG:4326) tile matrix NASA's imagery service publishes, read from its capabilities on 2026-11-13.
221
221
  * A pixel is `0.5625 / 2^level` degrees. Tiles are 512 pixels, the corner of column 0 and row 0 is longitude -180 and latitude 90, and a level has as many tiles as it takes to cover the Earth, so levels 0, 1 and 2 run past it.
222
222
  *
223
- * @param matrix - `250m` (levels 0 to 8) or `500m` (levels 0 to 7).
223
+ * @param matrix - `250m` (levels 0 to 8), `500m` (levels 0 to 7) or `31.25m` (levels 0 to 11, the Landsat and shaded-relief layers).
224
224
  * @returns The grid.
225
225
  *
226
226
  * @example
@@ -231,7 +231,7 @@ export function gridKeys(grid, place, detail, prefix = "") {
231
231
  * ```
232
232
  */
233
233
  export function gibsGrid(matrix) {
234
- const max = matrix === "250m" ? 8 : 7;
234
+ const max = matrix === "31.25m" ? 11 : matrix === "250m" ? 8 : 7;
235
235
  const levels = [];
236
236
  for (let level = 0; level <= max; level += 1) {
237
237
  const pixel = 0.5625 / 2 ** level;
@@ -47,6 +47,15 @@ export type EarthMapSource = TileSource<EarthMapPlace, number, ImageTile> & {
47
47
  * The source's own grid, when it is not the package's pyramid (`2^(L+1)` columns by `2^L` rows). The loader places tiles from this. Left out, the pyramid is unchanged.
48
48
  */
49
49
  grid?: MapGrid;
50
+ /** True when the source's tiles may have transparent pixels (a place it has no data for), so the loader draws them blended and the picture underneath shows through. */
51
+ holes?: boolean;
52
+ /**
53
+ * How the loader draws this source's tiles, on the graphics card: `clear` is the luminance (0 to 255) at or below which a pixel is wholly transparent and from which it is wholly opaque, and `gain` multiplies each colour. Left out, tiles are drawn as they are.
54
+ */
55
+ look?: {
56
+ clear: readonly [number, number];
57
+ gain?: readonly [number, number, number];
58
+ };
50
59
  };
51
60
  /**
52
61
  * The levels a source has when it does not say: levels 3 and 4 (8192 and 16384 pixels across), the two the package's cutter makes beyond its own 4096 pixel picture.
@@ -327,8 +327,8 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
327
327
  get tiles(): string | null;
328
328
  set tiles(value: string | null);
329
329
  /**
330
- * Finer imagery than the package's own tiles, read by the browser from NASA's imagery service. `gibs` turns it on; anything else, or leaving it out, leaves it off. The daily picture is the MODIS Terra true-colour layer for the most recent day that has one (looked for from the day before the moment on show back at most 10 days, one tile a day, and kept for the session), with the clouds left in and black gaps between satellite passes, and only when the view is closer than the package's own tiles. A tile that is slow or missing leaves the coarser picture in place.
331
- * `tiles-finer-layer` names another layer (`MODIS_Terra_CorrectedReflectance_TrueColor` or `BlueMarble_ShadedRelief_Bathymetry`), and `tiles-finer-date` is `latest` (the default), `previous-day`, `shown` or one day `yyyy-mm-dd`.
330
+ * Finer imagery than the package's own tiles, read by the browser from NASA's imagery service. `gibs` turns it on; anything else, or leaving it out, leaves it off. The picture is NASA's Landsat annual true-colour mosaic (30 m, no cloud, land only, the year 2000), laid over the package's picture only where the view is closer than the package's own tiles; where it has no data (the sea, Antarctica, the far north) the package's picture stays. A tile that is slow or missing leaves the coarser picture in place.
331
+ * `tiles-finer-layer` is `landsat` (the default), `today` (the daily MODIS Terra picture, with its clouds, for the most recent day that has one, looked for from the day before the moment on show back at most 10 days, one tile a day) or another layer's id. `tiles-finer-date` names a year of the Landsat mosaic by its date (`1990-06-01`), or, for a daily layer, is `latest` (the default), `previous-day`, `shown` or one day `yyyy-mm-dd`. `tiles-finer-timeout` is how many milliseconds a tile is given to arrive before it is left (2000 when the page says nothing).
332
332
  */
333
333
  get tilesFiner(): string | null;
334
334
  set tilesFiner(value: string | null);
@@ -13,7 +13,7 @@ import { applySatelliteFocus, satelliteEmphasis, satelliteGroupRows, shellRadius
13
13
  import { readMeteorStrength } from "../meteors/strength.js";
14
14
  import { METEOR_NOTE_STYLE, prefersLessMotion, setMeteorNote } from "../meteors/note.js";
15
15
  import { createDoorHost } from "../door/host.js";
16
- import { createFinerHolder, GIBS_CREDIT, GIBS_ID } from "../door/gibs.js";
16
+ import { createFinerHolder, GIBS_ID } from "../door/gibs.js";
17
17
  import { folderSource } from "../door/map.js";
18
18
  import { ownCredit } from "../door/own.js";
19
19
  import { BODY_LABEL_ATTRIBUTES, bodyLabelText, loadMichroma, readBodyLabel } from "./body-label.js";
@@ -161,7 +161,7 @@ export const readTime = (value) => {
161
161
  * ```
162
162
  */
163
163
  export class ChikyuEarthRealistic extends HTMLElement {
164
- static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max"];
164
+ static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max"];
165
165
  #model = newModel();
166
166
  #paint = createPaintState();
167
167
  #mode = "now";
@@ -440,7 +440,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
440
440
  this.light = readLight(value);
441
441
  else if (name === "live-seconds")
442
442
  this.#startTick();
443
- else if (name === "tiles" || name === "tiles-finer" || name === "tiles-finer-layer" || name === "tiles-finer-date")
443
+ else if (name === "tiles" || name === "tiles-finer" || name === "tiles-finer-layer" || name === "tiles-finer-date" || name === "tiles-finer-timeout")
444
444
  this.#gate?.soon();
445
445
  else if (name === "data") {
446
446
  this.#door.book.ownOnly(value === "own");
@@ -970,7 +970,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
970
970
  return;
971
971
  const count = this.#model.tiles?.stats.used[GIBS_ID] ?? 0;
972
972
  const lang = (this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en";
973
- const text = count > 0 ? GIBS_CREDIT[lang] : "";
973
+ const finer = this.#finerHold.source((attr) => this.getAttribute(attr), this.getAttribute("data") === "own");
974
+ const text = count > 0 && finer ? finer.info.credit[lang] : "";
974
975
  if (note.textContent !== text)
975
976
  note.textContent = text;
976
977
  if (note.lang !== lang)
@@ -1033,8 +1034,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
1033
1034
  this.setAttribute("tiles", value);
1034
1035
  }
1035
1036
  /**
1036
- * Finer imagery than the package's own tiles, read by the browser from NASA's imagery service. `gibs` turns it on; anything else, or leaving it out, leaves it off. The daily picture is the MODIS Terra true-colour layer for the most recent day that has one (looked for from the day before the moment on show back at most 10 days, one tile a day, and kept for the session), with the clouds left in and black gaps between satellite passes, and only when the view is closer than the package's own tiles. A tile that is slow or missing leaves the coarser picture in place.
1037
- * `tiles-finer-layer` names another layer (`MODIS_Terra_CorrectedReflectance_TrueColor` or `BlueMarble_ShadedRelief_Bathymetry`), and `tiles-finer-date` is `latest` (the default), `previous-day`, `shown` or one day `yyyy-mm-dd`.
1037
+ * Finer imagery than the package's own tiles, read by the browser from NASA's imagery service. `gibs` turns it on; anything else, or leaving it out, leaves it off. The picture is NASA's Landsat annual true-colour mosaic (30 m, no cloud, land only, the year 2000), laid over the package's picture only where the view is closer than the package's own tiles; where it has no data (the sea, Antarctica, the far north) the package's picture stays. A tile that is slow or missing leaves the coarser picture in place.
1038
+ * `tiles-finer-layer` is `landsat` (the default), `today` (the daily MODIS Terra picture, with its clouds, for the most recent day that has one, looked for from the day before the moment on show back at most 10 days, one tile a day) or another layer's id. `tiles-finer-date` names a year of the Landsat mosaic by its date (`1990-06-01`), or, for a daily layer, is `latest` (the default), `previous-day`, `shown` or one day `yyyy-mm-dd`. `tiles-finer-timeout` is how many milliseconds a tile is given to arrive before it is left (2000 when the page says nothing).
1038
1039
  */
1039
1040
  get tilesFiner() {
1040
1041
  return this.getAttribute("tiles-finer") === "gibs" ? "gibs" : null;
@@ -35,7 +35,7 @@ uniform sampler2D paintMap;
35
35
  uniform float paintNow;
36
36
  uniform float paintSpan;
37
37
  uniform float paintOn;
38
- ${tile ? "uniform vec4 nightRect;\nuniform float tileAlpha;\nvarying vec2 vUvG;" : ""}
38
+ ${tile ? "uniform vec4 nightRect;\nuniform float tileAlpha;\nuniform vec3 tileGain;\nuniform vec2 tileClear;\nvarying vec2 vUvG;" : ""}
39
39
  varying vec2 vUv;
40
40
  varying vec3 vNormal;
41
41
  varying vec3 vWorld;
@@ -47,7 +47,9 @@ void main() {
47
47
  float ndv = clamp(dot(n, toEye), 0.0, 1.0);
48
48
  float day = smoothstep(-0.10, 0.22, ndl);
49
49
  vec2 g = ${tile ? "vUvG" : "vUv"};
50
- vec3 albedo = texture2D(dayMap, vUv).rgb;
50
+ vec4 texel = texture2D(dayMap, vUv);
51
+ ${tile ? "float keep = clamp((dot(texel.rgb, vec3(0.299, 0.587, 0.114)) - tileClear.x) / (tileClear.y - tileClear.x), 0.0, 1.0);\n texel.rgb *= tileGain;" : "float keep = 1.0;"}
52
+ vec3 albedo = texel.rgb;
51
53
  float water = texture2D(waterMap, g).r;
52
54
  albedo = pow(albedo, vec3(0.86)) * 1.08;
53
55
  albedo *= mix(vec3(1.0), vec3(1.05, 1.22, 1.55), water);
@@ -96,7 +98,7 @@ void main() {
96
98
  col = mix(col, vec3(1.0, 0.55, 0.12), clamp(show, 0.0, 0.92));
97
99
  }
98
100
 
99
- gl_FragColor = vec4(col, ${tile ? "tileAlpha" : "1.0"});
101
+ gl_FragColor = vec4(col, ${tile ? "tileAlpha * keep * texel.a" : "1.0"});
100
102
  }`;
101
103
  export const SURFACE_FRAG = surfaceFrag(false);
102
104
  /** The same surface for a map tile: the tile's own program. */
@@ -351,6 +351,9 @@ export function createTileSet(three, parent, shared, deps) {
351
351
  ...shared.extra,
352
352
  nightRect,
353
353
  tileAlpha: cover,
354
+ // the source's look: each colour multiplied, and clear below a luminance (the defaults leave a tile as it is: the clear range, in 0 to 1, lies below black)
355
+ tileGain: { value: entry.source.look?.gain ?? [1, 1, 1] },
356
+ tileClear: { value: entry.source.look ? [entry.source.look.clear[0] / 255, entry.source.look.clear[1] / 255] : [-2, -1] },
354
357
  rect: { value: gridRect(entry) },
355
358
  // a finer level sits a little higher, so two levels at once never fight for the same depth; a grid tile sits above the package's finest. All sit above the whole-Earth sphere's flat faces
356
359
  radius: { value: entry.gridLevel ? 1.0008 : 1.0004 + 0.0001 * (entry.id.level - 3) },
@@ -358,8 +361,9 @@ export function createTileSet(three, parent, shared, deps) {
358
361
  polygonOffset: true,
359
362
  polygonOffsetFactor: -1,
360
363
  polygonOffsetUnits: -1,
361
- transparent: false,
362
- depthWrite: true,
364
+ // a source whose tiles have holes (no data, which the source made transparent) is drawn blended, so the picture under it shows there
365
+ transparent: entry.source.holes === true,
366
+ depthWrite: entry.source.holes !== true,
363
367
  });
364
368
  entry.cover = cover;
365
369
  const mesh = new three.Mesh(geometry, material);
@@ -612,8 +616,9 @@ export function createTileSet(three, parent, shared, deps) {
612
616
  entry.cover.value = t;
613
617
  const material = entry.mesh?.material;
614
618
  if (material) {
615
- material.transparent = t < 1;
616
- material.depthWrite = t >= 1;
619
+ const holes = entry.source.holes === true;
620
+ material.transparent = t < 1 || holes;
621
+ material.depthWrite = t >= 1 && !holes;
617
622
  }
618
623
  if (t < 1)
619
624
  fading = true;
@@ -20,7 +20,7 @@ import { COUNTRY_NAMES_STYLE, createCountryHost } from "../country-names/host.js
20
20
  import { SEA_NAMES_ATTRIBUTES, readSeaNames } from "../sea-names/geometry.js";
21
21
  import { SEA_NAMES_STYLE, createSeaHost } from "../sea-names/host.js";
22
22
  import { createGate, frameCap } from "../realistic/gate.js";
23
- import { createFinerHolder, GIBS_CREDIT, GIBS_ID } from "../door/gibs.js";
23
+ import { createFinerHolder, GIBS_ID } from "../door/gibs.js";
24
24
  import { folderSource } from "../door/map.js";
25
25
  import { setThreeLoader, takeRenderer } from "../realistic/shared.js";
26
26
  import { NOTES_STYLE, setAirNote } from "../realistic/air-note.js";
@@ -157,7 +157,7 @@ const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:h
157
157
  * ```
158
158
  */
159
159
  export class ChikyuSpace extends HTMLElement {
160
- static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "ride-viewpoint"];
160
+ static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "ride-viewpoint"];
161
161
  #model = newSpaceModel();
162
162
  /** The finer imagery (NASA's tile service), one source while the attributes stay the same. Off unless `tiles-finer="gibs"`. */
163
163
  #finerHold = createFinerHolder(() => new Date(this.#model.time), () => this.#gate?.request());
@@ -509,7 +509,7 @@ export class ChikyuSpace extends HTMLElement {
509
509
  this.#model.satellites.streakMax = readStreakMax(value);
510
510
  this.#gate?.request();
511
511
  }
512
- else if (name === "tiles" || name === "tiles-finer" || name === "tiles-finer-layer" || name === "tiles-finer-date")
512
+ else if (name === "tiles" || name === "tiles-finer" || name === "tiles-finer-layer" || name === "tiles-finer-date" || name === "tiles-finer-timeout")
513
513
  this.#gate?.request();
514
514
  if (name === "air-thickness" || name === "air-label" || name === "lang")
515
515
  setAirNote(this.#airNote, this, this.#model.airThickness);
@@ -526,7 +526,8 @@ export class ChikyuSpace extends HTMLElement {
526
526
  return;
527
527
  const count = this.#model.tiles?.stats.used[GIBS_ID] ?? 0;
528
528
  const lang = (this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en";
529
- const text = count > 0 ? GIBS_CREDIT[lang] : "";
529
+ const finer = this.#finerHold.source((attr) => this.getAttribute(attr), false);
530
+ const text = count > 0 && finer ? finer.info.credit[lang] : "";
530
531
  if (note.textContent !== text)
531
532
  note.textContent = text;
532
533
  if (note.lang !== lang)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/chikyu-earth",
3
- "version": "0.46.2",
3
+ "version": "0.46.4",
4
4
  "description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on the place you give it, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, satellites on their orbits, and markers for any place. A web component and an SVG string.",
5
5
  "keywords": [
6
6
  "earth",