Django app for importing and managing OurAirports data (airports, runways, frequencies, navaids)
Project description
django-ourairports
A Django application to download and import aviation data from OurAirports.
Features
- Import airports, runways, frequencies, navaids, countries, and regions
- GeoDjango support for spatial queries
- Customizable import via plugin hooks
- Management command for easy data management
- Incremental updates with change detection
Requirements
- Python 3.10+
- Django 4.2+
- PostGIS (recommended) or SpatiaLite
- GDAL
Installation
pip install django-ourairports
Add to your INSTALLED_APPS:
INSTALLED_APPS = [
...
'django.contrib.gis',
'ourairports',
]
Run migrations:
python manage.py migrate ourairports
Quick Start
Import all data:
python manage.py ourairports --import=all
Import specific data types:
python manage.py ourairports --import=airport,runway
Flush and reimport:
python manage.py ourairports --flush=all --import=all
Configuration
Optional settings in settings.py:
OURAIRPORTS = {
# Directory for downloaded data files
'DATA_DIR': '/path/to/data',
# Cache duration in seconds (default: 86400 = 24 hours)
'CACHE_DURATION': 86400,
# Batch size for bulk operations
'BATCH_SIZE': 1000,
}
Models
Country
Country information with ISO codes and continent.
Region
Administrative regions (states, provinces) with ISO 3166-2 codes.
Airport
Airports with location, type, codes (IATA, ICAO/GPS), and metadata.
Runway
Runway details including dimensions, surface, lighting, and end coordinates.
Frequency
Radio frequencies (TWR, APP, ATIS, etc.) for airports.
Navaid
Navigation aids (VOR, NDB, DME, TACAN) with locations and frequencies.
Usage Examples
from ourairports.models import Airport, Country, Runway
# Find airports by IATA code
jfk = Airport.objects.get(iata_code='JFK')
# Find large airports in a country
us_large = Airport.objects.filter(
iso_country='US',
airport_type='large_airport'
)
# Airports with scheduled service
scheduled = Airport.objects.filter(scheduled_service=True)
# Find airports near a point (requires PostGIS)
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
point = Point(-73.7781, 40.6413) # JFK coordinates
nearby = Airport.objects.filter(
location__distance_lte=(point, D(km=50))
)
# Get runways for an airport
runways = jfk.runways.all()
# Get frequencies for an airport
frequencies = jfk.frequencies.filter(frequency_type='TWR')
Management Command
# Show help
python manage.py ourairports --help
# Import all data
python manage.py ourairports --import=all
# Import specific types
python manage.py ourairports --import=country,region,airport
# Flush data before import
python manage.py ourairports --flush=airport --import=airport
# Force re-download (ignore cache)
python manage.py ourairports --import=all --force
# Dry run (parse without saving)
python manage.py ourairports --import=airport --dry-run
# Download only (no import)
python manage.py ourairports --download-only
# List cached files
python manage.py ourairports --list
# Clear cache
python manage.py ourairports --clear
Import Options
| Option | Description |
|---|---|
country |
Countries |
region |
Regions (states/provinces) |
airport |
Airports |
runway |
Runways |
frequency |
Radio frequencies |
navaid |
Navigation aids |
all |
All of the above |
Plugin System
Customize imports with hooks:
# yourapp/plugins.py
from ourairports.plugin import HookException
def airport_pre(row, importer):
"""Called before each airport is processed."""
# Skip closed airports
if row.get('type') == 'closed':
raise HookException("Skipping closed airport")
return row
def airport_post(airport, row, importer):
"""Called after each airport is saved."""
# Add custom processing
pass
Register in settings:
OURAIRPORTS = {
'PLUGINS': ['yourapp.plugins'],
}
Data Source
Data is sourced from OurAirports, a community-maintained database of airports worldwide. The data is released to the public domain.
Disclaimer
This project is not affiliated with, endorsed by, or associated with OurAirports or its maintainers. It is an independent, third-party Django integration that consumes publicly available OurAirports data.
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_ourairports-0.1.0.tar.gz.
File metadata
- Download URL: django_ourairports-0.1.0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dd0b6e14ad15a2bf68f8cf9b68b0c83cf86c6b946ea1737430a2e81a81b5b22
|
|
| MD5 |
b1d02a1947acb6ea0d00def6a95ef963
|
|
| BLAKE2b-256 |
88ca0c1b0b6d6fe4df0d1d22966066b731667af62df1f595e968d4e926b64f05
|
Provenance
The following attestation bundles were made for django_ourairports-0.1.0.tar.gz:
Publisher:
publish.yml on arthanson/django-ourairports
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_ourairports-0.1.0.tar.gz -
Subject digest:
1dd0b6e14ad15a2bf68f8cf9b68b0c83cf86c6b946ea1737430a2e81a81b5b22 - Sigstore transparency entry: 1229869432
- Sigstore integration time:
-
Permalink:
arthanson/django-ourairports@6650aea59f68183fb9cb2ae6ad8ad6acafb9ffce -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/arthanson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6650aea59f68183fb9cb2ae6ad8ad6acafb9ffce -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_ourairports-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_ourairports-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caa0a4d2cf3deb000dc78cfd06c976f18bdfedd5bf6ca09d5760064c0f734131
|
|
| MD5 |
7dfe9cc10b91424f3aa774e68871f39e
|
|
| BLAKE2b-256 |
db1905d1c8398c3a0c225aa0d948756b79567c3998cb1fc47d44e7c2c67c63fb
|
Provenance
The following attestation bundles were made for django_ourairports-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on arthanson/django-ourairports
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_ourairports-0.1.0-py3-none-any.whl -
Subject digest:
caa0a4d2cf3deb000dc78cfd06c976f18bdfedd5bf6ca09d5760064c0f734131 - Sigstore transparency entry: 1229869498
- Sigstore integration time:
-
Permalink:
arthanson/django-ourairports@6650aea59f68183fb9cb2ae6ad8ad6acafb9ffce -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/arthanson
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6650aea59f68183fb9cb2ae6ad8ad6acafb9ffce -
Trigger Event:
release
-
Statement type: