This service retrieves historical weather data for a submitted city and exports the data as a new sheet into a Google Spreadsheet. Each row in the new sheet represents a day and the columns are data that can help visualize weather trends. Uses Weatherbit Historical Weather API to get weather data and Google Sheet API to edit the spreadsheet.
A FrontEnd Javascript application built using React. This project was bootstrapped with Create React App.
To retrieve historical weather data for a particular city, submit city and country:
You can check out the new data in this shared link: https://docs.google.com/spreadsheets/d/1plgIyhW093-gRVzZwIO8L_ToTGcAr7xQ9AzDOz2qO0E/edit?usp=sharing
A new tab in the Googlesheet has been created for the new data:
*Note: The free plan for Weatherbit Historical Weather API only allows 1 days worth of historical weather data (Similar issue with other weather services). Ideally, with a paid service, we would be able to export years worth of data.
In order to run this project locally, you should have the following installed:
You should also:
-
Set up a Google Sheets API: Register a new app and enable “Google Sheets API” (https://console.developers.google.com). Click “Create credentials” and select “API Key”. Click the “Restrict Key” and set a name for it. Under “Application Restrictions” set it to “HTTP referrers” and add http://localhost:3000 for now. Under “API Restrictions” select the “Google Sheets API” and save. Make a note of the API key.
-
Obtain OAuth 2.0 credentials from the Google API Console: Click "Create credentials" > OAuth client ID. Set the application type to Web application. Add http://localhost:3000 as an Authorized Javascript origins. Make a note of the Client ID. Since the application is modifying a spreadsheet, OAuth 2.0 for this app is necessary.
-
Signup for a Weatherbit API key (https://www.weatherbit.io/api). Make a note of the API key.
-
Fork this repo
-
Clone the fork
-
Install Dependencies:
$ npm install
-
Add a .env.development.local file to your project's root directory and set REACT_APP_WEATHERBIT_APIKEY to your weatherbit API key
REACT_APP_WEATHERBIT_APIKEY=<your_weatherbit_api_key>
-
You wil also need your Google API Key and Client ID in the .env.development.local file and name them REACT_APP_GOOGLE_APIKEY and REACT_APP_GOOGLE_CLIENTID, respectively
REACT_APP_GOOGLE_APIKEY=<your_google__api_key> REACT_APP_GOOGLE_CLIENTID=<your_google_client_id>
-
Start the Development Server:
$ npm start
-
Visit http://localhost:3000/
Enjoy! 💙
- Use local storage to cache cities already requested on the same day
- Add date range picker based on weather api historical data availabiliy
- Add more error handling
- Add more data points