Skip to content

Welcome to the Weather Dashboard Project! This web app helps you find current weather and forecasts for any location using the OpenWeather API, ensuring you're well-informed for your travel plans.

License

Notifications You must be signed in to change notification settings

naturuplift/WeatherDashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Weather Dashboard Project


University of New Brunswick JavaScript - jQuery JavaScript - Web APIs JavaScript - DOM


Welcome to the Weather Dashboard Project! This web application allows users to search for a location and retrieve the current weather conditions and forecast for a specific location. The dashboard provides real-time weather information using the OpenWeather API, ensuring you stay informed about the atmospheric conditions when you plan a trip.

Getting Started

To use the weather dashboard, simply visit the Weather Dashboard Page. Enter the desired location in the search bar and press the search button to retrieve the weather data.

Weather Information for a City

weather

The weather Dashboard for a city display the following information:

  • Current Weather

    • City
    • Date
    • Icon Representation of Weather Conditions
    • Temperature
    • Wind Speed
    • Humidity
  • 5-Day Forecast

    • Date
    • Icon Representation of Weather Conditions
    • Temperature
    • Wind Speed
    • Humidity

Search History

The application keeps a record of your search history, allowing you to quickly revisit weather information for previously searched locations.

Source Code

Explore the inner workings of the Password Generator by checking out the source code on GitHub. Feel free to contribute and enhance the project!

User Interface Overview

Search Bar

Enter the desired location City name, state code and country code in the search bar to retrieve weather information.

search

Weather Information Display

View real-time weather information, including weather-icon conditions, temperature, wind speed, and humidity.

information

5-Day Forecast

Check the 5-day forecast to plan ahead.

5-day

How to Use the OpenWeather API

To use the OpenWeather API to fetch weather data for a location, follow these steps:

1. Sign Up for an API Key

You'll need an API key from OpenWeather to access their API. You can sign up for a free API key on the OpenWeather website.

2. Include Your API Key

Once you have your API key, you should include it in your JavaScript code where you make API requests. You can store it as a constant or in a configuration file for security.

const apiKey = 'YOUR_API_KEY';

3. Making API Requests

a. Geocoding API

To retrieve the current location latitude and longitude, you can make a GET request to the following API endpoint:

http://api.openweathermap.org/geo/1.0/direct?q={city name},{state code},{country code}&limit={limit}&appid={API key}

Replace {city name},{state code},{country code} with the name of the city, state code, country code or location you want to get the weather data for, {limit} with the number of the locations in the API response and {apiKey} with your OpenWeather API key.

b. Current and 5-Day Weather Forecast

To retrieve the current and 5-day weather forecast for a location, you can make a GET request to the following API endpoint:

api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key}

Replace {lat}, {lon} with the latitude and longitude of the city or location you want to get the weather data for, and {apiKey} with your OpenWeather API key.

Here's an example using JavaScript and the Fetch API:

const apiUrl = `https://api.openweathermap.org/data/2.5/forecast?lat=45.272812&lon=-66.063026&appid={API key}`;

fetch(apiUrl)
  .then(response => response.json())
  .then(data => {
    // Handle the 5-day weather forecast data here
    console.log(data);
  })

4. Handling the API Response

You'll need to parse the JSON data returned by the API and extract the relevant information to display it on your Weather Dashboard.

That's it! You can now use the OpenWeather API to retrieve the city geolocation, the current and 5-day weather forecasts for any location of your choice in your Weather Dashboard project.

Make sure to replace 'YOUR_API_KEY' in the code examples with your actual OpenWeather API key. Users of your Weather Dashboard project will need to follow these steps to set up their own API keys and make API requests to retrieve weather data.

State Flow Diagram

For a visual representation of the sequence of actions involved in the weather dashboard, refer to the State Flow Diagram provided in the project documentation.

Feel free to reach out, contribute, or provide feedback to make the Password Generator Project even more robust and user-friendly!

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Welcome to the Weather Dashboard Project! This web app helps you find current weather and forecasts for any location using the OpenWeather API, ensuring you're well-informed for your travel plans.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published