Skip to main content

Elevation Data Processing

Elevation data provides crucial terrain information for route planning, helping identify steep grades and elevation changes that affect caravan towing.

Overview

Data Source: SRTM (Shuttle Radar Topography Mission) 90m Digital Elevation Model

Coverage: All of Australia (4.3 million road segments)

Processing: Background process calculating elevation profiles for all road segments

What's Calculated

For each road segment, the system calculates:

  • Start/end elevation
  • Minimum/maximum elevation
  • Elevation gain/loss
  • Average grade percentage
  • Maximum grade percentage
  • Grade category (flat, gentle, moderate, steep, very_steep)

Data Source

SRTM 90m DEM

  • Resolution: 90 meters
  • Tiles: 31 tiles covering all of Australia
  • Source: EarthExplorer (USGS)
  • Format: GeoTIFF (.tif files)

Coverage by State:

  • Western Australia (WA)
  • South Australia (SA)
  • Northern Territory (NT)
  • Victoria (VIC)
  • New South Wales (NSW)
  • Queensland (QLD)
  • Tasmania (TAS)

Processing Scripts

Smart Elevation Processing

Script: scripts/process-all-elevations-smart.ts

Features:

  • Loads SRTM tiles once at startup
  • Processes all segments with progress tracking
  • Match rate: ~69% (segments with elevation data)
  • Imports in batches of 1000

Command:

# Process all segments
npm run db:process-elevations

# Check progress
npm run db:check-elevation-progress

Download SRTM Tiles

Script: scripts/download-srtm-tiles.sh

Downloads required SRTM tiles for Australia from Earth Explorer.

Command:

./scripts/download-srtm-tiles.sh

Performance

Processing Rate: ~1,000 segments/minute Import Rate: ~700 elevation records/minute Estimated Time: 48-72 hours for all 4.3 million segments

Grade Categories

Segments are categorized by maximum grade:

CategoryGrade RangeCaravan Impact
Flat0-2%✅ Easy
Gentle2-5%✅ Easy
Moderate5-8%⚠️ Caution
Steep8-12%⚠️ Difficult
Very Steep>12%❌ Avoid

Monitoring Progress

Check Status

npm run db:check-elevation-progress

View Progress File

cat packages/database/scripts/.elevation-smart-progress.json

Example output:

{
"totalSegments": 4300000,
"processedSegments": 58000,
"percentComplete": 1.35,
"lastProcessedId": "uuid-here",
"timestamp": "2025-10-14T10:30:00Z"
}

Watch Live Processing

tail -f ~/Downloads/elevation-australia-FULL.log

Database Schema

Elevation Records Table

CREATE TABLE segment_elevations (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
segment_id UUID REFERENCES route_segments(id) NOT NULL,
start_elevation DECIMAL(7, 2),
end_elevation DECIMAL(7, 2),
min_elevation DECIMAL(7, 2),
max_elevation DECIMAL(7, 2),
elevation_gain DECIMAL(7, 2),
elevation_loss DECIMAL(7, 2),
avg_grade DECIMAL(5, 2),
max_grade DECIMAL(5, 2),
grade_category grade_category_enum,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW()
);

Usage Examples

Find Steep Segments Along Route

const { data } = await supabase
.from('route_segments')
.select('*, segment_elevations(*)')
.gte('latitude', minLat)
.lte('latitude', maxLat)
.filter('segment_elevations.max_grade', 'gt', 8);

Get Elevation Profile for Route

const { data } = await supabase
.from('route_segments')
.select('id, geometry, segment_elevations(start_elevation, end_elevation, max_grade)')
.in('id', segmentIds)
.order('sequence_number');

Status

Implementation: In Progress Current Progress: Processing elevation data for all segments Estimated Completion: 48-72 hours for full Australia coverage

Future Enhancements

  1. Higher Resolution DEMs: Use 30m or 10m resolution where available
  2. Real-time Updates: Automatically process new segments
  3. Elevation Alerts: Warn users of steep grades on planned routes
  4. Elevation Charts: Visualize elevation profiles in mobile app