Documentation

Welcome to the documentation for the FRESH Project. The following information documents the different components of the web application as well as the data, tools, packages, and methodology used to create it. Instructions on how to install, deploy, and visualize both elements of the web application are also included below.

I. Data & Tools

I.I Data & Sources

I.II Tools & Packages

For more information on the python packages used see Additional Resources below

II. Web application & flask set up

The libraries used to develop the web application include: flask, osmnx, folium and geopandas. Flask, a lightweight web server gateway interface (WSGI) for web application development using python, provided the framework within which the routing and hurricane visualization applications were developed and hosted.

The web application homepage was designed using HTML. The homepage allows a user to insert coordinates for the starting and endings point that they want to use in the Flood Routing Generator. The routing map then uses the provided coordinates to provide users with the best path for a vehicle to take between the two points. Users can click on the route to reveal the hurricane track and movement maps.

Methodology for developing the web application

  1. Created an environment and installed all the required packages
  2. Imported all the packages
  3. Created a Flask interface application with the name @app and specified the path. In this case we have 3 paths: base, generate_route and hurricane_path
    • @app.route("/") - This route handles the default root URL
    • @app.route("/generate_route") - This route uses the starting and ending latitude and longitude values to calculate and display the shortest driving route on a map using folium.
    • @app.route("/hurricane_path") - This route displays the path for hurricane Dorian in an interactive manner

Steps to install and deploy the Flask web application

  1. Install the application using conda
  2. 
            git clone https://github.com/MadelineMulder/FRESH.git
            cd application
            conda env create -f freshenv.yml
            conda activate freshenv
            
  3. Navigate to the main.py file and set the correct path to the Grand_Bahama.shp and hurricanepolygon.shp which are in the data folder.
  4. Navigate to the index.html file in the templates folder and set the correct path to the Grand_Bahama.shp and hurricanepolygon.shp which are in the data folder.
  5. Run the script main.py in your console and a url will be provided to visualize the application in your local machine.You should have something like this:
  6. fresh

  7. To view the hurricane map change the local host path from …/generate_route to /hurricanepath.

III. Routing

Routing App homepage

The OSMnx library was used for the routing portion of this project. Osmnx is a python package that lets you download geospatial data from OpenStreetMap and model, project, visualize, and analyze real-world street networks and any other geospatial geometries. The full routing code can be viewed in the main.py file within the application directory in the FRESH Project Repository. Osmnx is a python package that lets you download geospatial data from OpenStreetMap and model, project, visualize, and analyze real-world street networks and any other geospatial geometries.

IV. Hurricane Visualization

Hurricane App homepage

This part is divided into 2 maps

IV.I Hurricane Formation Animation

This map shows the formation of Hurricane Dorian from the first day to the last day of the event. The hurricane formed on August 24, 2019 from a tropical wave in the Central Atlantic and gradually strengthened as it moved toward the Lesser Antilles and then hit the Grand Bahamas on August 26, 2019.

The hurricane edges have animated lines with movement effects using AntPath plugin of Folium Python module. The lines plot a route between multiple locations with the help of latitude and longitudes.

"AntPath" is an external plugin that allows you to create animated polylines on a Leaflet map. It adds a unique visual effect to your maps, making it look like ants are moving along the polylines. It provides a visually appealing way to display paths or routes.

Features: Parameters: Methodology for developing the hurricane formation application
  1. Initialize the map: Use the Leaflet library to create a map instance, providing the map container ID and initial settings (center, zoom level, etc.).
  2. 
                latlon = [x, y] 
                map = folium.Map(location = latlon, tiles='cartodbdark_matter', zoom_start = 5)
              
  3. Add a polyline: Create a polyline using the Leaflet library and add it to the map.
  4. 
                pathLatLngs1 = [(),(),(),()] 
                pathLatLngs2 = [(),(),(),()] 
                pathLatLngs3 = [(),(),(),()]
              
  5. Initialize "AntPath" plugins: After adding the polyline, initialize the "AntPath" plugin by passing the polyline and any optional configuration parameters.
  6. 
                from folium.plugins import AntPath 
              
  7. Create antpaths and add to map
  8. 
                AntPath(pathLatLngs1, delay=500, dash_array=[30,15], color="#FECBB6", pulse_color="#BB9983", weight=1, opacity=1).add_to(mm) 
      
                AntPath(pathLatLngs2, delay=500, dash_array=[10,50], color="#FEBCA2", pulse_color="#BB8F74", weight=2, opacity=1).add_to(mm) 
      
                AntPath(pathLatLngs3, delay=500, dash_array=[10,50], color="#FEAF8F", pulse_color="#BF8A6A", weight=3, opacity=1).add_to(mm) 
              

IV.II Hurricane Track with Timestamps

This map shows the tracks for Hurricane Dorian evolving over time from the starting time (24 August 2019, 11 A.M.) to the end of hurricane event (26 August 2019, 11 P.M.).

This portion of the application utilises the TimestampedGeoJson plugin which is an extension to Folium that allows users to display time-series data on a map using GeoJSON files with timestamps. The main function provided by the TimestampedGeoJson plugin is TimestampedGeoJson. It creates a time-aware GeoJSON layer that can be added to a Folium Map. This plugin is particularly useful for displaying temporal data such as the movement of objects, changes in events over time, or any other time-based geospatial information.

Data Format: The input data for the TimestampedGeoJson function should be in a GeoJSON-like format with time-series information. Each feature in the GeoJSON should have a properties attribute that includes a time field representing the timestamp for that feature. The time field should be in ISO 8601 format, in our project we used date options to "YYYY/MM/DD HH:mm:ss" because the hurricane moved every 3-4 hours.

Parameters: Methodology for developing the hurricane tracking with timestamps application
  1. Initialize "TimestampedGeoJson" plugins: To use the TimestampedGeoJson plugin, import it along with Folium in your Python script:
  2. 
                  import folium 
                  from folium.plugins import TimestampedGeoJson 
                

V. Additional Resources