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 globe as an SVG string

globefunction

The globe as an SVG string, turned to rotation and drawn in style, size pixels square. It is pure: the same options always give the same markup, so it runs on a server, in a test or in a build step with no DOM.

Import it

import { globe } from "@johnmorrisdotca/chikyu-earth";

Definition

function globe(options?: GlobeOptions): string

Parameters

NameTypeDescription
options (optional)GlobeOptions

Size, turn, look and graticule; every one has a default, so globe() draws a 320-pixel globe facing the Greenwich meridian.

Returns

string

One <svg> element as text, with the country outlines as paths.

Examples

import { globe } from "@johnmorrisdotca/chikyu-earth";

const svg = globe({ size: 240, rotation: [-139.7, -35.7], style: "line" });
console.log(svg.slice(0, 60));
console.log(svg.length > 10_000);
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240
true

What it prints (run when this page was built)

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