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

projectionViewfunction

What the projection is given for a view: yaw turns longitude, tilt tips latitude, zoom scales and pan moves the disc in CSS pixels.

Import it

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

Definition

function projectionView(centre: GeoPoint, size: number, view?: GlobeView): ProjectionView

Parameters

NameTypeDescription
centreGeoPoint

The home centre.

sizenumber

The width and height of the square the globe is drawn in, in pixels.

view (optional)GlobeView

The turn, tip, zoom and pan; the home view when left out.

Returns

ProjectionView

The rotation, scale and translation for d3-geo's orthographic projection.

Examples

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

console.log(projectionView({ lon: 139.7, lat: 35.7 }, 420, { yaw: 10, tilt: 5, zoom: 2, panX: 0, panY: 0 }));
{
  rotation: [ -129.7, -30.700000000000003 ],
  scale: 418,
  translate: [ 210, 210 ]
}

What it prints (run when this page was built)

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