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 · Markers on the globe

Markerstype

The markers on one globe: add, update, remove and find them, show or hide groups, and detach.

Import it

import type { Markers } from "@johnmorrisdotca/chikyu-earth/markers";

Definition

interface Markers {
    add(marker: MarkerInput): void;
    addAll(markers: readonly MarkerInput[]): void;
    update(id: string, patch: Partial<Omit<MarkerInput, "id">>): void;
    remove(id: string): void;
    clear(): void;
    get(id: string): MarkerInput | undefined;
    list(): MarkerInput[];
    readonly size: number;
    groups(): GroupInfo[];
    showGroup(name: string): void;
    hideGroup(name: string): void;
    toggleGroup(name: string, force?: boolean): boolean;
    readonly stats: {
        markers: number;
        clusters: number;
        labels: number;
        renders: number;
    };
    detach(): void;
}

Members

NameTypeDescription
add(marker: MarkerInput): void
addAll(markers: readonly MarkerInput[]): void
update(id: string, patch: Partial<Omit<MarkerInput, "id">>): void
remove(id: string): void
clear(): void
get(id: string): MarkerInput | undefined
list(): MarkerInput[]
sizenumber
groups(): GroupInfo[]
showGroup(name: string): void
hideGroup(name: string): void
toggleGroup(name: string, force?: boolean): boolean

Show it if hidden and hide it if shown (or set it with force). Returns whether it is shown.

stats{ markers: number; clusters: number; labels: number; renders: number; }

Markers and clusters drawn at the last render (for a page or a test).

detach(): void

Examples

import { attachMarkers, type Markers, type OverlayElement } from "@johnmorrisdotca/chikyu-earth/markers";

declare const earth: OverlayElement;
const markers: Markers = attachMarkers(earth);
markers.add({ id: "tokyo", lon: 139.69, lat: 35.69, label: "Tokyo", group: "Cities" });
markers.toggleGroup("Cities");
console.log(markers.size, markers.groups());

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