SDEV Homework4- Dynamic weather map of the United States Solved

35.00 $

Category:

Description

5/5 - (1 vote)

  • In this assignment, you will be making a dynamic weather map of the United States, visualizing temperatures for each state on the map.
  • We will use the Dark Sky Forecast API from Lab 9 as the data source.
  • Each state will be color-coded per its current temperature as reported by the DarkSky API. There are five gradations of temperature that will be colored as listed in the table in Part 3.4.
  • Download the starter files from here
  • All your code goes only inside index.html and index.js in the StudentWebsite folder. Do not modify any other files.

API Setup (5 points)

  • 1. Head over to Dark Sky API
  • 2. Click Try for free
  • 3. Register: fill in your email, password and confirm password
  • 4. Head over to your email and click the confirmation link
  • 5. You will see the welcome screen after clicking the link. Then in the top right corner click Log in.
  • 6. The API that you will need is the One in the “Sample API Call”. It looks something like https://api.darksky.net/forecast/-your-key-here-/37.8267,-122.4233

Part 1: Reading the SVG (5 points)

  • We will be working with SVGs for this part. The first step is for you to read up on what SVGs are from the Resources tab above.
  • We need the SVG of the United States Map. This can be found here
  • If you save the SVG locally, it’s not going to work since there’s no way to actually view the XML code for it. So instead head over to the link provided above, right click and click View Page Source
  • Paste the contents you see on the browser in index.html between the ‘Paste World Map Here’ and the ‘End of World Map’ tags POINTS: 5

Part 2: Reading the JS (2 points)

  • Read the state_info.js into index.html at the ‘Import state_info.js here’ POINTS: 1
  • Read the index.js into index.html at the ‘Import index.js here’ POINTS: 1

Part 3: Index.js (88 points)

  • Paste your API key in index.js where it is marked “Enter your API Key here” 4 Points
  • If you look at the SVG that you pasted, it has a bunch of IDs that are State Codes. You can change the color of a state code by doing “$(‘#CO’).css(‘fill’, “blue”)” for example.
  • Iterate over each of the rows in the json and make an API call to the Dark Sky API using the latitude and longitude that we saw before. 30 Points
    Here is how you iterate over a json with a list of Jsons.
  • For each of these, make an API call to DarkSky. 24 Points
    Note that the API calls are limited to 1000 per day, so use them wisely. If you want to learn more about the api response see this.
    If you want to look at the JSON response, see the ‘example_api_response.json’ file in the example folder.
    If you run out of requests, you may make a new account or try it a day after.
  • The color to be used for a state should be determined based on the following temperature range table. 30 Points
    Temperature Color
    [default] #808080
    Less than equal to 10F #6495ED
    Between 11F and 20F #7FFFD4
    Between 21F and 30F #0000FF
    Between 31F and 40F #008B8B
    Between 41F and 50F #00BFFF
    Between 51F and 60F #F08080
    Between 61F and 70F #CD5C5C
    Between 71F and equal to 80F #8B0000
    Between 81F and equal to 90F #B22222
    Greater than 90F #FF0000
  • sample output
    The above is a sample of how the final image needs to be

Bonus Questions (20 points)

Question 1: 10 points

  1. You will create a tooltip to display other information about the weather in each state.
  2. The tooltip should appear when hovering over any state, and it should update when scrolling across different states. The tooltip should work for all states on the map.
  3. You can include as many information you want in the tooltip, but some suggested data might be things such as precipitation, humidity, or cloud cover.

Note: You’re free to modify the svg element as per your need. You can use any css library to implement tooltip, you can also build your own css tooltip. You can create as many helper functions you want.

Question 2: 10 points

  • Add wind direction to the tooltip. You can use any css style arrows to show the wind direction.
A simple tooltip here.. 

 
  • HW4-wkt3bb.zip
zip
You're viewing: SDEV Homework4- Dynamic weather map of the United States Solved 35.00 $
Add to cart