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

shiftedOutlinesfunction

Copies of the outlines translated horizontally by the supplied map-unit offset.

Import it

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

Definition

function shiftedOutlines(outlines: readonly MapOutline[], by: number): MapOutline[]

Parameters

NameTypeDescription
outlinesreadonly MapOutline[]

Native parsed region outlines, including their region identifiers.

bynumber

The second segment endpoint’s vertical map coordinate.

Returns

MapOutline[]

Copies of the outlines translated horizontally by the supplied map-unit offset.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { mapOutlines, shiftedOutlines } from "@johnmorrisdotca/chizu";

// The world's outlines one turn of the earth to the east, for the copy drawn beside it.
const shifted = shiftedOutlines(mapOutlines(WORLD), WORLD.width);
console.log(Math.round(shifted[0]!.rings[0]!.minX - mapOutlines(WORLD)[0]!.rings[0]!.minX));
// 1000
1000

What it prints (run when this page was built)

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