loadFeatures関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The named features of a map (its seas, lakes, rivers, landforms and peaks), drawn on its own canvas, by the map or its
id: a file of its own, fetched only when asked for. null for a map that has none. Pass it to drawChizu and
mountChizu as featureLayer, with features: ["water"] (or any group or kind) to draw them; mountChizu also
takes this function itself, and fetches each map's layer the first time it is shown.
インポート
import { loadFeatures } from "@johnmorrisdotca/chizu/load";
定義
function loadFeatures(map: string | Pick<ChizuMap, "id">): Promise<ChizuFeatureLayer | null>
引数
| 名前 | 型 | 説明 |
|---|---|---|
map | string | Pick<ChizuMap, "id"> | The native map or map fields required by this signature; coordinates and region codes belong to its canvas. |
戻り値
Promise<ChizuFeatureLayer | null>
The matching feature layer, or null when the requested map has no built-in layer.
例
import { loadFeatures } from "@johnmorrisdotca/chizu/load";
const japan = (await loadFeatures("divisions-jp"))!;
const seto = japan.features.find((one) => one.nameJa === "瀬戸内海")!;
console.log(japan.map, seto.name, seto.kind, seto.reading, await loadFeatures("divisions-xx"));
// divisions-jp Seto Inland Sea sea せとないかい nulldivisions-jp Seto Inland Sea sea せとないかい null出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。