Weather Search

I developed a web application using Python and the Flask framework to perform server-side scripting, integrating the Tomorrow.io API to retrieve and display weather data. The webpage allows users to search for weather information, with results presented in both card and tabular formats, along with detailed daily weather insights.

This project involved gaining hands-on experience with Python, Flask, Google APIs, Tomorrow.io API, and HighCharts Service. It emphasized creating dynamic web pages with HTML, CSS, JavaScript, DOM manipulation, JSON handling, and XMLHttpRequest objects. Additionally, I worked with JSON parsers in both Python and JavaScript and deployed the backend on AWS providing practical cloud development experience.

The project offered valuable exposure to web development, cloud deployment, and API integration.

Request access for source code!

WHO:

Me!

WHEN:

Fall 2024


Search Form

Search Form

Search Form Functionality for Weather Information Retrieval

The web application includes a dynamic search form that provides weather information based on user input or geolocation. When the user opens the webpage (e.g., weather.html), they can choose to fetch their geolocation using the ipinfo.io API by selecting the location checkbox.

If this checkbox is checked, the fields for Street, City, and State are cleared and disabled. Otherwise, the user can manually enter their Street, City, and State to search for weather details.

The search form features two buttons:

Valid Search

An Example of a Valid Search

Invalid Search

An Example of an Invalid Search: Users are reminded of missing or invalid search fields

Geocoding & Weather Data Retrieval

There are 2 ways for users to search for weather information: Traditional Street Address or IP Address

The application displays weather results by leveraging form inputs to construct RESTful API calls to the Tomorrow.io service.

If the user enters Street, City, and State information, the client JavaScript first geocodes the address using the Google Maps Geocoding API. This API converts the address into geolocation coordinates required for the weather query. The Google Maps Geocoding API expects the following parameters:

The geocoding response includes the latitude and longitude, which are then used to query the Tomorrow.io API.

The Tomorrow.io API Retrieve Timelines service retrieves weather data based on these coordinates. The API requires the following parameters:

The Python Flask backend handles these API requests, processes the JSON responses, and extracts relevant weather details. The extracted data is sent to the frontend in JSON format, where JavaScript further processes it for display.

Address Search

Example of a valid address search

Once a valid search is made, these 2 html cards will be displayed below:

Address Search

First output of a valid address search

Address Search

Second ouput of a valid address search

The table result displays weather results for the next 5-6 days, including the search day

Displaying Detailed Summary of the Weather

In the search results table, clicking on a record's date displays a detailed breakdown of the daily weather. The detailed information is fetched using the same API parameters as the initial request, leveraging the Tomorrow.io API to retrieve JSON data. The page dynamically populates a dedicated section with this detailed weather data for seamless user interaction.

Address Search

Below the Daily Weather Detail, an hourly weather chart is available but hidden by default. Users can toggle the visibility of the "Weather Charts" section by clicking a button which expands the chart when clicked if hidden, or collapse it if already open, enabling seamless control over the display.

Address Search

Highcharts API Service

I created a temperature range (Min, Max) weather chart using the Highcharts API. The chart dynamically displays daily temperature trends over a 5-day period, starting from the current day. This visualization highlights temperature fluctuations and provides an interactive way to explore weather patterns.

The second chart is an interactive hourly meteogram for the next 5 days using data from the Tomorrow.io API. The chart displays hourly weather trends starting from the current time, providing a detailed view of weather changes over a 5-day period. Data is retrieved dynamically through API calls to ensure accurate and up-to-date visualization.