Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · The realistic Earth's pure parts

CityLayoutOptionstype

What the names are laid out with: the most names, the text size in pixels and the dot's radius, and how squarely a city must face the viewer (0.12 by default).

Import it

import type { CityLayoutOptions } from "@johnmorrisdotca/chikyu-earth/realistic";

Definition

interface CityLayoutOptions {
    max: number;
    size: number;
    dot: number;
    facing?: number;
    measure?: (text: string) => number;
    taken?: readonly {
        left: number;
        top: number;
        width: number;
        height: number;
    }[];
}

Members

NameTypeDescription
maxnumber
sizenumber
dotnumber
facing (optional)number | undefined

Cities that face the viewer less squarely than this are left out, so none crowds the limb (0.12).

measure (optional)((text: string) => number) | undefined

The width of a name as the browser draws it, in the font the name is drawn in (a canvas's measureText): the estimate from the length is a floor, and the larger of the two is used. A machine whose font has wider letters than the estimate takes (a fallback font for Japanese, say) would otherwise lay names over one another. Left out, the estimate alone is used, as in Node.

taken (optional)readonly { left: number; top: number; width: number; height: number; }[] | undefined

Boxes another layer's names, rings and marks already take (left, top, width and height from the picture's top left): no name is put over one.

Examples

import type { CityLayoutOptions } from "@johnmorrisdotca/chikyu-earth/realistic";

const options: CityLayoutOptions = { max: 24, size: 12, dot: 3 };
console.log(options.max);
24

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.51.1.