• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
brendanashworth

brendanashworth

militaryplanes

Public
Like
1
militaryplanes
Home
Code
5
README.md
H
etl-pipeline.ts
H
example-usage.ts
main.tsx
H
map-viewer.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
8/27/2025
Viewing readonly version of main branch: v8
View latest version
README.md

Milradar ETL Pipeline

This project provides an ETL (Extract, Transform, Load) pipeline that fetches military aircraft data from the milradar.com API and converts it to GeoJSON format for use in mapping applications.

Features

  • Extract: Fetches real-time aircraft data from milradar.com API
  • Transform: Converts the data to standard GeoJSON format
  • Load: Provides optional filtering capabilities
  • HTTP API: Accessible via web endpoint with query parameters
  • Error Handling: Robust error handling with detailed logging
  • Caching: 1-minute cache headers for performance

API Endpoint

The ETL pipeline is available as an HTTP endpoint at /etl-pipeline.ts.

Basic Usage

GET /etl-pipeline.ts

Returns all aircraft as GeoJSON FeatureCollection.

Query Parameters

  • only_flying=true - Filter to only include aircraft that are currently flying
  • min_speed=<number> - Filter to only include aircraft with ground speed >= specified value
  • aircraft_types=<comma-separated-list> - Filter to only include specific aircraft types

Examples

# Get all aircraft curl "https://your-val-town-url/etl-pipeline.ts" # Get only flying aircraft with speed >= 300 knots curl "https://your-val-town-url/etl-pipeline.ts?only_flying=true&min_speed=300" # Get only B737 and A332 aircraft with speed >= 300 knots curl "https://your-val-town-url/etl-pipeline.ts?min_speed=300&aircraft_types=B737,A332"

Data Format

Input (Milradar API)

[ { "id": 8409, "plane_type_id": 1409, "lat": 47.611162, "lon": -68.5568, "gspeed": 433, "type": "C17", "callsign": "BRK81 ", "track": 199, "is_flying": true } ]

Output (GeoJSON)

{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-68.5568, 47.611162] }, "properties": { "id": 8409, "plane_type_id": 1409, "gspeed": 433, "type": "C17", "callsign": "BRK81", "track": 199, "is_flying": true } } ] }

Key Transformations

  1. Coordinate System: Converts from lat, lon to GeoJSON [longitude, latitude] format
  2. Data Cleaning: Trims whitespace from callsigns
  3. Structure: Wraps individual points in GeoJSON Feature format
  4. Collection: Groups all features into a FeatureCollection

Usage in Applications

JavaScript/TypeScript

// Fetch all aircraft data const response = await fetch('/etl-pipeline.ts'); const geoJSON = await response.json(); // Use with mapping libraries like Leaflet, Mapbox, etc. L.geoJSON(geoJSON).addTo(map);

Python

import requests # Fetch filtered data response = requests.get('/etl-pipeline.ts?only_flying=true&min_speed=200') geojson_data = response.json() # Use with mapping libraries like Folium import folium m = folium.Map() folium.GeoJson(geojson_data).add_to(m)

Error Handling

The API returns appropriate HTTP status codes:

  • 200 OK: Successful data retrieval and transformation
  • 500 Internal Server Error: Pipeline failure (with error details in JSON response)

Error responses include:

{ "error": "ETL Pipeline failed", "message": "Detailed error message", "timestamp": "2024-01-01T12:00:00.000Z" }

Performance

  • Caching: Responses are cached for 1 minute to reduce API load
  • CORS: Enabled for cross-origin requests
  • Content-Type: Proper application/geo+json content type

Common Aircraft Types

The API includes various military aircraft types:

  • B737: Boeing 737
  • C17: Boeing C-17 Globemaster III
  • A332: Airbus A330-200
  • H60: Sikorsky UH-60 Black Hawk
  • TEX2: Beechcraft T-6 Texan II
  • C30J: Lockheed Martin C-130J Super Hercules
  • And many more...

Development

The pipeline is implemented as a single TypeScript file with:

  • Type definitions for both input and output formats
  • Modular functions for each ETL stage
  • Comprehensive error handling and logging
  • Query parameter parsing for filtering options
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.