Skip to content

Write the names of the constellations and the planets - #19

Merged
rhannequin merged 2 commits into
mainfrom
label-the-sky
Oct 28, 2026
Merged

rhannequin merged 2 commits into
mainfrom
label-the-sky

Conversation

@rhannequin

@rhannequin rhannequin commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Adds names to the map:

chart.render(
  Skymap::Layers::ConstellationLines.new(lines: lines, stars: stars),
  Skymap::Layers::ConstellationNames.new(lines: lines, stars: stars),
  Skymap::Layers::Stars.new(stars: stars),
  Skymap::Layers::Planets.new(ephem: ephem, labels: true)
)
  • ConstellationNames writes each name in the middle of the biggest part of the constellation that is above the horizon, so a figure in several parts such as Serpens is named on one of its parts. A constellation is left out when half of its stars or more are below the horizon, or when it has no lines (Mensa and Microscopium)
  • Planets writes the name of each planet next to it with labels: true, on the side of the center of the map so it stays inside the sky. It is off by default, and names: changes the names
  • The names come from a new data/constellations/iau/names.csv. Astronoby has names too, but it keeps only the first word of the names with several words ("Ursa Minor" becomes "Ursa") and fails to read "Boötes" when the locale is ASCII
  • names: takes anything that gives a name from an abbreviation, such as a hash, so the names can be translated. A constellation without a name is left out
  • Both kinds of names are drawn with a new Renderer::Caption, which has a color for each kind

The map of the README shows the names. The Moon is drawn after them there and covers Aquarius, which is only a matter of layer order.

ConstellationNames writes the name of each constellation in the middle of its stars. Planets writes the name of each planet under it with labels: true.

The names come from a new names.csv, because Astronoby cuts the names with several words and can't read Boötes with an ASCII locale. They can be replaced with names:, for example to translate them.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the constellation-name and optional planet-label changes.

No open issues 🎉

What changed in this PR

Adds constellation names and optional planet labels to Skymap’s layered SVG rendering, with customizable constellation names for translation.

Changes:

  • Adds a UTF-8 catalog of all 88 constellation names and a layer that labels constellations when more than half their supplied stars are above the horizon.
  • Introduces shared caption rendering with distinct colors for constellation and planet names.
  • Adds tests, documents the new options, and updates the example map.
File Description
spec/​skymap/​renderer/​svg_spec.rb Tests caption positioning, sizing, and colors.
spec/​skymap/​layers/​planets_spec.rb Tests default behavior and optional planet labels.
spec/​skymap/​layers/​constellation_names_spec.rb Tests visibility, placement, scaling, and custom names.
spec/​skymap/​catalog/​constellation_names_spec.rb Tests name lookup, accents, and catalog completeness.
sky_map.svg Adds constellation and planet names to the example map.
README.md Documents naming layers, options, and catalog data.
lib/​skymap/​renderer/​svg.rb Renders captions using shared text drawing and kind-specific colors.
lib/​skymap/​renderer/​caption.rb Defines the caption rendering data type.
lib/​skymap/​layers/​planets.rb Adds optional names beneath visible planets.
lib/​skymap/​layers/​constellation_names.rb Places constellation names among their visible stars.
lib/​skymap/​catalog/​constellation_names.rb Loads UTF-8 names and supports abbreviation lookup.
lib/​skymap.rb Loads the new catalog, layer, and caption type.
data/​constellations/​iau/​names.csv Supplies names for all 88 IAU constellations.
CHANGELOG.md Records constellation naming and optional planet labels.

Review effort: Balanced

Planet names go on the side of the center of the map, so they stay inside the sky. A constellation is named in the middle of its biggest part above the horizon, which keeps Serpens on its own stars. Planet names can be changed with names:.

The size of the names and the lookup of stars by HR number are shared by the layers.
@rhannequin
rhannequin merged commit dc91a21 into main Oct 28, 2026
4 checks passed
@rhannequin
rhannequin deleted the label-the-sky branch October 28, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants