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

CityFrametype

Where the Earth is on the screen at one draw: the box, the Earth's radius in pixels, and a way to find a place on it.

Import it

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

Definition

interface CityFrame {
    width: number;
    height: number;
    radius: number;
    project(lon: number, lat: number, out: {
        x: number;
        y: number;
    }): number;
}

Members

NameTypeDescription
widthnumber
heightnumber
radiusnumber

The Earth's radius on the screen, in CSS pixels.

project(lon: number, lat: number, out: { x: number; y: number; }): number

Writes where a place falls in the box and answers how squarely it faces the viewer: the cosine of the angle between the ground's upward and the line to the viewer, above 0 in sight, 1 at the middle of the disc.

Examples

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

const frame: CityFrame = { width: 400, height: 400, radius: 150, project: (lon, lat, out) => { out.x = 200 + lon; out.y = 200 - lat; return 1; } };
console.log(frame.radius);
150

What it prints (run when this page was built)

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