Skip to content

Repository files navigation

W-AP

W-AP (Weather-Map) is website that shows you the weather and a map based on address, city name (international), or zipcode (U.S. only).

Design Process and Mockup

To design the website, MS Paint, SAI, and Canva were used.

Paint/SAI

Discord Image

Discord Image

Canva

Canva Project

Discord Image Discord Image Canva Animation

Difficulties

Weather API

Discord Image

With the 5 day forecast OpenWeatherAPI, the API gave the results in 3 hour intervals, represented by an array of 40 objects, each containing their own high, low, and average temperature.

To parse through the data, we went through each object and kept track of each temp_min and temp_max.

for (let d = 0; d < x.list.length - 8; d += 8) {
  day = Object.assign({}, x.list[d]);
  tempTotal = 0;

  // tslint:disable-next-line: prefer-for-of
  for (let h = d; h < 5 + d; h++) {
    const element = x.list[h];

    tempTotal += Object.assign({}, element.main).temp;

    if (day.main.temp_min > element.main.temp_min) {
      day.main.temp_min = element.main.temp_min;
    }
    if (day.main.temp_max < element.main.temp_max) {
      day.main.temp_max = element.main.temp_max;
    }

  }

API Calling Issues

Discord Image

A user could press the search bar in quick succession and call the API multiple times while the page was still rendering, causing duplicate information to display.

We added a directive with RxJS that listened for click events and used throttleTime to emit only the first click within a given moment in time.

W-AP/src/app/directives/

API Leaks 😳

Discord Image

Discord Image

It took two hours to notice but the API key was deactivated and removed. Whoopsieeee.

Default Angular README below

WAP

This project was generated with Angular CLI version 8.3.17.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Deploy

Run ng deploy --base-href '/W-AP/' to deploy the project.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Releases

Packages

Used by

Contributors

Languages