callbackTyphoonSetUp で受け取ってください。typhoonExplanationList が空の場合は「現在台風情報はありません」などのUIを表示してください。clearTyphoonObjectCondition を呼ぶと描画済みの台風オブジェクトがすべて削除されます。import * as GIA from '@ntj/gaia';
const TOKYO = new GIA.value.LatLng(35.681236, 139.767125);
// --- 有効化 ---
const show = () => {
map.setTyphoonObjectCondition(new GIA.value.TyphoonObjectCondition({
callbackTyphoonSetUp: (typhoonExplanationList) => {
if (typhoonExplanationList.length === 0) {
console.log('現在台風情報はありません');
return;
}
// 台風情報を先頭から表示
const first = typhoonExplanationList[0];
console.log(`台風${first.numbering}号`);
console.log(`方向: ${first.direction ?? '不明'}`);
console.log(`気圧: ${first.pressure ?? '不明'} hPa`);
console.log(`最大風速: ${first.maxWindSpeed ?? '不明'} m/s`);
console.log(`最大瞬間風速: ${first.peakWindSpeed ?? '不明'} m/s`);
console.log(first.informationText ?? '');
// 先頭の台風を強調表示
map.emphasizeTargetTyphoons([first]);
},
}));
// 台風観測に適した俯瞰ビューへ
map.setDirection(0);
map.setTilt(0);
map.setCenter(TOKYO);
map.setZoomLevel(5, false);
};
// --- 無効化 ---
const hide = () => {
map.clearTyphoonObjectCondition();
};
import * as GIA from '@ntj/gaia';
let typhoonList: GIA.types.TyphoonExplanation[] = [];
let currentIndex = 0;
map.setTyphoonObjectCondition(new GIA.value.TyphoonObjectCondition({
callbackTyphoonSetUp: (list) => {
typhoonList = list;
currentIndex = 0;
if (list.length > 0) {
map.emphasizeTargetTyphoons([list[0]]);
}
},
emphasizedStyleOption: {
deemphasizedFadedAlphaFactor: 0.3, // 非強調の台風を薄く表示
},
}));
// 前の台風へ
const onPrev = () => {
if (currentIndex <= 0) return;
currentIndex--;
map.emphasizeTargetTyphoons([typhoonList[currentIndex]]);
};
// 次の台風へ
const onNext = () => {
if (currentIndex >= typhoonList.length - 1) return;
currentIndex++;
map.emphasizeTargetTyphoons([typhoonList[currentIndex]]);
};
台風オブジェクトの表示条件を設定する — 詳細な使用例
地図上に台風をベクター描画します。
TyphoonObjectConditionInitOptionsで見た目・コールバックを指定し、callbackTyphoonSetUpで台風データ(TyphoonExplanation[])を受け取ります。TyphoonObjectConditionInitOptions
callbackTyphoonSetUp(list: TyphoonExplanation[]) => voidtyphoonStyleOptionemphasizedStyleOptionTyphoonExplanation の主要フィールド
numberingnumberdirectionstring | undefinedpressurenumber | undefinedmaxWindSpeednumber | undefinedpeakWindSpeednumber | undefinedinformationTextstring | undefined