@johnmorrisdotca/chikyu-earth 0.42.0 → 0.45.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/NOTICE.md +15 -5
  3. package/README.md +4 -4
  4. package/dist/door/map.js +5 -1
  5. package/dist/element.d.ts +30 -0
  6. package/dist/element.js +82 -2
  7. package/dist/markers/here-city-host.d.ts +3 -1
  8. package/dist/markers/here-city-host.js +67 -5
  9. package/dist/markers/here-city.d.ts +94 -1
  10. package/dist/markers/here-city.js +69 -1
  11. package/dist/markers/index.d.ts +1 -1
  12. package/dist/markers/index.js +1 -1
  13. package/dist/realistic/element-base.d.ts +44 -1
  14. package/dist/realistic/element-base.js +128 -16
  15. package/dist/realistic/index.d.ts +1 -0
  16. package/dist/realistic/index.js +1 -0
  17. package/dist/realistic/zoom-reach.d.ts +29 -0
  18. package/dist/realistic/zoom-reach.js +30 -0
  19. package/dist/satellites/catalogue.d.ts +52 -1
  20. package/dist/satellites/catalogue.js +96 -5
  21. package/dist/satellites/index.d.ts +1 -1
  22. package/dist/satellites/index.js +1 -1
  23. package/dist/sea-names/features.d.ts +12 -0
  24. package/dist/sea-names/features.js +46 -0
  25. package/dist/sea-names/geometry.d.ts +121 -0
  26. package/dist/sea-names/geometry.js +135 -0
  27. package/dist/sea-names/host.d.ts +46 -0
  28. package/dist/sea-names/host.js +111 -0
  29. package/dist/space/element-base.d.ts +58 -11
  30. package/dist/space/element-base.js +153 -13
  31. package/dist/space/generic-satellite.d.ts +46 -0
  32. package/dist/space/generic-satellite.js +96 -0
  33. package/dist/space/index.d.ts +2 -1
  34. package/dist/space/index.js +2 -1
  35. package/dist/space/ride.d.ts +45 -0
  36. package/dist/space/ride.js +38 -0
  37. package/dist/space/satellite-focus.d.ts +90 -0
  38. package/dist/space/satellite-focus.js +109 -0
  39. package/dist/space/satellite-layer.d.ts +32 -3
  40. package/dist/space/satellite-layer.js +95 -29
  41. package/dist/space/scene.d.ts +3 -1
  42. package/dist/space/scene.js +54 -25
  43. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.45.0 - 2026-11-13
4
+
5
+ - **Sharper Earth tiles: day level 5 and night level 4, from NASA's 500 m maps** (MODULES-1263). `scripts/make-earth-tiles.py` builds the day map's level 5 (32768 × 16384, 2,048 tiles, 22.8 MB) from the full-resolution Blue Marble: Next Generation (86400 × 43200, eight 21600 × 21600 panels) and the night map's level 4 (16384 × 8192, 512 tiles, 2.3 MB) from the full-resolution Black Marble 2016 colour map, so the whole pyramid is 3,412 files and 35.4 MB (it was 852 and 10.3 MB). Levels 0 to 4 of the day map and 0 to 3 of the night map are unchanged (the same code and sources; tiles sampled from every level are identical to the published ones). The panels are resized one panel at a time with their neighbours' edges around them (the far panel across the antimeridian), so the 11 GB map is never in memory (about 4 GB at the most) and the tiles equal, to the pixel, a resize of the whole map; `selftest` checks that on a made-up map, joins, antimeridian and poles included. The build takes about 3 to 4 minutes and downloads 688 MB once; the sources and their SHA-256 are in `scripts/earth-tiles-sources.json`. A level is still never built from a source that does not fill it. The folder source (`earthTiles`, what the `tiles` attribute makes) named the keys of a tile from the package's levels 3 and 4 alone, so with a level 5 in the manifest the view chose level 5 and then asked for level 4 tiles: it now names them from the levels its manifest has (the package's 3 and 4 before the manifest is read or where there is none), and a test holds it. The zoom limit the element sets when it finds the tiles is no longer fixed: it is now as many times 5 as the finest day level is wider than 4096, so 40 for a set that reaches level 5 (it was fixed at 20; a set that stops at level 4 still gives 20); it is only raised, so a source with fewer levels added later does not lower it and send the view back to fit. The 48 tile and about 70 MB limits hold at the finest level (`e2e/tiles.gl.ts`). `pages.yml` keeps NASA's source files between runs while `scripts/earth-tiles-sources.json` is unchanged (a change to the script alone downloads nothing), and the built tiles while the script and the sources are unchanged. `earthTiles().need()` now names keys from the manifest's own levels (a detail of 4096 or less can name levels 0 to 2 where it named level 3 before). Without `EARTH_TILES_ALL=yes` the script (`pnpm tiles`) makes only day 0 to 4 and night 0 to 3 from the two whole pictures and does not download the panels, and its output is what was published before, byte for byte (the manifest and 80 sampled tiles compared); a download is tried three times (after 5 s and 20 s) before the script stops. The Pages site publishes day levels above 4 and night levels above 3 only when the repository variable `EARTH_TILES_ALL` is `yes` (`scripts/site.ts`): a loader up to 0.43 that reads a manifest with a level 5 wants it and fetches the level 4 tile for each quarter of it, a wrong picture on every page that reads the demo's tiles (the website's hero does), so the variable is set once those pages have the newer loader. Guide, its Japanese twin and NOTICE updated.
6
+
7
+ ## 0.44.0 - 2026-11-13
8
+
9
+ - **A ride shows the satellite** (MODULES-1236). Riding a satellite put the camera at it, so the reader never saw the thing ridden. `ride` has a new option `viewpoint: "outside" | "inside"`, with the attribute `ride-viewpoint` and the property `rideViewpoint` on `<chikyu-space>` (and `Riding.viewpoint`), **`outside` by default**: with `view: "from"` the camera is 25 km behind and above the satellite looking along (the satellite a little below the middle), or 25 km straight above it looking down (the satellite at the middle), with the same look-around as before. A satellite the page has no model for is drawn from a small drawing of the package's own by kind (`satelliteKind`, `genericSatellite`: a bus with two panels, a dish for a communications satellite, one long panel for a constellation, modules for a station), about a fifth of the picture's height across and so not to scale (the demo says so under the picture). `inside` is today's ride, camera at the satellite and no drawing. `outsidePose` (pure) is the camera. Switching is one eased glide that keeps the ride and the clock; nothing is drawn at rest, and 20 switches leave the GPU's objects flat (`e2e/ride-outside.gl.ts`). **Behaviour change:** a ride of a satellite is now outside unless asked otherwise, and `follow` and `above` draw the package's drawing instead of a dot where the page has no model; see the upgrading guide. A body is always ridden from inside.
10
+ - **Plain catalogue rows, found in Japanese too** (MODULES-1216). `catalogueRows()` in `@johnmorrisdotca/chikyu-earth/satellites` returns one row for every group and every satellite, with English and Japanese names, for a page to index. The Japanese name is the short name where the package has one (the ISS, Tiangong as `天宮`, Hubble as `ハッブル`); otherwise it is the English name, which is the same spelling in Japanese (Sentinel-2A). `aka` lists the catalogue's own other names (HST for Hubble, and a designation written in parentheses). `findInCatalogue` also matches a Japanese name and a group's Japanese label as typed, folding only case and width, and an English or numeric query returns the same entries as before.
11
+ - **Names of oceans, seas and continents** (MODULES-1230). `sea-names` on `<chikyu-earth>`, `<chikyu-earth-realistic>` and `<chikyu-space>` (off by default; the property `seaNames`) names the oceans and the continents while the Earth is small on the screen, and the seas, gulfs and bays once its radius is at least 280 pixels (`SEA_RADIUS`). Water is written with space between the letters. A city name is placed first and keeps the space where only one name fits. Nothing is drawn again at rest. `seaNamesFor` and `layoutSeaNames` are in `@johnmorrisdotca/chikyu-earth/realistic`.
12
+ - **A here marker can name a town under 100,000** (MODULES-1212). After the capitals, the cities of a million and the cities of 100,000 have answered, `here-city` reads the smaller cities of the nearest city's country, and of one more country when that country also has a city of those three tiers within the limit. Each country is one file (`citiesOf`), loaded once. A nearer town within the limit wins. **The optional peer `@johnmorrisdotca/kuni` is raised from `>=1.6.1` to `>=1.8.0`**, the first version with `citiesOf`; a page that turns `here-city` on needs kuni 1.8.0 or later (wakusei-planets and uchusen-rockets, the family packages that use this one, do not depend on kuni). The towns come from kuni's own cities (NOTICE.md records the source). Nothing is loaded while `here-city` is off, and nothing is drawn again at rest.
13
+ - **The held-clock check counts in one turn** (MODULES-1272). `e2e/date-play.demo.ts` took the log of `chikyu-timechange` in one call and gave the date in others, so a one-second tick between them was read as a second telling (seen once on the desk Chromium). The length is taken in the same turn of the page that gives the date; the test still proves once, held, and nothing more. No change to the package.
14
+
15
+ ## 0.43.0 - 2026-11-13
16
+
17
+ - **One satellite group at a time** (MODULES-1215). `focusSatelliteGroup(name, options)` on `<chikyu-space>` and `<chikyu-earth-realistic>` shows one group that has been set and deals with the others: `others` is `"dim"` (the default; the same dimming an old element set uses, so no new object) or `"hide"`. `frame` (true by default) pulls the camera back with the view's own zoom until the group's orbits fit. The distance is the greatest apogee, from mean motion and eccentricity, and it stops at 8 Earth radii. `null` restores each group's own shown state and the camera. A group that has not been set returns `{ ok: false, reason: "not-set" }` and changes nothing. `focusedSatelliteGroup` is the name or `null`. `satelliteGroups` adds `emphasis` and `placed`, and keeps `count`. `chikyu-satellite-focus` is sent with `{ group, count }` when the choice changes. The demo has a row, "One group". Nothing is drawn at rest.
18
+ - **A ring appears when the satellite comes into the picture** (MODULES-1213). `ringSatellites` keeps the satellites it was asked to ring. One that is outside the picture gets its ring on the first later draw that shows it, and nothing is drawn at rest just to wait. `placeSatellite` adds `edge` (`"top"`, `"right"`, `"bottom"`, `"left"` or `null`) and `behind` (true when the satellite is behind the camera), and no longer answers `null` for a satellite that is merely out of the picture: it returns the place outside the picture, so check `.visible`.
19
+
3
20
  ## 0.42.0 - 2026-11-13
4
21
 
5
22
  - **The "you are here" marker can take the nearest city's name** (MODULES-1077). `here-city` on `<chikyu-space>` and `<chikyu-earth-realistic>` (off by default; the property `hereCity` is `false`, `true` or a number of kilometres) names each `kind: "here"` place with the nearest city within 100 km (`HERE_CITY_KM`; a number on the attribute is that limit, at most 20,000). The name follows the page's language. The cities are kuni's capitals, the other cities of a million and the others of 100,000, loaded only when this is on and a `here` place is set; a smaller town keeps the label the page gave. `places` itself is not changed. Nothing is drawn again at rest.
package/NOTICE.md CHANGED
@@ -8,7 +8,9 @@ The country boundaries are **Natural Earth** (https://www.naturalearthdata.com),
8
8
  admin-0 countries, which Natural Earth places in the **public domain**
9
9
  (https://www.naturalearthdata.com/about/terms-of-use/). They reach this package through **chizu**
10
10
  (https://github.com/johnmorrisdotca/chizu, MIT, by John Morris), whose `world-geo` entry
11
- (`@johnmorrisdotca/chizu/world-geo`) holds them as longitude and latitude; nothing is fetched at runtime. The demo's passes page draws its small world map
11
+ (`@johnmorrisdotca/chizu/world-geo`) holds them as longitude and latitude; nothing is fetched at runtime.
12
+
13
+ The names of oceans, seas, gulfs, bays and continents (`src/sea-names/`) use the same Natural Earth terms, read 2026-11-13 at https://www.naturalearthdata.com/about/terms-of-use/: "All versions of Natural Earth raster + vector map data found on this website are in the public domain. You may use the maps in any manner, including modifying the content and design, electronic dissemination, and offset printing." The label point for each name is this package's own: the sample inside the published 1:110m geography shape that sits nearest that shape's centre. The shapes themselves are not in this package. The English and Japanese names are the names published with those shapes (the Japanese names are also credited by Natural Earth to Wikidata, CC0). A few Japanese names are waiting on a review: `オーストラリア大陸`, `南アメリカ`, `北アメリカ`, `南極大陸`, `珊瑚海`. The demo's passes page draws its small world map
12
14
  from a simplified copy of the same outlines (each ring thinned in the browser to within half a map unit, about half the points): a derived drawing of the same public-domain data.
13
15
 
14
16
  ## Borders
@@ -32,6 +34,12 @@ Each outline's English name, Japanese name and country code come from **chizu**'
32
34
  **kuni**'s (https://github.com/johnmorrisdotca/kuni, also by John Morris) and Unicode CLDR's
33
35
  (https://www.unicode.org/license.txt) and Wikidata's (CC0). chizu's own NOTICE.md has the terms.
34
36
 
37
+ ## City names for the "you are here" marker
38
+
39
+ The names `here-city` puts on a `here` marker (the capitals, the cities of a million, those of 100,000 and the smaller towns of one or two countries, `src/markers/here-city.ts`) are read at run time from **kuni**'s
40
+ `/cities` (https://github.com/johnmorrisdotca/kuni, MIT, also by John Morris), which builds them from Wikidata's structured data (CC0, https://www.wikidata.org/wiki/Wikidata:Licensing) and Natural Earth's populated
41
+ places (public domain); kuni's own NOTICE.md has the terms and the dates they were read. This package adds no source of its own and stores no city. Read 2026-11-13.
42
+
35
43
  ## The realistic Earth's pictures
36
44
 
37
45
  The pictures in `textures/` (and `dist/textures/`) are made by `scripts/make-textures.py` from four NASA Earth Observatory images, resized and
@@ -51,16 +59,16 @@ text read on 2026-11-02, so check them if you need the exact wording for print.
51
59
 
52
60
  ## The Earth tiles
53
61
 
54
- `scripts/make-earth-tiles.py` cuts two bigger NASA maps into a pyramid of 512 px WebP tiles (docs/guides/earth-tiles.md). The tiles are built in CI and served by GitHub Pages beside the demo at `/tiles/`; they are not in git and not in the npm package. Terms, read on 2026-11-08 at https://www.nasa.gov/nasa-brand-center/images-and-media/ (NASA Images and Media Usage Guidelines): "NASA content – images, audio, video, and media files used in the rendition of 3-dimensional models, such as texture maps and polygon data in any format – generally are not subject to copyright in the United States." and "NASA should be acknowledged as the source of the material." The same page says third-party material NASA uses with permission is marked as copyright protected with the holder's name; neither source below is marked so. Not endorsed by NASA; no NASA insignia or logotype is used.
62
+ `scripts/make-earth-tiles.py` cuts NASA's bigger maps (the 21600 and 13500 pixel pictures, and the full-resolution 500 m maps, 86400 × 43200, published as eight 21600 × 21600 panels each) into a pyramid of 512 px WebP tiles (docs/guides/earth-tiles.md). The tiles are built in CI and served by GitHub Pages beside the demo at `/tiles/`; they are not in git and not in the npm package. Terms, read on 2026-11-08 and again on 2026-11-13 (the same words, which cover the 500 m maps too) at https://www.nasa.gov/nasa-brand-center/images-and-media/ (NASA Images and Media Usage Guidelines): "NASA content – images, audio, video, and media files used in the rendition of 3-dimensional models, such as texture maps and polygon data in any format – generally are not subject to copyright in the United States." and "NASA should be acknowledged as the source of the material." The same page says third-party material NASA uses with permission is marked as copyright protected with the holder's name; neither source below is marked so. Not endorsed by NASA; no NASA insignia or logotype is used.
55
63
 
56
64
  | Layer | Source | Credit |
57
65
  |---|---|---|
58
- | `day` (levels 0 to 4, up to 16384 x 8192) | Blue Marble: Next Generation with topography and bathymetry, September 2004, 21600 x 10800 (https://assets.science.nasa.gov/content/dam/science/esd/eo/images/bmng/bmng-topography-bathymetry/september/world.topo.bathy.200409.3x21600x10800.jpg, SHA-256 863036b622ba3dab4eb4ffb7149730b02cfa433ce49672e9b7267022051e04a2); the same month as `day-*.webp` | "NASA Earth Observatory": the page https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/ (read 2026-11-08) says "Anyone using or republishing Blue Marble: Next Generation please credit “NASA Earth Observatory.”" It was produced by Reto Stöckli, NASA Earth Observatory (NASA Goddard Space Flight Center). |
59
- | `night` (levels 0 to 3, up to 8192 x 4096) | Earth at Night, Black Marble 2016 colour map at 3 km, 13500 x 6750 (https://assets.science.nasa.gov/content/dam/science/esd/eo/images/imagerecords/144000/144898/BlackMarble_2016_3km.jpg, SHA-256 230aac448ae68c358be433dd518888cccb3a85ccf66f7b44326441c324ad6725; page https://science.nasa.gov/earth/earth-observatory/earth-at-night/maps/, read 2026-11-08) | NASA Earth Observatory, Suomi NPP VIIRS data (the page names no further credit line in its text; check it for print) |
66
+ | `day` (levels 0 to 5, up to 32768 x 16384) | Blue Marble: Next Generation with topography and bathymetry, September 2004: levels 0 to 4 from the 21600 x 10800 picture (https://assets.science.nasa.gov/content/dam/science/esd/eo/images/bmng/bmng-topography-bathymetry/september/world.topo.bathy.200409.3x21600x10800.jpg, SHA-256 863036b622ba3dab4eb4ffb7149730b02cfa433ce49672e9b7267022051e04a2), level 5 from its full-resolution 500 m map, 86400 x 43200 (https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/ says "very high resolution (500 meters/pixel)", read 2026-11-13), eight panels https://assets.science.nasa.gov/content/dam/science/esd/eo/images/bmng/bmng-topography-bathymetry/september/world.topo.bathy.200409.3x21600x21600.<A1 to D2>.jpg (21600 x 21600 each, 436 MB in all; the SHA-256 of each is in `scripts/earth-tiles-sources.json`); the same month as `day-*.webp` | "NASA Earth Observatory": the page https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/ (read 2026-11-08) says "Anyone using or republishing Blue Marble: Next Generation please credit “NASA Earth Observatory.”" It was produced by Reto Stöckli, NASA Earth Observatory (NASA Goddard Space Flight Center). |
67
+ | `night` (levels 0 to 4, up to 16384 x 8192) | Earth at Night, Black Marble 2016 colour map: levels 0 to 3 from the 3 km picture, 13500 x 6750 (https://assets.science.nasa.gov/content/dam/science/esd/eo/images/imagerecords/144000/144898/BlackMarble_2016_3km.jpg, SHA-256 230aac448ae68c358be433dd518888cccb3a85ccf66f7b44326441c324ad6725; page https://science.nasa.gov/earth/earth-observatory/earth-at-night/maps/, read 2026-11-08), level 4 from its 500 m map, 86400 x 43200 (the Visible Earth page https://visibleearth.nasa.gov/images/144898/earth-at-night-black-marble-2016-color-maps, read 2026-11-13, says "in three different resolutions: 0.1 degrees (3600x1800), 3km (13500x6750), and 500m (86400x43200). The 500m global map is divided into tiles (21600x21600)"), eight panels https://assets.science.nasa.gov/content/dam/science/esd/eo/images/imagerecords/144000/144898/BlackMarble_2016_<A1 to D2>.jpg (206 MB in all; the SHA-256 of each is in `scripts/earth-tiles-sources.json`) | NASA Earth Observatory, Suomi NPP VIIRS data (the page names no further credit line in its text; check it for print) |
60
68
 
61
69
  The bathymetry-free Blue Marble maps (base map, and base map with topography, on the same Blue Marble page) fall under the same NASA terms; the tiles use the one with bathymetry, as `day-*.webp` does. The clouds are not tiled: NASA's sharper cloud files (Visible Earth 57747, once at eoimages.gsfc.nasa.gov) are no longer served, and the Blue Marble 2002 page (https://science.nasa.gov/earth/earth-observatory/the-blue-marble-true-color-global-imagery-at-1km-resolution/) offers only the 2048 picture already in `clouds-2048.webp`.
62
70
 
63
- Where the pyramid is hosted: GitHub Pages of this public repository, which costs nothing (docs/guides/earth-tiles.md). It adds 852 files and 10.3 MB to the site.
71
+ 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.
64
72
 
65
73
  ## The Moon's picture
66
74
 
@@ -92,6 +100,8 @@ Starlink satellite kept (2,231 of 11,155), within the same usage policy, credite
92
100
  kept (2,232 of 11,156), as numbers only. CelesTrak states no licence or credit rule for the data; it is credited on the demo page, and the demo shows the age of the elements. The tier is "grey" in John's
93
101
  terms: a snapshot with credit, never a live fetch. The catalogue (`src/satellites/catalogue.ts`) holds names, NORAD numbers and orbit kinds, which are facts, and lines written for this package in its own words (English and Japanese); nothing is copied from NASA, ESA, Wikipedia or any other page. docs/satellite-sources.md has every source's terms, read 2026-11-03.
94
102
 
103
+ The other names a catalogue row lists (`aka` on `catalogueRows`) are taken from this package's own catalogue and short names (`src/satellites/names.ts`), read 2026-11-13. Where a short name is shown (Hubble, the ISS, Tiangong), the catalogue's own name is the other name (HST, ISS (ZARYA), CSS (TIANHE)). A designation written in parentheses in that name is listed too (ZARYA, TIANHE, JPSS-1, JPSS-2, GLAST, MTG-I1, AO-7, AO-73, SO-50, AO-85). Nothing was added from any other list. A satellite with no short Japanese name uses its English name in Japanese as well: Sentinel-2A is written the same way. The hiragana readings on those rows are this package's own readings of the Japanese words already in the catalogue, for a search box, read 2026-11-13.
104
+
95
105
  The same build may take a group's element sets from **Space-Track.org** (https://www.space-track.org, U.S. Space Command) when CelesTrak has left the group more than 12 hours old, at most once a day, through its API with John Morris's own account (the login is a repository secret, never in a file). The group's file and `manifest.json` say `"source": "spacetrack"` and the demo says so under the globe. The citation is **"Data from Space-Track.org (USSPACECOM)"**. Terms: the documentation page https://www.space-track.org/documentation, section "Redistribution of Basic SSA Information", read 2026-11-08: "USSPACECOM has provided express blanket approval for transfer/redistribution of basic SSA data and services accessed via www.Space-Track.org conditioned on appropriate citation." Basic SSA data are "Two-Line Elements (TLEs) and Orbital Mean-element Messages (OMMs); SATCAT; and Satellite Decay and Reentry Data." (The page needs a browser; the section was read through a page-reading tool, which returned each sentence in quoted pieces. TODO: John or a browser check of the section's wording.) The page gives no citation form, so this sentence is the package's own. The package ships none of these element sets.
96
106
 
97
107
  ## Satellite owners' countries
package/README.md CHANGED
@@ -176,7 +176,7 @@ atmosphere at the rim, drawn with three.js through kazoku-ui's shared renderer.
176
176
 
177
177
  Needs `three` and `@johnmorrisdotca/kazoku-ui` (both optional peers) and the pictures (1.6 MB, from NASA, in `dist/textures/`). It draws nothing while nothing changes,
178
178
  at most 30 times a second while it does, in one WebGL context, with textures that grow as you zoom and are freed after. With `tiles="/tiles/"` (a folder of NASA map
179
- tiles, [how](docs/guides/earth-tiles.md)) it loads only the finer tiles in view, so you can zoom in to 20 times and stay sharp. With `speed="86400"` (a day a second; the name `<chikyu-space>` uses) its clock runs on from the date shown and the Sun, the night side and the clouds follow it ([guide](docs/guides/time-and-play.md)). `immersive` fills the window, `camera="space"` holds the camera in the stars so the Earth turns beneath it, and it draws every satellite group at once ([guide](docs/guides/full-screen-and-camera.md)). All of it, the budget and the tests:
179
+ tiles, [how](docs/guides/earth-tiles.md)) it loads only the finer tiles in view, so you can zoom in to 40 times and stay sharp. With `speed="86400"` (a day a second; the name `<chikyu-space>` uses) its clock runs on from the date shown and the Sun, the night side and the clouds follow it ([guide](docs/guides/time-and-play.md)). `immersive` fills the window, `camera="space"` holds the camera in the stars so the Earth turns beneath it, and it draws every satellite group at once ([guide](docs/guides/full-screen-and-camera.md)). All of it, the budget and the tests:
180
180
  [docs/realistic.md](docs/realistic.md).
181
181
 
182
182
  ## The Sun, the Moon and the planets
@@ -359,7 +359,7 @@ Passes are only as good as the orbit data are new: each pass says how old its el
359
359
  <p align="center"><img alt="Riding along with the ISS, tipped towards the horizon: the Earth's curve and atmosphere, and the orbits of the other stations in the sky" src="docs/images/space-ride-horizon.png" width="420"></p>
360
360
 
361
361
  `space.ride({ group: "stations", index: 0 }, { look: "horizon" })` puts the camera on the ISS (or a Starlink satellite, the Moon, a planet) at its real place for the moment shown and looks at the Earth, which goes by beneath
362
- as the body moves along its orbit; switch to another body and the camera glides there. Straight down or toward the horizon, from the body or following it at a distance, time faster or slower. It animates continuously, so it keeps to the
362
+ as the body moves along its orbit; switch to another body and the camera glides there. Straight down or toward the horizon, from the body or following it at a distance, time faster or slower. A ridden satellite is in the picture by default (the camera a little behind and above it, a small drawing of it where the page has no model, not to scale); `ride-viewpoint="inside"` (property `rideViewpoint`, option `viewpoint`) puts the camera at the satellite instead. It animates continuously, so it keeps to the
363
363
  same budget: at most 30 frames a second (one a second for reduced motion), nothing drawn while paused, out of sight or hidden. [Ride along guide](docs/guides/ride-along.md), [docs/ride-along.md](docs/ride-along.md).
364
364
 
365
365
  ## Printable sheets
@@ -398,7 +398,7 @@ rotate or drag controls.
398
398
  | Element | Zoom range | Why it stops there |
399
399
  | --- | --- | --- |
400
400
  | `<chikyu-earth>` | 0.1 to 20 times | Natural Earth 1:110m outlines, redrawn at each zoom; at 20 times the view is about 640 km across and a coast is a few straight segments |
401
- | `<chikyu-earth-realistic>` | 0.1 to 5 times; 20 with `tiles` found | the package's pictures are 4096 pixels across at most; the finest tile level is 4 times that |
401
+ | `<chikyu-earth-realistic>` | 0.1 to 5 times; 40 with `tiles` found (20 for a set that stops at level 4) | the package's pictures are 4096 pixels across at most; the finest tile level is up to 8 times that |
402
402
  | `<chikyu-space>` | a millionth to 2.5 times; 0.5 to 6 riding from a body | the zoom is the camera's distance (the whole solar system needs a millionth); close in, the Earth's picture and the textures stay sharp to 2.5 |
403
403
 
404
404
  [Zoom, pan and turn](docs/guides/zoom-and-pan.md) says more. For buttons, a slider, Auto-turn and the address, add the
@@ -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.42.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
614
+ > Morris, J. (2026). *Chikyu Earth* (version 0.45.0) [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
 
package/dist/door/map.js CHANGED
@@ -125,6 +125,8 @@ export function earthTiles(base, options = {}) {
125
125
  const get = options.fetch ?? ((url, init) => globalThis.fetch(url, init));
126
126
  const decode = options.decode ?? ((blob) => createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }));
127
127
  let manifest;
128
+ // the levels the folder's manifest has, once it has been read (`levels` is asked before the first `need`); until then, and for a folder that has no manifest, the package's levels 3 and 4
129
+ let known;
128
130
  const source = {
129
131
  kind: "tiles",
130
132
  layer: "*",
@@ -133,7 +135,7 @@ export function earthTiles(base, options = {}) {
133
135
  const layer = place.layer;
134
136
  if (typeof layer !== "string" || layer === "")
135
137
  throw new RangeError("a folder of tiles is asked for a place with its layer");
136
- return mapKeys(place, detail, DEFAULT_LEVELS, `${layer}/`);
138
+ return mapKeys(place, detail, known?.[layer] ?? DEFAULT_LEVELS, `${layer}/`);
137
139
  },
138
140
  async levels(layer) {
139
141
  // read once: a folder that cannot be read is not asked again by this source, so a view at rest sends nothing
@@ -142,6 +144,8 @@ export function earthTiles(base, options = {}) {
142
144
  // an answer that was no folder is not kept: the next view of it (a changed source, a new element) asks again, and a view at rest never does
143
145
  if (layers === undefined && manifest === asked)
144
146
  manifest = undefined;
147
+ else
148
+ known = layers;
145
149
  return layers?.[layer];
146
150
  },
147
151
  async load(key, signal) {
package/dist/element.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type ViewController } from "@johnmorrisdotca/kazoku-ui/view-controls";
2
2
  import { type RouteLeg } from "./route.ts";
3
3
  import type { OverlayHost } from "./markers/layer.ts";
4
+ import { type SeaNamesStats } from "./sea-names/host.ts";
4
5
  import type { GeoPoint, GlobeView } from "./types.ts";
5
6
  /**
6
7
  * The `<chikyu-earth>` custom element: the line globe, drawn as SVG in its shadow root. Importing this entry point registers the tag once. It takes the attributes `size` (pixels, 320 by default), `center` (`"lon,lat"`; wins over the browser's location), `look` (`line` or `thick`; `style` is the older name for it, and a framework that reads `style` as CSS cannot use it) and `graticule`, and a shared view controller's camera through `setView`.
@@ -35,6 +36,35 @@ export declare class ChikyuEarth extends HTMLElement {
35
36
  from: GeoPoint;
36
37
  to: GeoPoint;
37
38
  } | null);
39
+ /**
40
+ * Names of oceans, seas and continents (the attribute `sea-names`). Off unless set: a bare attribute is on. Oceans and continents from far out, seas once the Earth is large on the screen. Nothing is drawn again at rest.
41
+ *
42
+ * @example
43
+ * ```ts no-run
44
+ * import type { ChikyuEarth } from "@johnmorrisdotca/chikyu-earth/element";
45
+ *
46
+ * const earth = document.querySelector("chikyu-earth") as ChikyuEarth;
47
+ * earth.seaNames = true;
48
+ * console.log(earth.seaNames);
49
+ * earth.seaNames = false;
50
+ * ```
51
+ */
52
+ get seaNames(): boolean;
53
+ set seaNames(value: boolean);
54
+ /**
55
+ * Whether `sea-names` is on, the Earth's radius on the screen, the names shown, and how many times they were laid out.
56
+ *
57
+ * @example
58
+ * ```ts no-run
59
+ * import type { ChikyuEarth } from "@johnmorrisdotca/chikyu-earth/element";
60
+ *
61
+ * const earth = document.querySelector("chikyu-earth") as ChikyuEarth;
62
+ * console.log(earth.stats.seaNames.on);
63
+ * ```
64
+ */
65
+ get stats(): {
66
+ seaNames: SeaNamesStats;
67
+ };
38
68
  /** The distance, bearings and flight-time estimate for `route`, or null when none is set. The flight time assumes 900 km/h. */
39
69
  get routeInfo(): RouteLeg | null;
40
70
  /** A box laid over the globe for markers (see `@johnmorrisdotca/chikyu-earth/markers`): where it is, the pose of the last drawing, and a way to hear the next. */
package/dist/element.js CHANGED
@@ -6,6 +6,9 @@ import { globe } from "./globe.js";
6
6
  import { readRoute, routeLeg, routeText } from "./route.js";
7
7
  import { cleanStyle } from "./styles.js";
8
8
  import { globeBaseScale, HOME_VIEW, lookAt } from "./view.js";
9
+ import { project } from "./markers/project.js";
10
+ import { readSeaNames } from "./sea-names/geometry.js";
11
+ import { SEA_NAMES_STYLE, createSeaHost } from "./sea-names/host.js";
9
12
  const readCentre = (value) => {
10
13
  if (!value)
11
14
  return null;
@@ -22,7 +25,7 @@ const LIVE_MS = 1000 / 30;
22
25
  const AUTO_MS = 1000;
23
26
  /** Tilt to the poles; zoom from a tenth of Fit, which leaves the whole globe small in the view, to 20 times: the outlines are Natural Earth 1:110m, and past about 20 times their straight segments are longer than the view is wide. */
24
27
  const LIMITS = { tiltMax: 90, zoomMin: 0.1, zoomMax: 20 };
25
- const STYLE = ":host{display:block;position:relative;isolation:isolate}.holder svg{display:block;width:100%;height:auto}.overlay{position:absolute;inset:0;pointer-events:none;transform-origin:50% 50%}";
28
+ const STYLE = ":host{display:block;position:relative;isolation:isolate}.holder svg{display:block;width:100%;height:auto}.overlay{position:absolute;inset:0;pointer-events:none;transform-origin:50% 50%}" + SEA_NAMES_STYLE;
26
29
  /**
27
30
  * The `<chikyu-earth>` custom element: the line globe, drawn as SVG in its shadow root. Importing this entry point registers the tag once. It takes the attributes `size` (pixels, 320 by default), `center` (`"lon,lat"`; wins over the browser's location), `look` (`line` or `thick`; `style` is the older name for it, and a framework that reads `style` as CSS cannot use it) and `graticule`, and a shared view controller's camera through `setView`.
28
31
  * It carries kazoku-ui's controls itself: a drag turns it, two fingers pinch, Ctrl and the wheel zoom (a plain wheel at Fit scrolls the page) and the arrow keys, + and - work once it is focused, from a tenth of Fit to 20 times. `controls="none"` turns them off; `zoom-min` and `zoom-max` change the range. A `<kazoku-view-controls for="...">` on the element takes the hands over, and the page applies its events with `setView`.
@@ -38,12 +41,13 @@ const STYLE = ":host{display:block;position:relative;isolation:isolate}.holder s
38
41
  * ```
39
42
  */
40
43
  export class ChikyuEarth extends HTMLElement {
41
- static observedAttributes = ["center", "look", "style", "size", "graticule", "route"];
44
+ static observedAttributes = ["center", "look", "style", "size", "graticule", "route", "sea-names", "lang"];
42
45
  #centre = { lon: 0, lat: 0 };
43
46
  #view = { ...HOME_VIEW };
44
47
  #drawn = { ...HOME_VIEW };
45
48
  #listeners = new Set();
46
49
  #overlay;
50
+ #seas;
47
51
  #pose = null;
48
52
  #liveTimer;
49
53
  #liveAt = 0;
@@ -69,6 +73,42 @@ export class ChikyuEarth extends HTMLElement {
69
73
  else
70
74
  this.setAttribute("route", routeText(value));
71
75
  }
76
+ /**
77
+ * Names of oceans, seas and continents (the attribute `sea-names`). Off unless set: a bare attribute is on. Oceans and continents from far out, seas once the Earth is large on the screen. Nothing is drawn again at rest.
78
+ *
79
+ * @example
80
+ * ```ts no-run
81
+ * import type { ChikyuEarth } from "@johnmorrisdotca/chikyu-earth/element";
82
+ *
83
+ * const earth = document.querySelector("chikyu-earth") as ChikyuEarth;
84
+ * earth.seaNames = true;
85
+ * console.log(earth.seaNames);
86
+ * earth.seaNames = false;
87
+ * ```
88
+ */
89
+ get seaNames() {
90
+ return readSeaNames(this.getAttribute("sea-names"));
91
+ }
92
+ set seaNames(value) {
93
+ if (value)
94
+ this.setAttribute("sea-names", "");
95
+ else
96
+ this.removeAttribute("sea-names");
97
+ }
98
+ /**
99
+ * Whether `sea-names` is on, the Earth's radius on the screen, the names shown, and how many times they were laid out.
100
+ *
101
+ * @example
102
+ * ```ts no-run
103
+ * import type { ChikyuEarth } from "@johnmorrisdotca/chikyu-earth/element";
104
+ *
105
+ * const earth = document.querySelector("chikyu-earth") as ChikyuEarth;
106
+ * console.log(earth.stats.seaNames.on);
107
+ * ```
108
+ */
109
+ get stats() {
110
+ return { seaNames: this.#seas?.stats ?? { on: false, radius: 0, names: 0, renders: 0 } };
111
+ }
72
112
  /** The distance, bearings and flight-time estimate for `route`, or null when none is set. The flight time assumes 900 km/h. */
73
113
  get routeInfo() {
74
114
  const route = this.route;
@@ -91,6 +131,8 @@ export class ChikyuEarth extends HTMLElement {
91
131
  this.#liveTimer = undefined;
92
132
  this.#hands?.unbind();
93
133
  this.#hands = undefined;
134
+ this.#seas?.dispose();
135
+ this.#seas = undefined;
94
136
  }
95
137
  connectedCallback() {
96
138
  this.#centre = readCentre(this.getAttribute("center")) ?? { lon: 0, lat: 0 };
@@ -188,6 +230,44 @@ export class ChikyuEarth extends HTMLElement {
188
230
  root.querySelector(".holder").innerHTML = svg;
189
231
  this.#drawn = { ...this.#view };
190
232
  this.#publish("");
233
+ this.#placeSeas();
234
+ }
235
+ /** Lays the ocean, sea and continent names on the picture just drawn. Off, or at rest, it adds nothing. */
236
+ #placeSeas() {
237
+ const root = this.shadowRoot;
238
+ if (!root)
239
+ return;
240
+ if (!this.#seas) {
241
+ this.#seas = createSeaHost({
242
+ root,
243
+ attribute: (name) => this.getAttribute(name),
244
+ language: () => ((this.closest("[lang]")?.getAttribute("lang") ?? "").toLowerCase().startsWith("ja") ? "ja" : "en"),
245
+ });
246
+ }
247
+ this.#seas.refresh();
248
+ if (!readSeaNames(this.getAttribute("sea-names"))) {
249
+ this.#seas.frame(null);
250
+ return;
251
+ }
252
+ const size = Number(this.getAttribute("size")) || 320;
253
+ const k = (this.clientWidth || size) / size;
254
+ const look = lookAt(this.#centre, this.#drawn);
255
+ const radius = globeBaseScale(size) * this.#drawn.zoom * k;
256
+ const cx = (size / 2 + this.#drawn.panX) * k;
257
+ const cy = (size / 2 + this.#drawn.panY) * k;
258
+ const pose = { lon: look.lon, lat: look.lat, radius, cx, cy };
259
+ this.#seas.frame({
260
+ width: size * k,
261
+ height: size * k,
262
+ radius,
263
+ disc: { x: cx, y: cy, radius },
264
+ project: (lon, lat, out) => {
265
+ const at = project(lon, lat, pose);
266
+ out.x = at.x;
267
+ out.y = at.y;
268
+ return at.z;
269
+ },
270
+ });
191
271
  }
192
272
  }
193
273
  if (typeof customElements !== "undefined" && !customElements.get("chikyu-earth")) {
@@ -1,4 +1,4 @@
1
- import { type HereCitySource } from "./here-city.ts";
1
+ import { type HereCitySource, type HereTown } from "./here-city.ts";
2
2
  import type { Place } from "./places.ts";
3
3
  export interface HereCityHost {
4
4
  /** `false` leaves every label as the page set it. A number is the kilometre limit. */
@@ -23,6 +23,8 @@ export interface HereCityOptions {
23
23
  onError?(error: unknown): void;
24
24
  /** The city list. The default is kuni's capitals, cities of a million and cities of 100,000, loaded only when a `here` place asks. */
25
25
  load?(): Promise<HereCitySource>;
26
+ /** One country's cities, every tier. The default is kuni's `citiesOf`, once per country. */
27
+ towns?(country: string): Promise<readonly HereTown[] | null>;
26
28
  }
27
29
  /**
28
30
  * The namer for one element. `load` runs at most once, and only after `setLimit` is a number and `named` is given a `here` place.
@@ -1,17 +1,28 @@
1
1
  // Loads kuni's cities once, when `here-city` is on and a `here` place is set, and names those places. Nothing is loaded while it is off, and nothing is asked again at rest.
2
- import { HERE_CITY_TIERS, hereCityLabels } from "./here-city.js";
2
+ import { HERE_CITY_TIERS, chooseHereCity, hereCountries } from "./here-city.js";
3
3
  const defaultLoad = async () => {
4
4
  const { loadCities } = await import("@johnmorrisdotca/kuni/cities");
5
5
  return loadCities(...HERE_CITY_TIERS);
6
6
  };
7
+ const defaultTowns = async (country) => {
8
+ const { citiesOf } = await import("@johnmorrisdotca/kuni/cities");
9
+ return citiesOf(country);
10
+ };
11
+ const cityText = (name, lang) => {
12
+ const ja = lang === "ja" ? (name.jaShort || name.ja) : undefined;
13
+ return ja || name.en;
14
+ };
7
15
  /**
8
16
  * The namer for one element. `load` runs at most once, and only after `setLimit` is a number and `named` is given a `here` place.
9
17
  */
10
18
  export function createHereCity(options) {
11
19
  const load = options.load ?? defaultLoad;
20
+ const townsOf = options.towns ?? defaultTowns;
12
21
  let limit = false;
13
22
  let source = null;
14
23
  let loading = false;
24
+ const townCache = new Map();
25
+ const townWait = new Map();
15
26
  let failed = false;
16
27
  let gone = false;
17
28
  let generation = 0;
@@ -25,6 +36,33 @@ export function createHereCity(options) {
25
36
  const onLanguage = () => queueMicrotask(changed);
26
37
  if (typeof document !== "undefined")
27
38
  document.addEventListener("kazoku-languagechange", onLanguage);
39
+ const askTowns = (codes) => {
40
+ let started = false;
41
+ for (const code of codes) {
42
+ if (townCache.has(code) || townWait.has(code))
43
+ continue;
44
+ started = true;
45
+ const job = Promise.resolve()
46
+ .then(() => townsOf(code))
47
+ .then((list) => {
48
+ if (!townCache.has(code))
49
+ townCache.set(code, list ?? []);
50
+ }, (error) => {
51
+ if (!townCache.has(code))
52
+ townCache.set(code, []);
53
+ options.onError?.(error);
54
+ })
55
+ .finally(() => {
56
+ townWait.delete(code);
57
+ });
58
+ townWait.set(code, job.then(() => undefined));
59
+ }
60
+ if (started)
61
+ void Promise.all([...townWait.values()]).then(() => {
62
+ if (!gone)
63
+ changed();
64
+ });
65
+ };
28
66
  const ensure = () => {
29
67
  if (loading || source || failed || gone)
30
68
  return;
@@ -71,9 +109,33 @@ export function createHereCity(options) {
71
109
  return places;
72
110
  }
73
111
  const lang = options.language();
74
- if (cache && cache.places === places && cache.lang === lang && cache.limit === limit && cache.source === source)
112
+ const wanted = new Set();
113
+ for (const place of places) {
114
+ if (place.kind !== "here")
115
+ continue;
116
+ for (const code of hereCountries({ lat: place.lat, lon: place.lon }, source, limit))
117
+ wanted.add(code);
118
+ }
119
+ askTowns([...wanted]);
120
+ if ([...wanted].some((code) => !townCache.has(code)))
121
+ return places;
122
+ if (cache && cache.places === places && cache.lang === lang && cache.limit === limit && cache.source === source && cache.towns === townCache.size)
75
123
  return cache.out;
76
- const hits = new Map(hereCityLabels(places, source, { lang, maxKm: limit }).map((hit) => [hit.index, hit]));
124
+ const hits = new Map();
125
+ for (const [index, place] of places.entries()) {
126
+ if (place.kind !== "here")
127
+ continue;
128
+ const point = { lat: place.lat, lon: place.lon };
129
+ const codes = hereCountries(point, source, limit);
130
+ const towns = codes.flatMap((code) => townCache.get(code) ?? []);
131
+ const chosen = chooseHereCity(point, source.nearest(point, { maxKm: limit }), towns, limit);
132
+ if (!chosen)
133
+ continue;
134
+ const label = cityText(chosen.name, lang).trim().slice(0, 80);
135
+ if (!label)
136
+ continue;
137
+ hits.set(index, { id: chosen.id, label });
138
+ }
77
139
  let changed = false;
78
140
  const out = places.map((place, index) => {
79
141
  const hit = hits.get(index);
@@ -83,14 +145,14 @@ export function createHereCity(options) {
83
145
  return { ...place, label: hit.label };
84
146
  });
85
147
  const labelled = changed ? out : places;
86
- cache = { places, lang, limit, source, out: labelled };
148
+ cache = { places, lang, limit, source, towns: townCache.size, out: labelled };
87
149
  return labelled;
88
150
  },
89
151
  refresh() {
90
152
  changed();
91
153
  },
92
154
  get stats() {
93
- return { on: limit !== false, maxKm: limit === false ? 0 : limit, loaded: source !== null, pending: loading };
155
+ return { on: limit !== false, maxKm: limit === false ? 0 : limit, loaded: source !== null, pending: loading || townWait.size > 0 };
94
156
  },
95
157
  dispose() {
96
158
  gone = true;
@@ -22,7 +22,7 @@ export declare const HERE_CITY_KM = 100;
22
22
  */
23
23
  export declare const HERE_CITY_MAX_KM = 20000;
24
24
  /**
25
- * The kuni tiers a `here` marker's city is chosen from. A city of fewer than 100,000 people is in none of them.
25
+ * The kuni tiers a `here` marker looks through first. A smaller town is read afterwards from that city's country, one country file at a time.
26
26
  *
27
27
  * @example
28
28
  * ```ts
@@ -57,9 +57,42 @@ export interface HereCitySource {
57
57
  ja?: string;
58
58
  jaShort?: string;
59
59
  };
60
+ country?: string;
60
61
  };
61
62
  km: number;
62
63
  } | null;
64
+ /** Cities of the three tiers within `maxKm`, nearest first. Used to notice a second country across a border. */
65
+ within?(point: {
66
+ lat: number;
67
+ lon: number;
68
+ }, maxKm: number): readonly {
69
+ city: {
70
+ country?: string;
71
+ };
72
+ km: number;
73
+ }[];
74
+ }
75
+ /**
76
+ * A city from one country's file, including towns under 100,000.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * import type { HereTown } from "@johnmorrisdotca/chikyu-earth/markers";
81
+ *
82
+ * const town: HereTown = { id: "ne:1", name: { en: "Smallville" }, lat: 1, lon: 2 };
83
+ * console.log(town.name.en);
84
+ * ```
85
+ */
86
+ export interface HereTown {
87
+ id: string;
88
+ name: {
89
+ en: string;
90
+ ja?: string;
91
+ jaShort?: string;
92
+ };
93
+ lat: number;
94
+ lon: number;
95
+ country?: string;
63
96
  }
64
97
  /**
65
98
  * The city chosen for one `here` place.
@@ -126,3 +159,63 @@ export declare function hereCityLabels(places: readonly Pick<Place, "lon" | "lat
126
159
  lang: "en" | "ja";
127
160
  maxKm: number;
128
161
  }): HereCityHit[];
162
+ /**
163
+ * At most two countries to read for a place. The first is the country of the nearest city in the three tiers, however far.
164
+ * The second is added only when a city of another country is also inside the limit: a place near a border. `src/countries.ts` has no point-in-country test, so the country comes from those cities.
165
+ *
166
+ * @param point - The place.
167
+ * @param source - The three tiers.
168
+ * @param maxKm - The limit, in kilometres.
169
+ * @returns ISO codes, upper case, at most two.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * import { hereCountries } from "@johnmorrisdotca/chikyu-earth/markers";
174
+ *
175
+ * const source = {
176
+ * nearest: () => ({ city: { id: "a", name: { en: "A" }, country: "fr" }, km: 30 }),
177
+ * within: () => [{ city: { country: "fr" }, km: 30 }, { city: { country: "de" }, km: 40 }],
178
+ * };
179
+ * console.log(hereCountries({ lat: 49, lon: 8 }, source, 100).join(" "));
180
+ * ```
181
+ */
182
+ export declare function hereCountries(point: {
183
+ lat: number;
184
+ lon: number;
185
+ }, source: HereCitySource, maxKm: number): string[];
186
+ /**
187
+ * The city to draw: the nearest of the coarse hit and the towns, and only when it is within `maxKm`. A town closer than the big city wins.
188
+ *
189
+ * @param point - The place.
190
+ * @param coarse - The nearest city of the three tiers inside the limit, or null.
191
+ * @param towns - The cities of the one or two countries read for this place.
192
+ * @param maxKm - The limit, in kilometres.
193
+ * @returns The city and its distance, or null when none is close enough.
194
+ *
195
+ * @example
196
+ * ```ts
197
+ * import { chooseHereCity } from "@johnmorrisdotca/chikyu-earth/markers";
198
+ *
199
+ * const town = { id: "v", name: { en: "Village" }, lat: 0.05, lon: 0 };
200
+ * const chosen = chooseHereCity({ lat: 0, lon: 0 }, { city: { id: "c", name: { en: "City" } }, km: 40 }, [town], 100);
201
+ * console.log(chosen?.id);
202
+ * ```
203
+ */
204
+ export declare function chooseHereCity(point: {
205
+ lat: number;
206
+ lon: number;
207
+ }, coarse: {
208
+ city: {
209
+ id: string;
210
+ name: {
211
+ en: string;
212
+ ja?: string;
213
+ jaShort?: string;
214
+ };
215
+ };
216
+ km: number;
217
+ } | null, towns: readonly HereTown[], maxKm: number): {
218
+ id: string;
219
+ name: HereTown["name"];
220
+ km: number;
221
+ } | null;