This is a software tool developed in Java that uses a provider of metrological content to display a map showing a 5-day forecast for the major cities around the world.
The cities that will be targeted by this “Capital Weather Forecast Tool” are, as the name of the tool suggests, the country capital cities from all over the world.
This somewhat complicated task will be decomposed into three smaller manageable subtasks to make the process of developing this software tool possible.
The proposed implementation strategy is built upon two main pillars, namely the use of a “divide and conquer”-like approach to solve the problem and the gradual integration of features into the “Capital Weather Forecast Tool”. The details pertaining to the aforementioned three tasks are provided in what follows.
We use the Google Geocoding API to map the names of all of the capital cities that exist in the world into geographic coordinates (like latitude 37.423021 and longitude-122.083739). The resulting coordinates will serve as an input for the second task, where we will use the coordinates to obtain the 5-day weather forecast for each capital city.
Translating an address to a pair of geographic coordinates involves using the Google Geocoding API that provides a means for accessing a geocoder as explained at: https://developers.google.com/maps/documentation/geocoding/#XML
As illustrated in this webpage, an XML response containing the geographic coordinates can be fetched from the geocoding API. Although it is possible to get a JSON version of the coordinates; for this task, an XML version of the coordinates would be requested from the API.
Once the XML-formatted coordinates have been received, we extract the latitude and longitude coordinates contained inside the received XML response. Armed with these two pieces of information, we will be able to attack the second task of this project.
We use JDOM parser to extract the desired information from the retrieved feed. The process explained above should be repeated for each of the capital cities.
We find a JSON feed allowing for the retrieval of meteorological data for cities across the globe and more importantly one supplying forecast weather data for these cities. Once we have located a content provider that meets these requirements, we can proceed to connecting to the identified JSON feed and parse it.
The main purpose of the parsing process is to extract the weather forecast data in terms for instance temperature values, wind speed, humidity and rainfall levels (if possible) for each country capital.
The content provider should be able to generate the JSON feed based on the GPS coordinates that resulted from the first task. That is, we submit to the content provider the longitude and latitude information retrieved earlier to get the weather forecast data pertaining to the capital city that corresponds to these longitude and latitude pieces of data.
The third task will make heavy use of the latitude and longitude information generated by the first task and of the weather forecast data produced by the second task.
We integrate into your Java application a map with a set of markers showing the locations associated with the latitude and longitude coordinates resulting from the first task.
We produce a similar view but with several markers pinpointing the positions of the capital cities. In addition to the markers, we couple each capital city with a summary list presenting the meteorological data characterizing the weather condition of that city over the next 5 days.
Specifically, for each city we supply a summary list reporting information about the expected temperature values, wind speed, humidity and rainfall levels for the next 5 days. Image icons capturing the reported weather condition would also be added to the map. In other words, an icon showing the sun should be placed next to a set of meteorological data suggesting a hot weather and one showing a cloud should be inserted next to a set indicating a cold weather condition, and so on and so forth.
To add a map to your java application, we will the JMapViewer java component. The following URL: http://wiki.openstreetmap.org/wiki/JMapViewer is a good source of information in this regard. The external library (.jar file) that contains the JMapViewer java class can be downloaded from:
Moreover, the HTML documentation for the JMapViewer class and other relevant classes can be found at: http://josm.openstreetmap.de/doc/. This URL is very important as it will allow you to gain a deeper understanding of both the JMapViewer class and the other classes that might be needed to accomplish the third task.