Function setPollenCondition

  • 花粉情報の表示条件を設定する — 詳細な使用例

    花粉飛散量・予報データを地図上にメッシュ表示します。 PollenConditionoffset(対象分)と time(対象日時)を指定できます。

    Returns void

    Warning

    • setPollenCondition は一度に一条件のみ有効です。再設定すると上書きされます。
    • clearPollenCondition で表示を完全に無効化できます。

    Example: 日時入力 + offset 指定で花粉情報を表示する

    import * as GIA from '@ntj/gaia';

    const date = (document.querySelector('[name="map-pollen-date"]') as HTMLInputElement).value;
    const time = (document.querySelector('[name="map-pollen-time"]') as HTMLInputElement).value;
    const offset = (document.querySelector('[name="map-pollen-offset"]') as HTMLInputElement).value;

    const pollenTime = date && time ? new Date(`${date}T${time}:00`) : new Date();
    map.setPollenCondition(new GIA.value.PollenCondition({
    offset: parseInt(offset, 10),
    time: pollenTime,
    }));

    // 非表示
    map.clearPollenCondition();

    See