NEW

Connect the world's APIs to Web3 with Chainlink Functions. Get started

Google Weather Oracle

You can use Chainlink to digest weather information using Google Cloud Public Datasets. We have a sample brownie repo showing how to interact with the contracts available in our gcp-weather brownie repo. More information on this oracle can be found in the following Google Cloud article.

Parameters and External Adapters Details

These jobs are using a custom external adapter. Please see the Google weather external adapter to see information about parameters that can be used with these jobs.

You will need to use the following LINK token address, oracle address, and JobSpec IDs in order to create the Chainlink request to this oracle.

Mainnet

ParameterValue
ETH_CHAIN_ID1
ChainLink Token Address0x514910771AF9Ca656af840dff83E8264EcF986CA
Oracle0x92c08A635C7525505123F0F8e327C6Fa66E09a18
Rain JobIDe9c41111b74f454695abd471806d9c6f
Hail JobID941cb4bdd6e746cd933a37c8e92f2f98
Average Temperature JobIDc6f853860b4f479fbda0910350d695b6
Generic JobID0606a7c2811e4dbab659be400ecd41f9
Fee1000000000000000000 (1 LINK)
Node Operator0x6767eDa1C1d0070cEbdFE1CB3a55e4B63FA02C3E

Steps For Using This Oracle

  • Write and deploy your contract using the network details above.
  • Fund it with LINK
  • Call your request method

Create your Chainlinked contract

Import ChainlinkClient.sol into your contract so you can inherit the ChainlinkClient behavior. Below is a sample that can call the hail, rain, and average temperature jobs to fetch weather data from Bergen, Norway.

samples/DataProviders/GoogleWeather.sol

Jobs

Rain (Bergen, Norway)

Tasks

  1. gcp-weather: Makes a call to the google weather dataset
    1. Parameters:
{
  "geoJson": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [5.325622558593749, 60.3887552979679]
        },
        "properties": {}
      }
    ]
  }
}
  1. multiply: Multiples the output - set to 1000000000000000000
  2. ethuint256: Turns the result into a uint256
  3. ethTx: Sends the TX to the blockchain

Hail (Bergen, Norway)

Tasks

  1. gcp-weather: Makes a call to the google weather dataset
    1. Parameters
{
  "geoJson": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            {
              "0": [5.2796173095703125, 60.40673218057448],
              "1": [5.164947509765625, 60.383665698324926],
              "2": [5.17730712890625, 60.211509994185604],
              "3": [5.401153564453124, 60.27694067255946],
              "4": [5.6188201904296875, 60.436558668419984],
              "5": [5.526123046875, 60.42842688461354],
              "6": [5.3002166748046875, 60.5387098888639],
              "7": [5.238418579101562, 60.4951151199491],
              "8": [5.2796173095703125, 60.40673218057448]
            }
          ]
        },
        "properties": {}
      }
    ]
  }
}
  1. ethuint256: Turns the result into a uint256
  2. ethTx: Sends the TX to the blockchain

Average Temperature (Bergen, Norway)

Tasks

  1. gcp-weather: Makes a call to the google weather dataset
    1. Parameters:
{
  "geoJson": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            {
              "0": [5.2796173095703125, 60.40673218057448],
              "1": [5.164947509765625, 60.383665698324926],
              "2": [5.17730712890625, 60.211509994185604],
              "3": [5.401153564453124, 60.27694067255946],
              "4": [5.6188201904296875, 60.436558668419984],
              "5": [5.526123046875, 60.42842688461354],
              "6": [5.3002166748046875, 60.5387098888639],
              "7": [5.238418579101562, 60.4951151199491],
              "8": [5.2796173095703125, 60.40673218057448]
            }
          ]
        },
        "properties": {}
      }
    ]
  }
}
  1. multiply: Multiples the output - set to 1000000000000000000
  2. ethuint256: Turns the result into a uint256
  3. ethTx: Sends the TX to the blockchain

Generic (Any Location)

Tasks

  1. gcp-weather: Makes a call to the google weather dataset
  2. multiply: Multiples the output
  3. ethuint256: Turns the result into a uint256
  4. ethTx: Sends the TX to the blockchain

Input Parameters

Required?NameDescriptionOptionsDefaults to
geoJsonA GeoJSON object containing the geographies to query
dateFromThe date to query data from (inclusive) in ISO 8601 format
dateToThe date to query data to (inclusive) in ISO 8601 format
methodWhich method to use to aggregate data inAVG, SUM, MIN, MAX
fieldWhich column to fetch data fromData available
unitsWhat unit system to return the result in (conversions)imperial, metricimperial

Please see the Google weather external adapter to see information about parameters that can be used with these jobs.

Stay updated on the latest Chainlink news