Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

ChizuProjectiontype

How a map's canvas was made from the earth, enough to put a longitude and latitude on it (projectPoint): Miller's cylindrical projection round a centre longitude (the world), a Lambert azimuthal equal-area projection round a centre (one country on its own), or, for a city or a single venue (localMap), a transverse Mercator on the WGS 84 ellipsoid round a centre (radius is its rectifying radius, in metres), a unit of the canvas being metresPerUnit metres.

Import it

import type { ChizuProjection } from "@johnmorrisdotca/chizu";

Definition

type ChizuProjection = {
    kind: "miller";
    centre: number;
    scale: number;
    translate: [
        number,
        number
    ];
} | {
    kind: "azimuthal-equal-area";
    centre: [
        number,
        number
    ];
    scale: number;
    translate: [
        number,
        number
    ];
} | {
    kind: "local";
    centre: [
        number,
        number
    ];
    radius: number;
    metresPerUnit: number;
    translate: [
        number,
        number
    ];
} | {
    kind: "other";
    description: string;
};

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import type { ChizuProjection } from "@johnmorrisdotca/chizu";

const projection: ChizuProjection = WORLD.projection;
console.log(projection.kind, projection.kind === "miller" ? projection.centre : "");
// miller 155
miller 155

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.