2023年12月21日 星期四

ESP32擷取 open data 現在天氣觀測報告-現在天氣觀測報告

ESP32擷取 open data 現在天氣觀測報告-現在天氣觀測報告 


第一步我們要先加入氣象局的會員,接著登入會員取得授權碼

https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization= 你的授權碼&StationName=中竹林&CountyName=臺中市&TownName=太平區

https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization=CWB-40C25FFF-1224-4250-B9D9-3735AAE17DBF&StationName=%E4%B8%AD%E7%AB%B9%E6%9E%97&CountyName=%E8%87%BA%E4%B8%AD%E5%B8%82&TownName=%E5%A4%AA%E5%B9%B3%E5%8D%80


https://opendata.cwb.gov.tw/api/v1/rest/datastore/O-A0003-001?Authorization=CWB-40C25FFF-1224-4250-B9D9-3735AAE17DBF&StationName=中竹林&CountyName=臺中市&TownName=太平區


 {

     "StationName": "中竹林",

     "StationId": "C2F9A0",

     "ObsTime": {

      "DateTime": "2023-12-22T12:20:00+08:00"

     },

     "GeoInfo": {

      "Coordinates": [

       {

        "CoordinateName": "TWD67",

        "CoordinateFormat": "decimal degrees",

        "StationLatitude": "24.105556",

        "StationLongitude": "120.743333"

       },

       {

        "CoordinateName": "WGS84",

        "CoordinateFormat": "decimal degrees",

        "StationLatitude": "24.103556",

        "StationLongitude": "120.751061"

       }

      ],

      "StationAltitude": "425.0",

      "CountyName": "臺中市",

      "TownName": "太平區",

      "CountyCode": "66000",

      "TownCode": "66000270"

     },

     "WeatherElement": {

      "Weather": "-99",

      "VisibilityDescription": "-99",

      "SunshineDuration": "-99",

      "Now": {

       "Precipitation": "0.0"

      },

      "WindDirection": "70.0",

      "WindSpeed": "0.9",

      "AirTemperature": "14.1",

      "RelativeHumidity": "65",

      "AirPressure": "-99",

      "UVIndex": "-99",

      "Max10MinAverage": {

       "WindSpeed": "1.3",

       "Occurred_at": {

        "WindDirection": "40.0",

        "DateTime": "2023-12-22T11:31:00+08:00"

       }

      },

      "GustInfo": {

       "PeakGustSpeed": "3.1",

       "Occurred_at": {

        "WindDirection": "300.0",

        "DateTime": "2023-12-22T11:14:00+08:00"

       }

      },

      "DailyExtreme": {

       "DailyHigh": {

        "TemperatureInfo": {

         "AirTemperature": "14.4",

         "Occurred_at": {

          "DateTime": "2023-12-22T12:05:00+08:00"

         }

        }

       },

       "DailyLow": {

        "TemperatureInfo": {

         "AirTemperature": "7.0",

         "Occurred_at": {

          "DateTime": "2023-12-22T04:56:00+08:00"

         }

        }

       }

      }

     }

    },


{"success":"true","result":{"resource_id":"O-A0003-001","fields":[{"id":"StationName","type":"String"},{"id":"StationId","type":"String"},{"id":"CoordinateName","type":"String"},{"id":"CoordinateFormat","type":"String"},{"id":"StationAltitude","type":"String"},{"id":"IntScaleValue","type":"Float"},{"id":"StationAltitude","type":"Float"},{"id":"CountyName","type":"String"},{"id":"TownName","type":"String"},{"id":"CountyCode","type":"String"},{"id":"TownCode","type":"String"},{"id":"Weather","type":"String"},{"id":"VisibilityDescription","type":"String"},{"id":"SunshineDuration","type":"Float"},{"id":"Precipitation","type":"Float"},{"id":"WindDirection","type":"Float"},{"id":"WindSpeed","type":"Float"},{"id":"AirTemperature","type":"Float"},{"id":"RelativeHumidity","type":"Integer"},{"id":"AirPressure","type":"Float"},{"id":"UVIndex","type":"Float"},{"id":"PeakGustSpeed","type":"Float"},{"id":"DateTime","type":"DateTime"}]},"records":{"Station":[{"StationName":"中竹林","StationId":"C2F9A0","ObsTime":{"DateTime":"2023-12-22T14:20:00+08:00"},"GeoInfo":{"Coordinates":[{"CoordinateName":"TWD67","CoordinateFormat":"decimal degrees","StationLatitude":24.105556,"StationLongitude":120.74333},{"CoordinateName":"WGS84","CoordinateFormat":"decimal degrees","StationLatitude":24.103556,"StationLongitude":120.75106}],"StationAltitude":"425.0","CountyName":"臺中市","TownName":"太平區","CountyCode":"66000","TownCode":"66000270"},"WeatherElement":{"Weather":"-99","VisibilityDescription":"-99","SunshineDuration":-99.0,"Now":{"Precipitation":0.0},"WindDirection":350.0,"WindSpeed":0.4,"AirTemperature":14.3,"RelativeHumidity":57,"AirPressure":-99.0,"UVIndex":-99.0,"Max10MinAverage":{"WindSpeed":1.0,"Occurred_at":{"WindDirection":280.0,"DateTime":"2023-12-22T13:42:00+08:00"}},"GustInfo":{"PeakGustSpeed":3.0,"Occurred_at":{"WindDirection":20.0,"DateTime":"2023-12-22T13:42:00+08:00"}},"DailyExtreme":{"DailyHigh":{"TemperatureInfo":{"AirTemperature":15.0,"Occurred_at":{"DateTime":"2023-12-22T12:31:00+08:00"}}},"DailyLow":{"TemperatureInfo":{"AirTemperature":7.0,"Occurred_at":{"DateTime":"2023-12-22T04:56:00+08:00"}}}}}}]}}



https://jsonformatter.org/json-parser

DOWNLOAD
{
  "success": "true",
  "result": {
    "resource_id": "O-A0003-001",
    "fields": [
      {
        "id": "StationName",
        "type": "String"
      },
      {
        "id": "StationId",
        "type": "String"
      },
      {
        "id": "CoordinateName",
        "type": "String"
      },
      {
        "id": "CoordinateFormat",
        "type": "String"
      },
      {
        "id": "StationAltitude",
        "type": "String"
      },
      {
        "id": "IntScaleValue",
        "type": "Float"
      },
      {
        "id": "StationAltitude",
        "type": "Float"
      },
      {
        "id": "CountyName",
        "type": "String"
      },
      {
        "id": "TownName",
        "type": "String"
      },
      {
        "id": "CountyCode",
        "type": "String"
      },
      {
        "id": "TownCode",
        "type": "String"
      },
      {
        "id": "Weather",
        "type": "String"
      },
      {
        "id": "VisibilityDescription",
        "type": "String"
      },
      {
        "id": "SunshineDuration",
        "type": "Float"
      },
      {
        "id": "Precipitation",
        "type": "Float"
      },
      {
        "id": "WindDirection",
        "type": "Float"
      },
      {
        "id": "WindSpeed",
        "type": "Float"
      },
      {
        "id": "AirTemperature",
        "type": "Float"
      },
      {
        "id": "RelativeHumidity",
        "type": "Integer"
      },
      {
        "id": "AirPressure",
        "type": "Float"
      },
      {
        "id": "UVIndex",
        "type": "Float"
      },
      {
        "id": "PeakGustSpeed",
        "type": "Float"
      },
      {
        "id": "DateTime",
        "type": "DateTime"
      }
    ]
  },
  "records": {
    "Station": [
      {
        "StationName": "中竹林",
        "StationId": "C2F9A0",
        "ObsTime": {
          "DateTime": "2023-12-22T14:20:00+08:00"
        },
        "GeoInfo": {
          "Coordinates": [
            {
              "CoordinateName": "TWD67",
              "CoordinateFormat": "decimal degrees",
              "StationLatitude": 24.105556,
              "StationLongitude": 120.74333
            },
            {
              "CoordinateName": "WGS84",
              "CoordinateFormat": "decimal degrees",
              "StationLatitude": 24.103556,
              "StationLongitude": 120.75106
            }
          ],
          "StationAltitude": "425.0",
          "CountyName": "臺中市",
          "TownName": "太平區",
          "CountyCode": "66000",
          "TownCode": "66000270"
        },
        "WeatherElement": {
          "Weather": "-99",
          "VisibilityDescription": "-99",
          "SunshineDuration": -99,
          "Now": {
            "Precipitation": 0
          },
          "WindDirection": 350,
          "WindSpeed": 0.4,
          "AirTemperature": 14.3,
          "RelativeHumidity": 57,
          "AirPressure": -99,
          "UVIndex": -99,
          "Max10MinAverage": {
            "WindSpeed": 1,
            "Occurred_at": {
              "WindDirection": 280,
              "DateTime": "2023-12-22T13:42:00+08:00"
            }
          },
          "GustInfo": {
            "PeakGustSpeed": 3,
            "Occurred_at": {
              "WindDirection": 20,
              "DateTime": "2023-12-22T13:42:00+08:00"
            }
          },
          "DailyExtreme": {
            "DailyHigh": {
              "TemperatureInfo": {
                "AirTemperature": 15,
                "Occurred_at": {
                  "DateTime": "2023-12-22T12:31:00+08:00"
                }
              }
            },
            "DailyLow": {
              "TemperatureInfo": {
                "AirTemperature": 7,
                "Occurred_at": {
                  "DateTime": "2023-12-22T04:56:00+08:00"
                }
              }
            }
          }
        }
      }
    ]
  }
}



沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...