Skip to content

Repository files navigation

🌿 Project GeoLab

A static web-based visualization tool for classifying ecological indicators and exploring their correlation with carbon degradation in Australia's Kakadu National Park.

TypeScript React Vite Mapbox

🎯 Overview

Project GeoLab simplifies complex Earth observation data into interpretable visuals that support early-stage environmental analysis. By highlighting potential links between wetland dynamics and carbon loss, the project encourages further exploration into climate-sensitive ecosystems.

Built with modern React patterns, custom hooks architecture, and comprehensive TypeScript type safety, this project demonstrates best practices for geospatial web applications.

Key Features

  • πŸ“Š Satellite Data Visualization: NDVI from Landsat for vegetation health monitoring
  • πŸ’§ Hydrological Analysis: Flood/drought signals from Sentinel-1 SAR
  • 🌲 Ecological Classification: Mangrove zones, degraded forests, and hydrological shifts
  • πŸ“ˆ Time-Series Analysis: Interactive charts for seasonal trend tracking
  • ⚠️ Carbon Loss Correlation: Analysis using Sentinel-5P and IPCC coefficients
  • πŸŽ›οΈ Interactive Controls: Layer visibility toggles, time slider, and dynamic data loading
  • πŸ—οΈ Modern Architecture: Custom hooks, type-safe patterns, and race-condition-free data loading

πŸš€ Getting Started

Prerequisites

  • Node.js 20.19+ or 22.12+
  • npm 10+
  • Mapbox access token (Get one here)

Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd GeoLab
  2. Install dependencies

    npm install
  3. Add your Mapbox token

    Open src/components/map-view/MapView.tsx and replace YOUR_MAPBOX_TOKEN with your actual Mapbox access token:

    mapboxgl.accessToken = "your_actual_token_here";
  4. Start the development server

    npm run dev

    Or use the VS Code task: Press Ctrl+Shift+B and select "Dev Server"

  5. Open in browser

    Navigate to http://localhost:5173

πŸ“š Documentation

Comprehensive documentation is available in the docs/ directory:

New to the project? Start with COMPONENT_ARCHITECTURE.md to understand the codebase structure.

πŸ—οΈ Project Structure

GeoLab/
β”œβ”€β”€ docs/                        # Comprehensive documentation
β”‚   β”œβ”€β”€ COMPONENT_ARCHITECTURE.md
β”‚   β”œβ”€β”€ MAPVIEW_ARCHITECTURE.md
β”‚   β”œβ”€β”€ CSS_ARCHITECTURE.md
β”‚   └── DATA_ARCHITECTURE.md
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/              # React components (kebab-case directories)
β”‚   β”‚   β”œβ”€β”€ bottom-sidebar/      # Bottom panel with time-series charts
β”‚   β”‚   β”œβ”€β”€ control-sidebar/     # Right panel with controls
β”‚   β”‚   β”œβ”€β”€ dashboard/           # Main dashboard layout
β”‚   β”‚   β”œβ”€β”€ layer-control/       # Map layer visibility toggles
β”‚   β”‚   β”œβ”€β”€ legend/              # Map legend component
β”‚   β”‚   β”œβ”€β”€ map-view/            # Mapbox geospatial visualization
β”‚   β”‚   β”œβ”€β”€ navigation/          # Top navigation bar
β”‚   β”‚   β”œβ”€β”€ time-series-chart/   # Recharts time-series display
β”‚   β”‚   β”œβ”€β”€ time-slider/         # Year selection slider
β”‚   β”‚   └── index.ts             # Central barrel export
β”‚   β”œβ”€β”€ hooks/                   # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useInitMap.ts        # Map initialization hook
β”‚   β”‚   β”œβ”€β”€ useLayerDataUpdate.ts    # Data loading hook
β”‚   β”‚   β”œβ”€β”€ useLayerVisibility.ts    # Layer toggle hook
β”‚   β”‚   β”œβ”€β”€ useLayerClickHandlers.ts # Event handlers hook
β”‚   β”‚   └── index.ts             # Hooks barrel export
β”‚   β”œβ”€β”€ config/                  # Configuration files
β”‚   β”‚   └── dataSources.ts       # Centralized data sources config
β”‚   β”œβ”€β”€ types/                   # TypeScript type definitions
β”‚   β”‚   └── index.ts             # Global type definitions
β”‚   β”œβ”€β”€ utils/                   # Utility functions
β”‚   β”‚   β”œβ”€β”€ layerHelpers.ts      # Map layer utilities
β”‚   β”‚   └── mockData.ts          # Mock data generators
β”‚   β”œβ”€β”€ theme.css                # Design tokens (CSS variables)
β”‚   β”œβ”€β”€ index.css                # Global reset styles
β”‚   β”œβ”€β”€ styles.css               # Global utility styles
β”‚   β”œβ”€β”€ App.tsx                  # Main application component
β”‚   └── main.tsx                 # Application entry point
β”œβ”€β”€ public/
β”‚   └── data/                    # GeoJSON datasets
β”‚       β”œβ”€β”€ flood/               # Flood data by year
β”‚       └── mangrove/            # Mangrove zone data
└── package.json

Architecture Highlights

  • Custom Hooks Pattern: MapView logic split into focused, reusable hooks
  • Barrel Exports: Clean imports via index.ts files (e.g., import { MapView } from "./components")
  • Type Safety: Full TypeScript coverage with non-null guarantees
  • Race Condition Prevention: Sync lock pattern ensures data loads before event handlers attach
  • Design Tokens: CSS variables in theme.css for consistent styling
  • Component Colocation: Each component has .tsx, .css, and index.ts in its directory

πŸ“¦ Tech Stack

  • Frontend Framework: React 19 with TypeScript 5
  • Build Tool: Vite 6
  • Mapping: Mapbox GL JS 3.8 with react-map-gl
  • Charts: Recharts 2.15
  • Data Format: GeoJSON for geospatial data
  • Styling: CSS Modules with design tokens
  • Data Sources: Landsat (NDVI), Sentinel-1 (SAR)

🎨 Development Principles

  • Simplicity: Focus on clarity over complexity
  • Portability: Easy to deploy and use
  • Minimalism: Clean, interpretable UI
  • Visualization: Show correlations, not models
  • Type Safety: Comprehensive TypeScript with non-null guarantees
  • Single Responsibility: Each hook and component has one clear purpose
  • Documentation: Extensive inline docs and architecture guides

πŸ“ Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

πŸ—ΊοΈ Data Sources

The application visualizes geospatial data from multiple sources:

  • NDVI (Normalized Difference Vegetation Index) from Landsat
  • Flood/Drought Signals from Sentinel-1 SAR
  • Mangrove Zones and degraded forest classification
  • Carbon Loss Estimates using Sentinel-5P and IPCC coefficients

Adding New Data

  1. Place GeoJSON files in public/data/
  2. Add data source configuration to src/config/dataSources.ts
  3. Map layer utilities automatically handle source/layer creation

See DATA_ARCHITECTURE.md for detailed instructions on adding and configuring new datasets.

Note: Currently using test/sample data. Replace with actual satellite data preprocessing pipeline.

🌏 About Kakadu National Park

Kakadu National Park is a climate-sensitive ecosystem in Australia's Northern Territory, known for its unique wetlands, mangrove forests, and rich biodiversity. This tool aims to support environmental monitoring and conservation efforts.

🀝 Contributing

This project was developed with a focus on accessibility and educational value. Contributions that enhance data interpretation, add new visualization types, or improve performance are welcome.

Before Contributing

  1. Read the documentation in docs/ to understand the architecture
  2. Follow the component conventions outlined in COMPONENT_ARCHITECTURE.md
  3. Ensure TypeScript compilation passes: npm run build
  4. Run linting: npm run lint

Adding New Components

See the step-by-step guide in COMPONENT_ARCHITECTURE.md for detailed instructions on creating new components that follow project conventions.

πŸ“„ License

[Add your license here]

πŸ™ Acknowledgments

  • Earth observation data from ESA Copernicus and NASA
  • IPCC for carbon estimation coefficients
  • Traditional owners of Kakadu National Park

πŸ”§ Architecture Patterns

Custom Hooks

MapView logic is refactored into focused custom hooks:

  • useInitMap: Provides map instance and initialization status
  • useLayerDataUpdate: Handles all GeoJSON data loading (initial + year changes)
  • useLayerVisibility: Manages layer visibility toggles
  • useLayerClickHandlers: Attaches event handlers after data loads

See MAPVIEW_ARCHITECTURE.md for detailed data flow and race condition prevention strategies.

Sync Lock Pattern

The app uses a dataLoaded flag to coordinate async operations:

const { map, initialized } = useInitMap();
const { dataLoaded } = useLayerDataUpdate({ map, initialized, currentYear });
useLayerClickHandlers({ map, dataLoaded }); // Only runs after data loads

This prevents race conditions where event handlers attach before map layers exist.


Built with ❀️ for environmental conservation

About

A static web tool that classifies satellite data to visualize wetland changes and carbon degradation in Kakadu National Park using Mapbox and time-series charts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages