At the outset we began gathering ideas and drawing up concepts for our approach. We have visualised our concept below:
...
...
@@ -226,7 +225,7 @@ public class GoogleEarthTweetMapper {
</details>
## User Input
## 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.
...
...
@@ -343,9 +342,7 @@ New directory set to: C:\Users\Christina\Documents\Test Folder
</details>
## Web Map Service
### Connecting and Downloading WMS
## Connecting to WMS and Downloading Image
First, we created a [non-executable class "wms_GetMap"](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Previous%20Versions%20(working%20files)/Christina%2004_07_2021/wms_GetMap.java) that contains a method `getMap()` that:
> 1. creates a WebMapServer object
...
...
@@ -489,7 +486,7 @@ The result is this image "boston.png":
Here, we created a [non-executable class "wms_ImageToKML"](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Previous%20Versions%20(working%20files)/Christina%2004_07_2021/wms_ImageToKML.java) that contains a method `wmsTOkml()` that:
...
...
@@ -584,9 +581,7 @@ Image converted to kml and stored at: C:\Users\Christina\Documents\Test Folder\b
</details>
## Downloading and Converting Twitter.csv File
### Downloading
## Downloading Twitter.csv File
Although this step was not included in the assignment instructions, we decided it would be nice for the user to not worry about having to download the .csv file themselves. Therefore we created a [non-executable class "tweets_download"](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Previous%20Versions%20(working%20files)/Christina%2004_07_2021/tweets_download.java) that contains the methods `saveFileFromUrlWithCommonsIO()` and `downloadCSV()` that:
...
...
@@ -652,7 +647,7 @@ CSV file downloaded and stored at :C:\Users\Christina\Documents\Test Folder\twee
</details>
### Converting .csv into .kml
## Converting Tweets.csv into Tweets.kml
This step proved to be the most complex one. In the end we used two methods within the tweets_polygons.java class. The first method dynamically determines a colour-code for the placemarks depending on the time of the tweet. The second method creates a kml file that contains 3D polygons for the point locations, with pop-up boxes, time-stamps, and a colour-coded visualisation of the time of the tweet.
...
...
@@ -661,7 +656,7 @@ In the process of creating this class we had to deal with a few challenges:
**Time Stamp:** After some initial [research](https://developers.google.com/kml/documentation/kmlreference#timestamp) into typical kml-conform time stamps and comparing them to "created_at" column in the tweets.csv file, we chose to aim for a time stamp that was already mostly given in the .csv, but with a few differences:
> kml time stamp: 1997-07-16T10:30:15+03:00
>
> tweets.csv time format: 2012-11-05 15:47:16+01
We therefore concluded that we needed to add in the "T" where the blank space is and add ":00" at the end.
...
...
@@ -1088,34 +1083,171 @@ KML Tour created and stored at C:\Users\Christina\Documents\Test Folder\A Little
```
</details>
## User Input 2
## Launch Google Earth
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 user_Input.java class.
### 4.1: Ask User to Proceed and Launch
<details><summar>See the Code for the user_Input.java Class</summary>
In this final step, we merely used one [non-executable class "googleEarth_launch"](https://git.sbg.ac.at/s1080384/EoT/-/blob/main/Java%20Codes/Previous%20Versions%20(working%20files)/Christina%2004_07_2021/googleEarth_launch.java) with a method `launchGoogleEarth()` that:
```java
> - asks the user if they would like to proceed or else end the programme
> - launches google earth and opens the .kml files
packageeot_Sahinovic_Woehs_Zorenboehmer;
Once again, we are keeping the user informed. The console will show the following:
importjava.io.File;
importjava.util.Scanner;
<details><summary>See Console Output</summary>
publicclassUser_input{
publicstaticStringdirectory;
staticStringaskUser1(){
ScanneraskUser=newScanner(System.in);// warning coming from non-closed scanner. Note: if we close it, subsequent scanners fail to work.
Stringanswer;
// welcome and information for user
System.out.println("Hello! Welcome to this Google Earth Tweet and WMS Mapper!\n\n"
+"This programme will:\n"
+"1: download an image of Boston from a WMS\n"
+"2: convert it into a KML structure\n"
+"3: download a tweets.csv file from the web\n"
+"4: convert it into a KML structure\n"
+"5: create a KML file for a tour in Google Earth\n"
+"6: launch all kml files in Google Earth\n\n"
+"By default, the downloaded files will be stored at: C:\\Users\\Public\\Documents"
+"\nIf this is fine, please enter Y below and hit enter to continue! If not, enter anything else to set a new directory.");
answer=askUser.next();
StringnewDirectory=null;
// if yes, set directory to the default and return directory
System.out.println("We have created a small tour to show you the WMS and Tweets in Google Earth. It will automatically begin when Google Earth is launched.\n"
+"Would you like to proceed to launch Google Earth now? Type Y for yes or anything else for no and hit enter.");
answer1=askContinue.next();
askContinue.close();
// if yes, proceed with programme execution. Else, exit programme.
System.out.println("We've ended the programme for you. If you'd like to try again, run the programme again. :)");// Inform
System.exit(0);
}
}// askUer2()
}// class
```
</details>
<details><summary>See the Concole Output</summary>
```
We have created a small tour to show you the WMS and Tweets in Google Earth. It will automatically begin when Google Earth is launched.
Would you like to proceed to launch Google Earth now? Type Y for yes or anything else for no and hit enter.
y
Proceeding...
Continued.
```
</details>
## 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/Previous%20Versions%20(working%20files)/Christina%2004_07_2021/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>
```java
packageeot_Sahinovic_Woehs_Zorenboehmer;
importjava.io.IOException;
publicclassGoogleEarth_launch{
staticvoidlaunchGoogleEarth(){
System.out.println("Launching Google Earth... ");// Inform