Skip to content

Instantly share code, notes, and snippets.

@HerbertLim
Created October 1, 2018 05:08
Show Gist options
  • Save HerbertLim/ebccc6362e7526183dfd92261aa7b77a to your computer and use it in GitHub Desktop.
Save HerbertLim/ebccc6362e7526183dfd92261aa7b77a to your computer and use it in GitHub Desktop.
기상청의 초단기예보 조회 (Korea Meteorological Administration's API for three hours of weather forecast)
// API Request:
// http://newsky2.kma.go.kr/service/SecndSrtpdFrcstInfoService2/ForecastTimeData?ServiceKey=SERVICE_KEY
// &base_date=20181001
// &base_time=1230
// &nx=55&ny=127
// &pageNo=1&numOfRows=60
// &_type=json
// JSON Response:
{
"response": {
"header": {
"resultCode": "0000",
"resultMsg": "OK"
},
"body": {
"items": {
"item": [
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "T1H", // Temperature 온도
"fcstDate": 20181001,
"fcstTime": 1300, // Short term forecast at 13:00
"fcstValue": 17.9, // Temperature value 온도
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "T1H",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 17.4,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "T1H",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 17,
"nx": 55,
"ny": 127
},
.
.
.
]
},
"numOfRows": 60,
"pageNo": 1,
"totalCount": 30
}
}
}
// Real Response Example:
{
"response": {
"header": {
"resultCode": "0000",
"resultMsg": "OK"
},
"body": {
"items": {
"item": [
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "LGT",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "LGT",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "LGT",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "PTY",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "PTY",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "PTY",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "RN1",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "RN1",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "RN1",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 0,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "SKY",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 3,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "SKY",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 3,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "SKY",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 3,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "T1H",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 17.9,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "T1H",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 17.4,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "T1H",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 17,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "REH",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 51,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "REH",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 53,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "REH",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 55,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "UUU",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 6.2,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "UUU",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 7.5,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "UUU",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 8.8,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "VVV",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": -0.8,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "VVV",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": -1.4,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "VVV",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": -1.9,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "VEC",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 279,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "VEC",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 281,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "VEC",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 283,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "WSD",
"fcstDate": 20181001,
"fcstTime": 1300,
"fcstValue": 6.2,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "WSD",
"fcstDate": 20181001,
"fcstTime": 1400,
"fcstValue": 7.6,
"nx": 55,
"ny": 127
},
{
"baseDate": 20181001,
"baseTime": 1230,
"category": "WSD",
"fcstDate": 20181001,
"fcstTime": 1500,
"fcstValue": 9,
"nx": 55,
"ny": 127
}
]
},
"numOfRows": 60,
"pageNo": 1,
"totalCount": 30
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment