... | ... | @@ -2,7 +2,9 @@ |
|
|
|
|
|
**Contributors:** Edah Sahinovic, Katharina Wöhs, Christina Zorenböhmer
|
|
|
|
|
|
**.java Files:** Stored in our ["Final Codes" folder](https://git.sbg.ac.at/s1080384/EoT/-/tree/main/Java%20Codes/Final%20Version).
|
|
|
**.java Files:** Stored in the ["Final Codes" folder](https://git.sbg.ac.at/s1080384/EoT/-/tree/main/Java%20Codes/Final%20Version).
|
|
|
|
|
|
**PDF Documentation:*** Stored in the ["Documentation" folder]()
|
|
|
|
|
|
**Code and Console Snippets:** See the drop down boxes on this page!
|
|
|
|
... | ... | @@ -160,7 +162,8 @@ static void askUser2() { |
|
|
|
|
|
## Concept
|
|
|
|
|
|
At the outset we began gathering ideas and drawing up concepts for our approach. We have visualised our concept below:
|
|
|
At the outset we began gathering ideas and drawing up concepts for our approach. We have one main, executable class called GoogleEarthTweetMapper
|
|
|
and several non-executable classes whose methods are called from GoogleEarthTweetMapper. This division allowed us to work in a modular fashion, as stated in our aims. The arrows indicate what the program interacts with while calling on the specific non-executable classes and its methods (e. g. local tweet csv file). We have visualised our concept below:
|
|
|
|
|
|

|
|
|
|
... | ... | @@ -238,7 +241,8 @@ public class GoogleEarthTweetMapper { |
|
|
|
|
|
## User Input 1
|
|
|
|
|
|
In this first step we ask the user to give us the "thumbs up" for downloading the required files onto their PC. We set the default directory to "C:/Users/Public/Documents", which is given on any PC. Nonetheless, we wanted to let the user specify a different directory if they prefer that. This was implemented in the non-executable [user_Input.java](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/User_input.java) class.
|
|
|
The .askUser1() method is called at the very beginning of the main class to set the directory. the directory needs to be declared at the very beginning since multiple other variables incorporate the directory, and all the following classes and methods build upon it. In this method, we included a
|
|
|
default directory, to make the programme works either way. We set the default directory to "C:/Users/Public/Documents", which is given on any PC. Nonetheless, we wanted to let the user specify a different directory if they prefer that. Now, the user can communicate with the program and tell it where to store all the files. To deal with any spaces in file paths, we set the scanner method to .nextLine(), and to check if the entered file path exists we added a control mechanism in the form of an if-else-loop that confirms whether the given directory is a real one, i. e. whether it exists, or else it asks the user again to set a new directory. This was implemented in the non-executable [user_Input.java](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/User_input.java) class.
|
|
|
|
|
|
<details><summary>See the Code for the userInput.java class here</summary>
|
|
|
|
... | ... | @@ -686,7 +690,7 @@ We therefore concluded that we needed to add in the "T" where the blank space is |
|
|
|
|
|
**Creating Polygons from Points:** To solve this, we perfomed some simple math calculations on the lat and lng coordinates of the point locations. This required a few conversions of String to Double and then back into String, to insert the new coordinates into the kml body.
|
|
|
|
|
|
**Colouring the Polygons according to the Time of Tweet:** Here we decided to work with the difference between the first tweet’s time and every other tweet’s time to adjust the hexadecimal colour code for each placemark. We decided to work with a colour-ramp from yellow (=earliest) to red (=latest), which meant that we set opacity to full (FF), blue to zero (00), red to full (FF) and dynamically adjusted the value of green. The value for green was calculated with the two values “secondsFirstDate” (= the time of the first tweet in seconds) and “seconds” (= the time of the current tweet in seconds), which are given in milliseconds. We first divided both by 1000 to arrive at seconds, and then we divided them by 6 to ensure all values are within a range of 256, which is required for the colour values. We then simply calculated the difference between the first and the current tweet and used that difference to set the green colour value.
|
|
|
**Colouring the Polygons according to the Time of Tweet:** Here we decided to work with the difference between the first tweet’s time and every other tweet’s time to dynamically adjust the green colour value in a hexadecimal colour code for each placemark to give us a colour-ramp from yellow (= earliest) to red (= latest). The value for green was calculated with the two values “secondsFirstDate” (= the time of the first tweet in seconds) and “seconds” (= the time of the current tweet in seconds). By parsing the time, we are initially given milliseconds. We divided these values by 1000 to arrive at seconds, and then again by 6 to ensure all values are within a range of 256, which is required for the colour values. We then simply calculated the difference between the first and the current tweet and used that difference to set the green colour value.
|
|
|
|
|
|
<details><summary>See the Code for the tweets_polygons.java Class</summary>
|
|
|
|
... | ... | @@ -892,7 +896,7 @@ All 1163 placemarks have been integrated into a single KML file, which is saved |
|
|
|
|
|
## Creating a KML Tour
|
|
|
|
|
|
Although not technically required, we though it would improve the user experience to be guided through the results in Google Earth. We therefore created our own KML tour and integrated it into a non-executable [googleEarth_Tour.java](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/GoogleEarth_tour.java) class that stores the tour.kml locally.
|
|
|
Although not technically required, we though it would improve the user experience to be guided through the results in Google Earth. We therefore created our own KML tour and integrated it into a non-executable [googleEarth_Tour.java](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/GoogleEarth_tour.java) class that stores the tour.kml locally. We created a 1 minute 22 second long tour that automatically starts upon the launch of Google Earth: it first zooms to Boston and ends in New York City where the user can then interact with the time slider or click on the polygons for the pop-up boxes.
|
|
|
|
|
|
<details><summary>See the Code for the googleEarth_Tour.java Class</summary>
|
|
|
|
... | ... | @@ -1116,7 +1120,7 @@ KML Tour created and stored at C:\Users\Christina\Documents\Test Folder\A Little |
|
|
|
|
|
## User Input 2
|
|
|
|
|
|
Before launching the Google Earth application, we wanted to ask the user to confirm that they want to launch the programme. For this, we simply used a scanner to prompt the user to enter some form of "yes" to launch the programme. If something else is entered, we end the programme. We called the askUser2() method from the non-executable [user_Input.java](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/User_input.java) class.
|
|
|
Here, we call the class user_input.java again, but we call a different method than the one in step 2 (then: .askUser1(), now: .askUser2()). Before launching the Google Earth application, we wanted to ask the user to confirm that they want to launch the programme. For this, we simply used a scanner to prompt the user to enter some form of "yes" to launch the programme. If something else is entered, the programme ends. We called the askUser2() method from the non-executable [user_Input.java](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/User_input.java) class.
|
|
|
|
|
|
<details><summary>See the Code for the user_Input.java Class</summary>
|
|
|
|
... | ... | @@ -1224,7 +1228,7 @@ Continued. |
|
|
|
|
|
## Launch Google Earth
|
|
|
|
|
|
In this final step, we merely used one [non-executable class "googleEarth_launch"](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/GoogleEarth_launch.java) with a method `launchGoogleEarth()` that launches google earth and opens all .kml files, including the tour.
|
|
|
In this final step, we merely use a non-executable class [googleEarth_launch.java](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Final%20Version/GoogleEarth_launch.java) with a method `launchGoogleEarth()` that launches google earth and opens all .kml files, including the tour.
|
|
|
|
|
|
<details><summary>See the Code for the googleEarth_launch.java Class</summary>
|
|
|
|
... | ... | |