本文へ移動

Chizu地図

SVGの地図を描き、地域を表示範囲に収め、番号付きの注記や地理クイズを英語と日本語の名前で作れます。

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

目次

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

ChizuLocalMap型

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

A map of a small place: a ChizuMap (so every function of the engine takes it) whose canvas is a city or a venue in a local projection, whose regions are the polygons of the data, and which also holds the lines, points, pictures and credits that drawLocal draws.

インポート

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

定義

interface ChizuLocalMap extends ChizuMap {
    kind: "local";
    shapes: ChizuLocalShape[];
    markers: ChizuLocalMarker[];
    credits: string[];
    problems: string[];
}

メンバー

名前型説明
kind"local"

What its regions are: the whole world, a single country, the divisions of one, or the shapes of a local map of a city or a venue.

shapesChizuLocalShape[]

Every shape of the data, in the order given: areas, lines and points.

markersChizuLocalMarker[]
creditsstring[]
problemsstring[]

What was left out of the data, and why, one line each.

idstring

world, country-fr (France alone, from Natural Earth's countries) or divisions-fr (its départements).

namestring

The map's name in English and Japanese.

nameJa (省略可)string | undefined
regionNamestring

What a region is called here, singular and plural, in English: Country, Province.

regionNamePluralstring
viewBoxstring

The canvas: 0 0 width height.

widthnumber
heightnumber
wrapsboolean

Whether its east edge is its west edge: a map of the earth is a cylinder cut open, and pans round without stopping.

projectionChizuProjection
insetsChizuInset[]

The regions drawn in boxes of their own.

sourcestring

Where the outlines come from, in a line.

regionsChizuRegion[]

例

import { localMap, type ChizuLocalMap } from "@johnmorrisdotca/chizu";

const map: ChizuLocalMap = localMap({ centre: [139.7006, 35.7004], widthMetres: 500 });
console.log(map.kind, map.viewBox, map.projection.kind === "local" && map.projection.metresPerUnit);
// local 0 0 1000 1000 0.5
local 0 0 1000 1000 0.5

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

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

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