Skip to content

This app allows users to see the current weather and 5 day forecast of a city of their choice

License

Notifications You must be signed in to change notification settings

Karen-O94/Weather-Dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Weather-Dashboard

The aim of this project was to create a weather dashboard that allows a user to see current weather and 5 day forecast of a city of their choice. We had to use the OpenWeather API to retrieve weather data for cities and make use of localStorage to store any persistent data.

Link To Application

Weather Dashboard

First Steps: Pseudocoding & Styling Weather Dashboard page

Before attempting to code the Javascript file, I took some time to pseudocode a flow chart of how I wanted the application to work based on the client's user story.

The client's first criteria was that a dashboard displaying weather information will appear when they searched a city name.

I started off styling the HTML page mainly using Bootstrap and correlating the HTML tag attributes with the CSS selectors from Bootstrap or the additional stylesheet I created.

Second step: API calls

The next step was to research the list of available APIs on the OpenWeather API site and identify which APIs would best help me get all the info required. This lead me to using thr following API docs:

Current Weather API : This API was used to retrieve the city name info using latitude and longitude coordinates provided.

One Call API : This API was used to retieve all the current and 5-day forecast info (i.e. temperature, wind,humidity,UV Index, icon etc) for each city. This API also used the longitude and latitude information from the

Third step: Declaring intial global variables & using DOM Methods

After pseudocoding, I proceeded to declaring the variables I would need to store the city and elements that I would need to manipulate on the DOM. I used a click event (.on("click", function() {}) to the search button to render the page with the city info.

Then I stored the user' search item into their localStorage by targetting the input box and storing those in variables to be used as key-value pairs later on. Similarly I created a function to later retrieve from the localStorage to make sure the information stayed on the page.

Final Steps: Displaying Weather info on page & UV Index

The last few steps was making sure the information collated was displaying in their designated HTML elements

As the client wanted the UV Index to be colour-coded to represent whether the UV Index was in the favourable, moderate or severe; I wrote a function to display this comparison using a for loop setting the conditions with if/else statements.

Deployed Application Images

image

image

image

image

Difficulties

API: I run into some difficulties extracting information from the API objects and it took a lot of trial and error and debugging to work out where I was going wrong. It was difficult figuring out how to organise my API calls and when to call them to make sure they rendered on the page at the right time.

Organising: Similar to previous assignments, I still struggle with figuring out how to organise my JavaScript/jQuery code for it to flow logically especially when writing functions.

I used console.log, Chrome DevTools, YouTube and peer reviews to troubleshoot what was going wrong and what direction to take to fix these issues.

Built With

License

License: MIT

About

This app allows users to see the current weather and 5 day forecast of a city of their choice

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published