The Ancient Trees of Ireland: Interactive Dashboard

Project Overview:

This project presents an interactive map of Ireland's ancient trees, offering detailed insights into the country's rich biodiversity. Built using Dash, Plotly, and Flask, the dashboard allows users to explore data on Ireland's heritage trees, with filtering options based on county, species, age range, and tree type. The trees' geographical locations are accurately plotted on a map, thanks to geospatial data transformations.

Libraries and Tools:

  • Pandas: Used for data preprocessing, cleaning, and transformation.

  • Dash: The core framework for building the interactive web application.

  • Plotly: Utilized for creating an interactive scatter map of Ireland's heritage trees.

  • Flask: A lightweight web framework for handling the app's backend and routing.

  • Pyproj: Used to convert Irish Grid coordinates to latitude and longitude for accurate map plotting.

  • Regex: Applied for data cleaning tasks, such as extracting county names from the dataset.

Data Preprocessing:

The data is sourced from a CSV file containing information about Ireland's heritage trees. Key preprocessing steps include:

  • Date Parsing: Converted date columns to a consistent format.

  • County Extraction: Extracted county names from the 'SiteName' field using regex.

  • Geospatial Transformation: Converted Irish Grid coordinates to latitude and longitude (WGS84 format) using Pyproj for accurate geolocation.

  • Common Name Mapping: Scientific names of trees were mapped to their common names using a predefined dictionary.

  • Tree Type Classification: Classified trees into broader types (e.g., Firs, Oaks, Maples) based on their scientific names.

Application Features:

  • Interactive Filters:

    • Filter trees by County, Broad Type (e.g., Firs, Oaks), Common Name, and Age Range.

  • Map Visualization:

    • A dynamic scatter map allows users to explore the geographic distribution of trees. Each tree is displayed with hoverable details, including its common name, taxon, tree form, age range, and condition.

  • Responsive UI:

    • The app layout dynamically updates based on user inputs, offering an intuitive exploration experience.

How It Works:

  • The Dash app is integrated with Flask, providing routing for both the dashboard and a homepage.

  • The dashboard's layout includes dropdowns for filtering the data and a map component for visualizing the filtered trees.

  • When the user applies filters (e.g., selecting a county or a tree type), the map is updated via a callback function that processes the selected filters and updates the displayed data.

  • The app is set up to run on any server environment, making it highly portable.

Key Files:

  • HeritageTreesOfIreland_transformed.csv: The preprocessed dataset containing Ireland’s ancient trees with geographic coordinates transformed into WGS84.

  • HeritageTreesOfIreland_transformed_updated.csv: An updated version of the dataset for further analysis and visualizations.

Example Flask Routes:

The app includes a basic Flask route for a homepage:

@server.route('/') def index(): return "<h1>Welcome to the Interactive Trees of Ireland Dashboard!</h1>"

Deployment:

  • The application is configured to run on a specified port (default: 8053) or dynamically assigned ports via environment variables. It is capable of handling incoming connections by binding to 0.0.0.0, making it suitable for deployment on cloud platforms.

How to Run:

  1. Install the necessary Python libraries:

    pip install pandas plotly dash flask pyproj

  2. Ensure that the dataset (HeritageTreesOfIreland_transformed.csv or HeritageTreesOfIreland_transformed_updated.csv) is in the project directory.

  3. Run the app by executing the Python script:

    python app.py

  4. Access the app in a browser at http://127.0.0.1:8053.

Future Enhancements:

  • Historical Data: Include additional historical information about significant heritage trees.

  • Advanced Filters: Introduce filters for tree condition and conservation status.

  • Mobile Optimization: Enhance the UI for better mobile device support.

This project provides a powerful tool for visualizing Ireland's ancient trees, demonstrating proficiency in Python, data processing, geospatial analysis, and web application development.

Previous
Previous

Predicting Employee Attrition Using Machine Learning

Next
Next

Spotify Data Application