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

Draw maps as SVG

import { … } from "@johnmorrisdotca/chizu/draw";

16.2 kB minified and gzipped, with everything it imports (measured with esbuild)

Chizu's drawing: a map as SVG text (drawChizu) and a city or a venue as SVG text (drawLocal), with the style that gives it its look. A separate entry (@johnmorrisdotca/chizu/draw), so a page that only needs to know which country is nearest never loads any of it.

Exports

NameKindWhat it is
CHIZU_LOCAL_STYLEconstantTHE LOOK OF A LOCAL MAP (drawLocal), as CSS that goes beside CHIZU_STYLE: the ground, and the shapes a caller's GeoJSON draws, in the same custom properties and the same light and dark.
CHIZU_STYLEconstantTHE STYLE a chizu drawing wears: the colours of its land and sea as custom properties, and the one rule that matters for a map pressed with fingers: nothing in the drawing can be selected, dragged or double-tapped.
ChizuDrawOptionstypeWhat a drawing shows beyond the map itself.
ChizuLocalDrawOptionstypeWhat a drawing of a local map shows beyond the shapes.
ChizuLocalStyletypeHow one shape of a local map looks, over the look of its kind: colours as drawChizu's colors takes them (hex, a CSS name, rgb(), hsl() or var(--name), anything else ignored), with a second for the dark look, and the classes and custom properties of your own.
drawChizufunctionA map as SVG text: the sea, every region's land with its tone, the frames of its insets, and optionally the names and the numbered callouts.
drawLocalfunctionA local map as SVG text: the ground, the caller's shapes in the order given (areas, lines, points), the pictures at their places, true size and bearing, and optionally names, numbered callouts, a scale bar in metres and the credit lines.
isChizuColourfunctionWhether colour is one drawChizu's colors will draw.

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