npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@api-types/jma-bosai

v0.1.0

Published

気象庁防災気象情報API - 気象庁ホームページから防災気象情報を取得するAPI

Downloads

5

Readme

@api-types/jma-bosai 気象庁防災気象情報API

気象庁防災気象情報API - 気象庁ホームページから防災気象情報を取得するAPI

Getting Started

  • Using npm:

    $ npm install @api-types/jma-bosai @aspida/axios axios
  • Using Yarn:

    $ yarn add @api-types/jma-bosai @aspida/axios axios

utils/apiClient.ts

import api from "@api-types/jma-bosai"
import aspida from '@aspida/axios'

export const apiClient = api(aspida())

Usage

参考サイト:https://qiita.com/e_toyoda/items/7a293313a725c4d306c0

utils/himawariClient.ts

import { apiClient } from "./apiClient"

export const himawariClient = apiClient.himawari.data.satimg

index.ts

import { BAND_PROD } from '@api-types/jma-bosai'
import { himawariClient } from "./utils/himawariClient"

;(async () => {
  const targetTimes = await himawariClient.targetTimes_fd_json.$get()
  console.log(targetTimes) // [{"basetime" : "20210224190000", "validtime" : "20210224190000"}...]

  const img = new Image()
  img.src = himawariClient
    ._basetime(targetTimes[0].basetime).fd._validtime(targetTimes[0].validtime)._band_prod(BAND_PROD.VISIBLE)._z(3)._x(7)._y_jpg(3).$path()
  document.body.appendChild(img)
})()

Endpoints

baseURL: https://www.jma.go.jp/bosai

/**
 * フルディスク画像API
 *
 * _basetime: 基準時刻 TargetTime['basetime']
 * _validtime: 撮影時刻 TargetTime['validtime']
 * _band_prod: 画像種別 BAND_PROD
 * _z: ズームレベル 3-5
 * _x: タイルのX座標
 * _y: タイルのY座標
 */
type Methods = {
  /** フルディスク画像をJPGで取得 */
  get: {
    resBody: ArrayBuffer
  }
}
/**
 * 日本付近画像API
 *
 * _basetime: 基準時刻 TargetTime['basetime']
 * _validtime: 撮影時刻 TargetTime['validtime']
 * _band_prod: 画像種別 BAND_PROD
 * _x: タイルのX座標
 * _y: タイルのY座標
 */
type Methods = {
  /** 日本付近画像をJPGで取得 */
  get: {
    resBody: ArrayBuffer
  }
}
/** 撮影時刻API */
type Methods = {
  /** 撮影時刻一覧を取得 */
  get: {
    resBody: TargetTime[]
  }
}
/** 日本付近の撮影時刻API */
type Methods = {
  /** 日本付近の撮影時刻一覧を取得 */
  get: {
    resBody: TargetTime[]
  }
}
/**
 * 降水ナウキャスト画像API
 *
 * _basetime: 基準時刻 TargetTime['basetime']
 * _validtime: 実況時間または予報時刻 TargetTime['validtime']
 * _z: ズームレベル 4-10
 * _x: タイルのX座標
 * _y: タイルのY座標
 */
type Methods = {
  /** 降水ナウキャスト画像をJPGで取得 */
  get: {
    resBody: ArrayBuffer
  }
}
/** 降水ナウキャストの実況時刻API */
type Methods = {
  /** 降水ナウキャストの実況時刻一覧を取得 */
  get: {
    resBody: TargetTime[]
  }
}
/** 降水ナウキャストの予報時刻API */
type Methods = {
  /** 降水ナウキャストの予報時刻一覧を取得 */
  get: {
    resBody: TargetTime[]
  }
}

Types

/** 撮影時刻 */
type TargetTime = {
  basetime: string
  validtime: string
}

Constants

/** 画像種別 */
const BAND_PROD = {
  /** 可視画像 */
  VISIBLE: 'B13/TBB',
  /** 赤外画像 */
  INFRARED: 'B03/ALBD',
  /** 水蒸気画像 */
  WATER_VAPOR: 'B08/TBB',
  /** トゥルーカラー再現画像 */
  TRUE_COLOR: 'REP/ETC',
  /** 雲頂強調画像 */
  CLOUD_TOP: 'SND/ETC'
} as const

License

@api-types/jma-bosai is licensed under a MIT License.