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

unprojectPointfunction

The longitude and latitude (in degrees) of a point on the map's canvas, as [lon, lat]; null where projectPoint is.

Import it

import { unprojectPoint } from "@johnmorrisdotca/chizu";

Definition

function unprojectPoint(map: Pick<ChizuMap, "projection">, x: number, y: number): [number, number] | null

Parameters

NameTypeDescription
mapPick<ChizuMap, "projection">

The native map or map fields required by this signature; coordinates and region codes belong to its canvas.

xnumber

The horizontal native map coordinate.

ynumber

The vertical native map coordinate.

Returns

[number, number] | null

The [longitude, latitude] pair in degrees, or null when the map’s projection is not reversible here.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { projectPoint, unprojectPoint } from "@johnmorrisdotca/chizu";

const [x, y] = projectPoint(WORLD, 2.35, 48.86)!;
console.log(unprojectPoint(WORLD, x, y)!.map((value) => value.toFixed(2)).join(", "));
// 2.35, 48.86
2.35, 48.86

What it prints (run when this page was built)

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