本文へ移動

Chizu地図

世界、253の国、33か国の州や県などの地域を、SVGの地図に描けます。表示する範囲を決めたり、番号付きの注記をつけたり、地理クイズを作ったりもできます。名前は今のところ英語と日本語で、スペイン語、ドイツ語、中国語にも対応する予定です。

「地図」は、土地や場所を図で表したものです。 名前について(英語)

目次

リファレンス · 表示範囲・形・クイズの道具

overlaysSvg関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The overlays as SVG: one group, cz-overlays, the areas first, then the lines, then the marks, each repeated at the whole-width shifts round a world map that reach the window. Points that are not numbers are left out; a latitude past a pole is held to it.

インポート

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

定義

function overlaysSvg(map: ChizuMap, overlays: readonly ChizuOverlay[], box: MapBox): string

引数

名前型説明
mapChizuMap

The map they are drawn on.

overlaysreadonly ChizuOverlay[]

The overlays, in the order they are drawn within their kind.

boxMapBox

The window shown: the copies round a world map reach it, and a mark's label is sized to it.

戻り値

string

The group, empty when there is nothing to draw.

例

import WORLD from "@johnmorrisdotca/chizu/world";
import { overlaysSvg, wholeMapBox } from "@johnmorrisdotca/chizu";

const svg = overlaysSvg(WORLD, [{ kind: "mark", at: [0, 0], label: "0, 0" }], wholeMapBox(WORLD));
console.log(svg.includes('class="cz-overlay-mark"'));
// true
true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/chizu 1.17.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。