ChizuFeature型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
One named physical feature on a map's canvas: a sea, a lake, a river, a landform or a peak. It has the fields a
region has that the engine reads (code, path, bbox, centroid, neighbors, group, the names), so
featureMap makes a layer a map of its own and every function of the engine (framing, quizzes, pasted names,
callouts) works on features as it works on regions.
インポート
import type { ChizuFeature } from "@johnmorrisdotca/chizu";
定義
interface ChizuFeature {
code: string;
kind: ChizuFeatureKind;
group: ChizuFeatureGroup;
name: string;
nameJa?: string;
reading?: string;
rank: number;
elevation?: number;
path: string;
bbox: [
number,
number,
number,
number
];
centroid: [
number,
number
];
angle?: number;
neighbors: string[];
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
code | string | Its stable id: its Wikidata item ( |
kind | ChizuFeatureKind | |
group | ChizuFeatureGroup | |
name | string | Its English name: Natural Earth's for a sea, a landform or a peak, Wikidata's label for a lake or a river. |
nameJa (省略可) | string | undefined | Its Japanese name: Natural Earth's ( |
reading (省略可) | string | undefined | How |
rank | number | Natural Earth's rank: 0 for an ocean, up to 10 for a small lake or a short river, for the scale it may be shown at. |
elevation (省略可) | number | undefined | A peak's height, in metres. |
path | string | Its shape on the map's canvas: closed rings ( |
bbox | [number, number, number, number] | The box round it on the canvas: left, top, right, bottom. |
centroid | [number, number] | Where its name goes: the point inside an area farthest from its edges, a point half way along a river, a peak itself. |
angle (省略可) | number | undefined | The angle a river's name is written at, in degrees clockwise, to run along it there; absent for 0. |
neighbors | string[] | The codes of the water features it touches on this map: a sea's neighbouring seas, a river's tributaries and the lakes it runs through. |
例
import { loadFeatures } from "@johnmorrisdotca/chizu/load";
import type { ChizuFeature } from "@johnmorrisdotca/chizu";
const layer = (await loadFeatures("divisions-jp"))!;
const biwa: ChizuFeature = layer.features.find((one) => one.nameJa === "琵琶湖")!;
console.log(biwa.code, biwa.kind, biwa.name, biwa.reading);
// Q200239 lake Lake Biwa びわこQ200239 lake Lake Biwa びわこ出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。