Skip to content

Hdgh0g/flights-visualisation-ai-powered

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flight Visualisation App

An interactive web application for visualizing flight data on a map. Upload CSV files containing flight information and see flight routes displayed as curved geodesic lines connecting airports on an interactive map with color-coded frequency indicators.

Screenshot

Flight Visualisation App

Features

  • πŸ“ CSV File Upload: Simple drag-and-drop or click-to-upload interface with processing state
  • πŸ—ΊοΈ Interactive Map: Powered by Leaflet and OpenStreetMap with restricted bounds
  • ✈️ Flight Routes: Geodesic (great circle) paths with gradient colors based on airport frequency
  • 🎯 Airport Markers: Color-coded by frequency (blueβ†’cyanβ†’greenβ†’orangeβ†’red), expandable on hover
  • πŸ“Š Year Filter: Filter flights by year with live statistics
  • πŸ“ˆ Histogram: Visual breakdown of flights by year or month
  • 🎨 Modern UI: Split-panel layout with compact, responsive design
  • ⚠️ Error Handling: Comprehensive validation with detailed error reporting and dismissible banner

Tech Stack

  • Vue 3 - Progressive JavaScript framework
  • TypeScript - Type-safe development
  • Vite - Fast build tool and dev server
  • Leaflet - Interactive map library
  • Leaflet.geodesic - Great circle route visualization
  • OpenStreetMap - Free map tiles

Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation

  1. Clone the repository:
git clone https://github.com/Hdgh0g/flights-visualisation-ai-powered.git
cd flights-visualisation-ai-powered
  1. Install dependencies:
npm install

Running the App

Start the development server:

npm run dev

The app will be available at http://localhost:5173 (or another port if 5173 is busy).

Building for Production

Build the app for production:

npm run build

Preview the production build:

npm run preview

Project Structure

flights-visualisation-ai-powered/
β”œβ”€β”€ public/
β”‚   └── data/
β”‚       β”œβ”€β”€ airports.csv                       # Airport database (83k+ airports)
β”‚       β”œβ”€β”€ sample-flights.csv                 # Sample valid flight data
β”‚       β”œβ”€β”€ sample-flights-with-errors.csv     # Sample with parsing errors
β”‚       └── sample-flights-invalid-airports.csv # Sample with invalid airport codes
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ FileUploadModal.vue    # File upload with processing spinner
β”‚   β”‚   β”œβ”€β”€ MapView.vue            # Interactive map with markers and routes
β”‚   β”‚   β”œβ”€β”€ YearFilter.vue         # Year filter with statistics and histogram
β”‚   β”‚   └── ResultBanner.vue       # Dismissible results/errors banner
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   β”œβ”€β”€ Flight.ts              # Flight data types and class
β”‚   β”‚   β”œβ”€β”€ Airport.ts             # Airport data types and class
β”‚   β”‚   └── FlightVisualization.ts # Combined flight + airport visualization data
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ flightDataParser.ts           # Flight CSV parser with validation
β”‚   β”‚   β”œβ”€β”€ airportsParser.ts             # Airports CSV parser (IATA-indexed)
β”‚   β”‚   └── flightVisualizationBuilder.ts # Combines flights with airport data
β”‚   β”œβ”€β”€ App.vue                    # Main app component with layout orchestration
β”‚   β”œβ”€β”€ main.ts                    # App entry point
β”‚   └── style.css                  # Global styles
β”œβ”€β”€ index.html                     # HTML template
β”œβ”€β”€ vite.config.ts                # Vite configuration
β”œβ”€β”€ tsconfig.json                 # TypeScript configuration
└── package.json                  # Project dependencies

Features in Detail

πŸ“ Data Upload & Processing

  • File upload modal with drag-and-drop support
  • Processing spinner during file parsing
  • Comprehensive validation for CSV structure and data quality
  • Error reporting with detailed messages and dismissible banner
  • Sample files included for testing

πŸ—ΊοΈ Interactive Map

  • Leaflet-based map with OpenStreetMap tiles
  • Restricted bounds to prevent panning outside world map
  • Auto-fit to show all airports in current dataset
  • Min/max zoom controls for optimal viewing
  • Smooth interactions with hover effects and animations

🎯 Airport Markers

  • Color-coded by frequency: Blue (0-15%) β†’ Cyan (15-30%) β†’ Green (30-50%) β†’ Orange (50-75%) β†’ Red (75-100%)
  • Compact circular markers (16Γ—16px) by default
  • Expand on hover to show IATA code (48Γ—28px pill shape)
  • Stay expanded when popup is open
  • Auto-close previous popup when clicking another marker
  • Interactive popups showing:
    • IATA code (color-matched to marker)
    • Airport name
    • City/region
    • Flight frequency count

✈️ Flight Routes

  • Geodesic lines following great circle paths (realistic curved routes)
  • Gradient colors transitioning from departure to arrival airport frequency colors
  • 10-segment interpolation for smooth color transitions
  • Interactive popups showing flight route and airline/flight number
  • Semi-transparent (60% opacity) to avoid cluttering the map

πŸ“Š Year Filter & Statistics

  • Split-panel layout: Upload on left, filter on right (when data loaded)
  • Year dropdown to filter flights by departure year
  • Live statistics: Shows flight count and distinct airports for selected period
  • Compact histogram:
    • By year when no filter applied (shows last 2 digits)
    • By month when year selected (shows month initials)
    • Hover tooltips with exact counts
    • Properly contained labels within histogram wrapper

⚠️ Error Handling

  • CSV parsing errors: Missing columns, invalid values, malformed timestamps
  • Airport resolution errors: Invalid IATA codes not found in database
  • Detailed error messages: Shows row numbers, field names, and actual values (truncated to 30 chars)
  • Partial success: Continues processing valid rows even when some fail
  • Dismissible banner: Close button to hide results after review
  • Auto-reset: Banner reappears when new file uploaded

CSV Format

The app expects CSV files with the following required columns:

  • airline - Airline name or code
  • flight_code - Flight number/code
  • departure_airport - Departure airport code (e.g., HEL)
  • arrival_airport - Arrival airport code (e.g., JFK)
  • departure_timestamp_local - Departure time (local timezone)
  • arrival_timestamp_local - Arrival time (local timezone)

Supported Timestamp Formats

The parser supports multiple timestamp formats:

  • YYYY-MM-DD HH:mm:ss (e.g., 2019-07-28 20:20:00)
  • DD.MM.YYYY HH:mm:ss (e.g., 14.11.2025 20:35:00)

Example CSV

airline,flight_code,departure_airport,arrival_airport,departure_timestamp_local,arrival_timestamp_local
Finnair,AY123,HEL,JFK,2024-01-15 12:30:00,2024-01-15 08:45:00
Lufthansa,LH456,HEL,FRA,14.02.2024 10:15:00,14.02.2024 10:30:00

Sample files are included in /public/data/:

  • sample-flights.csv - Valid flight data for testing
  • sample-flights-with-errors.csv - CSV parsing errors (missing values, invalid timestamps)
  • sample-flights-invalid-airports.csv - Airport resolution errors (invalid IATA codes)

Validation

The app performs comprehensive validation:

  • βœ… Column check: All required columns must be present
  • βœ… Value check: Each row validated for missing/empty values
  • βœ… Timestamp parsing: Supports multiple formats with clear error messages
  • βœ… Airport resolution: Verifies all airport codes exist in the database
  • βœ… Partial processing: Continues with valid rows even if some fail
  • βœ… Summary display: Shows flights parsed, distinct airports, and failed rows
  • βœ… Detailed errors: Up to 10 errors shown with row numbers and values

Error Message Examples:

  • Row 5: Missing value for 'departure_airport'
  • Row 12: Invalid timestamp '2024-13-45 25:00:00' for 'departure_timestamp_local'
  • Flight Finnair AY123: Departure airport 'XXX' not found in airports database

Airports Database

The app includes a comprehensive airports database (/public/data/airports.csv) with 83,000+ airports worldwide.

Airport Data Structure

Each airport includes:

  • IATA Code - 3-letter code (e.g., HEL, JFK, LHR) - used as the key in the airports map
  • ICAO Code - 4-letter code
  • Name - Full airport name
  • Coordinates - Latitude and longitude
  • Location - Municipality, region, country
  • Type - Airport type (large_airport, medium_airport, etc.)
  • Elevation - Elevation in feet

Usage

import { loadAirports } from './utils/airportsParser'

// Load all airports (only those with IATA codes)
const airportsMap = await loadAirports()

// Get specific airport by IATA code
const helsinki = airportsMap.get('HEL')
console.log(helsinki?.name) // "Helsinki Vantaa Airport"
console.log(helsinki?.getCoordinates()) // [60.318363, 24.963341]

About

Trying to play with AI agents, Cursor, Claude and others to visualize flights on the map

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages