local-flight-map 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. local_flight_map-0.0.1/LICENSE +21 -0
  2. local_flight_map-0.0.1/PKG-INFO +279 -0
  3. local_flight_map-0.0.1/README.md +250 -0
  4. local_flight_map-0.0.1/pyproject.toml +63 -0
  5. local_flight_map-0.0.1/setup.cfg +4 -0
  6. local_flight_map-0.0.1/src/local_flight_map/__init__.py +0 -0
  7. local_flight_map-0.0.1/src/local_flight_map/__main__.py +25 -0
  8. local_flight_map-0.0.1/src/local_flight_map/api/__init__.py +41 -0
  9. local_flight_map-0.0.1/src/local_flight_map/api/adsbexchange.py +391 -0
  10. local_flight_map-0.0.1/src/local_flight_map/api/base.py +176 -0
  11. local_flight_map-0.0.1/src/local_flight_map/api/hexdb.py +211 -0
  12. local_flight_map-0.0.1/src/local_flight_map/api/opensky.py +467 -0
  13. local_flight_map-0.0.1/src/local_flight_map/ui/__init__.py +3 -0
  14. local_flight_map-0.0.1/src/local_flight_map/ui/folium/__init__.py +5 -0
  15. local_flight_map-0.0.1/src/local_flight_map/ui/folium/js/markercluster_icon_create_function.js +38 -0
  16. local_flight_map-0.0.1/src/local_flight_map/ui/folium/js/realtime_get_feature_id.js +1 -0
  17. local_flight_map-0.0.1/src/local_flight_map/ui/folium/js/realtime_point_to_layer.js +177 -0
  18. local_flight_map-0.0.1/src/local_flight_map/ui/folium/js/realtime_source.js +23 -0
  19. local_flight_map-0.0.1/src/local_flight_map/ui/folium/js/realtime_update_feature.js +165 -0
  20. local_flight_map-0.0.1/src/local_flight_map/ui/folium/jscode.py +41 -0
  21. local_flight_map-0.0.1/src/local_flight_map/ui/folium/markercluster.py +16 -0
  22. local_flight_map-0.0.1/src/local_flight_map/ui/folium/realtime.py +13 -0
  23. local_flight_map-0.0.1/src/local_flight_map/ui/panel/__init__.py +3 -0
  24. local_flight_map-0.0.1/src/local_flight_map/ui/panel/config.py +82 -0
  25. local_flight_map-0.0.1/src/local_flight_map/ui/panel/data.py +122 -0
  26. local_flight_map-0.0.1/src/local_flight_map/ui/panel/interface.py +256 -0
  27. local_flight_map-0.0.1/src/local_flight_map/ui/panel/layers.py +121 -0
  28. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/civil_helicopter.png +0 -0
  29. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/civil_plane_1.png +0 -0
  30. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/civil_plane_2.png +0 -0
  31. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/civil_plane_3.png +0 -0
  32. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/clouds.png +0 -0
  33. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/forbidden.png +0 -0
  34. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/mil_plane_1.png +0 -0
  35. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/mil_plane_2.png +0 -0
  36. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/icons/police_helicopter.png +0 -0
  37. local_flight_map-0.0.1/src/local_flight_map/ui/panel/static/js/flight_marker_utils.js +78 -0
  38. local_flight_map-0.0.1/src/local_flight_map.egg-info/PKG-INFO +279 -0
  39. local_flight_map-0.0.1/src/local_flight_map.egg-info/SOURCES.txt +45 -0
  40. local_flight_map-0.0.1/src/local_flight_map.egg-info/dependency_links.txt +1 -0
  41. local_flight_map-0.0.1/src/local_flight_map.egg-info/entry_points.txt +2 -0
  42. local_flight_map-0.0.1/src/local_flight_map.egg-info/requires.txt +16 -0
  43. local_flight_map-0.0.1/src/local_flight_map.egg-info/top_level.txt +1 -0
  44. local_flight_map-0.0.1/tests/test_api_client_adsbexchange.py +384 -0
  45. local_flight_map-0.0.1/tests/test_api_client_base.py +153 -0
  46. local_flight_map-0.0.1/tests/test_api_client_hexdb.py +225 -0
  47. local_flight_map-0.0.1/tests/test_api_client_opensky.py +304 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Dawid Ciepiela
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,279 @@
1
+ Metadata-Version: 2.4
2
+ Name: local-flight-map
3
+ Version: 0.0.1
4
+ Summary: Open Air Traffic map based on ADS-B Exchange and Open Sky Data.
5
+ Author-email: Dawid Ciepiela <71898979+sarumaj@users.noreply.github.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3.12
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.12
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: aiohttp==3.11.18
14
+ Requires-Dist: asyncio==3.4.3
15
+ Requires-Dist: async-lru==2.0.5
16
+ Requires-Dist: bokeh-fastapi==0.1.4
17
+ Requires-Dist: fastapi==0.115.12
18
+ Requires-Dist: folium==0.19.6
19
+ Requires-Dist: itsdangerous==2.2.0
20
+ Requires-Dist: nest-asyncio==1.6.0
21
+ Requires-Dist: panel==1.7.0
22
+ Requires-Dist: pydantic==2.11.4
23
+ Requires-Dist: pydantic-settings==2.9.1
24
+ Requires-Dist: uvicorn==0.34.2
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest==8.0.0; extra == "test"
27
+ Requires-Dist: pytest-asyncio==0.23.5; extra == "test"
28
+ Dynamic: license-file
29
+
30
+ # Local Flight Map
31
+
32
+ A real-time air traffic visualization tool that combines data from ADS-B Exchange and OpenSky Network to provide a comprehensive view of aircraft movements in your local area.
33
+
34
+ ## Features
35
+
36
+ - Real-time aircraft tracking and visualization
37
+ - Interactive map interface using Folium
38
+ - Data integration from multiple sources:
39
+ - ADS-B Exchange API
40
+ - OpenSky Network API
41
+ - HexDB.io
42
+ - Fast and responsive web interface built with FastAPI
43
+ - Asynchronous data fetching for optimal performance
44
+ - Modern UI components using Panel and Bokeh
45
+
46
+ ## API Documentation
47
+
48
+ ### Data Sources
49
+
50
+ The application integrates data from multiple sources to provide comprehensive flight information:
51
+
52
+ #### OpenSky Network API
53
+ - **Authentication**: Username and password required for some endpoints
54
+ - **Endpoints**:
55
+ - `/api/states/all`: Get all aircraft states
56
+ - `/api/states/own`: Get aircraft states from own feeder
57
+ - `/api/tracks/all`: Get all flight tracks
58
+
59
+ #### ADS-B Exchange API
60
+ - **Authentication**: API key required
61
+ - **Endpoints**:
62
+ - `/v2/registration/{registration}`: Get aircraft by registration
63
+ - `/v2/icao/{icao24}`: Get aircraft by ICAO24 address
64
+ - `/v2/callsign/{callsign}`: Get aircraft by callsign
65
+ - `/v2/sqk/{squawk}`: Get aircraft by squawk code
66
+ - `/v2/mil`: Get military aircraft
67
+ - `/v2/lat/{lat}/lon/{lon}/dist/{radius}`: Get aircraft in area
68
+
69
+ #### HexDB API
70
+ - **Base URL**: https://hexdb.io/
71
+ - **Endpoints**:
72
+ - `/api/v1/aircraft/icao/{icao24}`: Get aircraft information
73
+ - `/api/v1/airport/icao/{icao24}`: Get airport information
74
+ - `/api/v1/route/icao/{callsign}`: Get route information
75
+
76
+ ### API Client Usage
77
+
78
+ ```python
79
+ from local_flight_map.api import ApiClient, ApiConfig, Location, BBox
80
+ from datetime import datetime
81
+
82
+ # Initialize the API client
83
+ config = ApiConfig(
84
+ ads_b_exchange_api_key="your_api_key",
85
+ opensky_username="your_username",
86
+ opensky_password="your_password"
87
+ )
88
+
89
+ async with ApiClient(config) as client:
90
+ # OpenSky Network API Examples
91
+ # Get all aircraft states
92
+ states = await client.get_states_from_opensky()
93
+
94
+ # Get states for specific aircraft
95
+ aircraft_states = await client.get_states_from_opensky(
96
+ icao24="icao24_code"
97
+ )
98
+
99
+ # Get states in a specific area
100
+ area_states = await client.get_states_from_opensky(
101
+ bbox=BBox(min_lat=40.0, max_lat=41.0, min_lon=-74.0, max_lon=-73.0)
102
+ )
103
+
104
+ # Get states from own feeder
105
+ own_states = await client.get_my_states_from_opensky(
106
+ serials=[1, 2, 3] # Optional: filter by sensor serial numbers
107
+ )
108
+
109
+ # Get flight track for specific aircraft
110
+ track = await client.get_track_by_aircraft_from_opensky(
111
+ icao24="icao24_code",
112
+ time_secs=datetime.now()
113
+ )
114
+
115
+ # ADS-B Exchange API Examples
116
+ # Get aircraft by registration
117
+ aircraft_by_reg = await client.get_aircraft_from_adsbexchange_by_registration(
118
+ registration="N12345"
119
+ )
120
+
121
+ # Get aircraft by ICAO24 address
122
+ aircraft_by_icao = await client.get_aircraft_from_adsbexchange_by_icao24(
123
+ icao24="icao24_code"
124
+ )
125
+
126
+ # Get aircraft by callsign
127
+ aircraft_by_callsign = await client.get_aircraft_from_adsbexchange_by_callsign(
128
+ callsign="ABC123"
129
+ )
130
+
131
+ # Get aircraft by squawk code
132
+ aircraft_by_squawk = await client.get_aircraft_from_adsbexchange_by_squawk(
133
+ squawk="7500"
134
+ )
135
+
136
+ # Get military aircraft
137
+ military_aircraft = await client.get_military_aircrafts_from_adsbexchange()
138
+
139
+ # Get aircraft within range
140
+ aircraft_in_range = await client.get_aircraft_from_adsbexchange_within_range(
141
+ center=Location(latitude=40.7128, longitude=-74.0060), # New York City
142
+ radius=50 # radius in nautical miles (92.6 km)
143
+ )
144
+
145
+ # HexDB API Examples
146
+ # Get aircraft information
147
+ aircraft_info = await client.get_aircraft_information_from_hexdb(
148
+ icao24="icao24_code"
149
+ )
150
+
151
+ # Get airport information
152
+ airport_info = await client.get_airport_information_from_hexdb(
153
+ icao24="KJFK" # ICAO airport code
154
+ )
155
+
156
+ # Get route information
157
+ route_info = await client.get_route_information_from_hexdb(
158
+ callsign="ABC123"
159
+ )
160
+ ```
161
+
162
+ ### Response Objects
163
+
164
+ #### OpenSky Network API
165
+ - `StateVector`: Contains aircraft position, speed, altitude, and other flight data
166
+ - Basic info: ICAO24, callsign, origin country
167
+ - Position: latitude, longitude, altitude (barometric and geometric)
168
+ - Performance: velocity, true track, vertical rate
169
+ - Status: on ground, squawk, special position indicator
170
+ - Source: position source (ADS-B, ASTERIX, MLAT, FLARM)
171
+ - Category: aircraft category (Light, Small, Large, Heavy, etc.)
172
+ - `States`: Collection of StateVector objects with timestamp
173
+ - `FlightTrack`: Contains flight path data with waypoints
174
+ - Basic info: ICAO24, callsign, start/end time
175
+ - Path: list of waypoints with position and altitude data
176
+ - `Waypoint`: Individual position point in a flight track
177
+ - Time: Unix timestamp
178
+ - Position: latitude, longitude
179
+ - Altitude: barometric altitude
180
+ - Track: true track angle
181
+ - Status: on ground flag
182
+
183
+ #### ADS-B Exchange API
184
+ - `AircraftProperties`: Detailed aircraft information including:
185
+ - Basic info: ICAO24, registration, type, callsign
186
+ - Position: latitude, longitude, altitude (barometric and geometric)
187
+ - Performance: ground speed, airspeed (indicated/true), Mach number
188
+ - Weather: wind direction/speed, outside air temperature
189
+ - Navigation: track angle, heading, rate of climb/descent
190
+ - System status: squawk, emergency status, category
191
+ - Technical: signal strength, GPS status, message count
192
+ - Navigation modes: QNH, MCP/FMS altitude, heading
193
+ - Integrity: navigation accuracy, surveillance level
194
+ - `AdsbExchangeResponse`: Container for aircraft data with:
195
+ - List of aircraft
196
+ - API message
197
+ - Timestamps
198
+ - Processing information
199
+
200
+ #### HexDB API
201
+ - `AircraftInformation`: Aircraft registration and type details
202
+ - Basic info: ICAO type code, manufacturer, Mode S code
203
+ - Registration: operator flag code, registered owners, registration number
204
+ - Type: aircraft type description
205
+ - `AirportInformation`: Airport location and identification
206
+ - Codes: IATA, ICAO, country code
207
+ - Location: latitude, longitude
208
+ - Details: airport name, region name
209
+ - `RouteInformation`: Flight route details
210
+ - Flight: flight number
211
+ - Route: route description
212
+ - Update time: timestamp of last update
213
+
214
+ All response objects support conversion to GeoJSON format for easy integration with mapping libraries.
215
+
216
+ ## Requirements
217
+
218
+ - Python 3.12 or higher
219
+ - Internet connection for API access
220
+ - Web browser for viewing the map interface
221
+
222
+ ## Installation
223
+
224
+ 1. Clone the repository:
225
+ ```bash
226
+ git clone https://github.com/sarumaj/local-flight-map.git
227
+ cd local-flight-map
228
+ ```
229
+
230
+ 2. Create and activate a virtual environment:
231
+ ```bash
232
+ python -m venv .venv
233
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
234
+ ```
235
+
236
+ 3. Install the package:
237
+ ```bash
238
+ pip install -e .
239
+ ```
240
+
241
+ ## Configuration
242
+
243
+ Create a `.env` file in the project root with your API credentials:
244
+ ```
245
+ ADS_B_EXCHANGE_API_KEY=your_api_key_here
246
+ OPENSKY_USERNAME=your_username_here
247
+ OPENSKY_PASSWORD=your_password_here
248
+ ```
249
+
250
+ ## Usage
251
+
252
+ 1. Start the application:
253
+ ```bash
254
+ local-flight-map
255
+ ```
256
+
257
+ 2. Open your web browser and navigate to `http://localhost:5006`
258
+
259
+ 3. The interactive map will display:
260
+ - Current aircraft positions
261
+ - Flight paths
262
+ - Aircraft information on hover
263
+ - Real-time updates
264
+
265
+ ## Development
266
+
267
+ To run tests:
268
+ ```bash
269
+ pip install -e ".[test]"
270
+ pytest
271
+ ```
272
+
273
+ ## License
274
+
275
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
276
+
277
+ ## Contributing
278
+
279
+ Contributions are welcome! Please feel free to submit a Pull Request.
@@ -0,0 +1,250 @@
1
+ # Local Flight Map
2
+
3
+ A real-time air traffic visualization tool that combines data from ADS-B Exchange and OpenSky Network to provide a comprehensive view of aircraft movements in your local area.
4
+
5
+ ## Features
6
+
7
+ - Real-time aircraft tracking and visualization
8
+ - Interactive map interface using Folium
9
+ - Data integration from multiple sources:
10
+ - ADS-B Exchange API
11
+ - OpenSky Network API
12
+ - HexDB.io
13
+ - Fast and responsive web interface built with FastAPI
14
+ - Asynchronous data fetching for optimal performance
15
+ - Modern UI components using Panel and Bokeh
16
+
17
+ ## API Documentation
18
+
19
+ ### Data Sources
20
+
21
+ The application integrates data from multiple sources to provide comprehensive flight information:
22
+
23
+ #### OpenSky Network API
24
+ - **Authentication**: Username and password required for some endpoints
25
+ - **Endpoints**:
26
+ - `/api/states/all`: Get all aircraft states
27
+ - `/api/states/own`: Get aircraft states from own feeder
28
+ - `/api/tracks/all`: Get all flight tracks
29
+
30
+ #### ADS-B Exchange API
31
+ - **Authentication**: API key required
32
+ - **Endpoints**:
33
+ - `/v2/registration/{registration}`: Get aircraft by registration
34
+ - `/v2/icao/{icao24}`: Get aircraft by ICAO24 address
35
+ - `/v2/callsign/{callsign}`: Get aircraft by callsign
36
+ - `/v2/sqk/{squawk}`: Get aircraft by squawk code
37
+ - `/v2/mil`: Get military aircraft
38
+ - `/v2/lat/{lat}/lon/{lon}/dist/{radius}`: Get aircraft in area
39
+
40
+ #### HexDB API
41
+ - **Base URL**: https://hexdb.io/
42
+ - **Endpoints**:
43
+ - `/api/v1/aircraft/icao/{icao24}`: Get aircraft information
44
+ - `/api/v1/airport/icao/{icao24}`: Get airport information
45
+ - `/api/v1/route/icao/{callsign}`: Get route information
46
+
47
+ ### API Client Usage
48
+
49
+ ```python
50
+ from local_flight_map.api import ApiClient, ApiConfig, Location, BBox
51
+ from datetime import datetime
52
+
53
+ # Initialize the API client
54
+ config = ApiConfig(
55
+ ads_b_exchange_api_key="your_api_key",
56
+ opensky_username="your_username",
57
+ opensky_password="your_password"
58
+ )
59
+
60
+ async with ApiClient(config) as client:
61
+ # OpenSky Network API Examples
62
+ # Get all aircraft states
63
+ states = await client.get_states_from_opensky()
64
+
65
+ # Get states for specific aircraft
66
+ aircraft_states = await client.get_states_from_opensky(
67
+ icao24="icao24_code"
68
+ )
69
+
70
+ # Get states in a specific area
71
+ area_states = await client.get_states_from_opensky(
72
+ bbox=BBox(min_lat=40.0, max_lat=41.0, min_lon=-74.0, max_lon=-73.0)
73
+ )
74
+
75
+ # Get states from own feeder
76
+ own_states = await client.get_my_states_from_opensky(
77
+ serials=[1, 2, 3] # Optional: filter by sensor serial numbers
78
+ )
79
+
80
+ # Get flight track for specific aircraft
81
+ track = await client.get_track_by_aircraft_from_opensky(
82
+ icao24="icao24_code",
83
+ time_secs=datetime.now()
84
+ )
85
+
86
+ # ADS-B Exchange API Examples
87
+ # Get aircraft by registration
88
+ aircraft_by_reg = await client.get_aircraft_from_adsbexchange_by_registration(
89
+ registration="N12345"
90
+ )
91
+
92
+ # Get aircraft by ICAO24 address
93
+ aircraft_by_icao = await client.get_aircraft_from_adsbexchange_by_icao24(
94
+ icao24="icao24_code"
95
+ )
96
+
97
+ # Get aircraft by callsign
98
+ aircraft_by_callsign = await client.get_aircraft_from_adsbexchange_by_callsign(
99
+ callsign="ABC123"
100
+ )
101
+
102
+ # Get aircraft by squawk code
103
+ aircraft_by_squawk = await client.get_aircraft_from_adsbexchange_by_squawk(
104
+ squawk="7500"
105
+ )
106
+
107
+ # Get military aircraft
108
+ military_aircraft = await client.get_military_aircrafts_from_adsbexchange()
109
+
110
+ # Get aircraft within range
111
+ aircraft_in_range = await client.get_aircraft_from_adsbexchange_within_range(
112
+ center=Location(latitude=40.7128, longitude=-74.0060), # New York City
113
+ radius=50 # radius in nautical miles (92.6 km)
114
+ )
115
+
116
+ # HexDB API Examples
117
+ # Get aircraft information
118
+ aircraft_info = await client.get_aircraft_information_from_hexdb(
119
+ icao24="icao24_code"
120
+ )
121
+
122
+ # Get airport information
123
+ airport_info = await client.get_airport_information_from_hexdb(
124
+ icao24="KJFK" # ICAO airport code
125
+ )
126
+
127
+ # Get route information
128
+ route_info = await client.get_route_information_from_hexdb(
129
+ callsign="ABC123"
130
+ )
131
+ ```
132
+
133
+ ### Response Objects
134
+
135
+ #### OpenSky Network API
136
+ - `StateVector`: Contains aircraft position, speed, altitude, and other flight data
137
+ - Basic info: ICAO24, callsign, origin country
138
+ - Position: latitude, longitude, altitude (barometric and geometric)
139
+ - Performance: velocity, true track, vertical rate
140
+ - Status: on ground, squawk, special position indicator
141
+ - Source: position source (ADS-B, ASTERIX, MLAT, FLARM)
142
+ - Category: aircraft category (Light, Small, Large, Heavy, etc.)
143
+ - `States`: Collection of StateVector objects with timestamp
144
+ - `FlightTrack`: Contains flight path data with waypoints
145
+ - Basic info: ICAO24, callsign, start/end time
146
+ - Path: list of waypoints with position and altitude data
147
+ - `Waypoint`: Individual position point in a flight track
148
+ - Time: Unix timestamp
149
+ - Position: latitude, longitude
150
+ - Altitude: barometric altitude
151
+ - Track: true track angle
152
+ - Status: on ground flag
153
+
154
+ #### ADS-B Exchange API
155
+ - `AircraftProperties`: Detailed aircraft information including:
156
+ - Basic info: ICAO24, registration, type, callsign
157
+ - Position: latitude, longitude, altitude (barometric and geometric)
158
+ - Performance: ground speed, airspeed (indicated/true), Mach number
159
+ - Weather: wind direction/speed, outside air temperature
160
+ - Navigation: track angle, heading, rate of climb/descent
161
+ - System status: squawk, emergency status, category
162
+ - Technical: signal strength, GPS status, message count
163
+ - Navigation modes: QNH, MCP/FMS altitude, heading
164
+ - Integrity: navigation accuracy, surveillance level
165
+ - `AdsbExchangeResponse`: Container for aircraft data with:
166
+ - List of aircraft
167
+ - API message
168
+ - Timestamps
169
+ - Processing information
170
+
171
+ #### HexDB API
172
+ - `AircraftInformation`: Aircraft registration and type details
173
+ - Basic info: ICAO type code, manufacturer, Mode S code
174
+ - Registration: operator flag code, registered owners, registration number
175
+ - Type: aircraft type description
176
+ - `AirportInformation`: Airport location and identification
177
+ - Codes: IATA, ICAO, country code
178
+ - Location: latitude, longitude
179
+ - Details: airport name, region name
180
+ - `RouteInformation`: Flight route details
181
+ - Flight: flight number
182
+ - Route: route description
183
+ - Update time: timestamp of last update
184
+
185
+ All response objects support conversion to GeoJSON format for easy integration with mapping libraries.
186
+
187
+ ## Requirements
188
+
189
+ - Python 3.12 or higher
190
+ - Internet connection for API access
191
+ - Web browser for viewing the map interface
192
+
193
+ ## Installation
194
+
195
+ 1. Clone the repository:
196
+ ```bash
197
+ git clone https://github.com/sarumaj/local-flight-map.git
198
+ cd local-flight-map
199
+ ```
200
+
201
+ 2. Create and activate a virtual environment:
202
+ ```bash
203
+ python -m venv .venv
204
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
205
+ ```
206
+
207
+ 3. Install the package:
208
+ ```bash
209
+ pip install -e .
210
+ ```
211
+
212
+ ## Configuration
213
+
214
+ Create a `.env` file in the project root with your API credentials:
215
+ ```
216
+ ADS_B_EXCHANGE_API_KEY=your_api_key_here
217
+ OPENSKY_USERNAME=your_username_here
218
+ OPENSKY_PASSWORD=your_password_here
219
+ ```
220
+
221
+ ## Usage
222
+
223
+ 1. Start the application:
224
+ ```bash
225
+ local-flight-map
226
+ ```
227
+
228
+ 2. Open your web browser and navigate to `http://localhost:5006`
229
+
230
+ 3. The interactive map will display:
231
+ - Current aircraft positions
232
+ - Flight paths
233
+ - Aircraft information on hover
234
+ - Real-time updates
235
+
236
+ ## Development
237
+
238
+ To run tests:
239
+ ```bash
240
+ pip install -e ".[test]"
241
+ pytest
242
+ ```
243
+
244
+ ## License
245
+
246
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
247
+
248
+ ## Contributing
249
+
250
+ Contributions are welcome! Please feel free to submit a Pull Request.
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "local-flight-map"
7
+ version = "0.0.1"
8
+ description = "Open Air Traffic map based on ADS-B Exchange and Open Sky Data."
9
+ requires-python = ">=3.12"
10
+ authors = [
11
+ { name="Dawid Ciepiela", email="71898979+sarumaj@users.noreply.github.com" }
12
+ ]
13
+ readme = "README.md"
14
+ license = { text = "MIT" }
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3.12",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent"
19
+ ]
20
+ dependencies = [
21
+ "aiohttp==3.11.18",
22
+ "asyncio==3.4.3",
23
+ "async-lru==2.0.5",
24
+ "bokeh-fastapi==0.1.4",
25
+ "fastapi==0.115.12",
26
+ "folium==0.19.6",
27
+ "itsdangerous==2.2.0",
28
+ "nest-asyncio==1.6.0",
29
+ "panel==1.7.0",
30
+ "pydantic==2.11.4",
31
+ "pydantic-settings==2.9.1",
32
+ "uvicorn==0.34.2"
33
+ ]
34
+
35
+ [project.scripts]
36
+ local-flight-map = "local_flight_map.__main__:main"
37
+
38
+ [project.optional-dependencies]
39
+ test = [
40
+ "pytest==8.0.0",
41
+ "pytest-asyncio==0.23.5"
42
+ ]
43
+
44
+ [tool.setuptools.packages.find]
45
+ where = ["src"]
46
+ exclude = ["tests*"]
47
+
48
+ [tool.setuptools.package-data]
49
+ "local_flight_map.ui.panel" = [
50
+ "static/*",
51
+ "static/**/*"
52
+ ]
53
+ "local_flight_map.ui.folium" = [
54
+ "js/*"
55
+ ]
56
+
57
+ [tool.pytest.ini_options]
58
+ pythonpath = ["src"]
59
+ testpaths = ["tests"]
60
+ addopts = [
61
+ "-v",
62
+ "--asyncio-mode=auto"
63
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,25 @@
1
+ import asyncio
2
+
3
+ from .api import ApiClient, ApiConfig
4
+ from .ui import MapInterface, MapConfig
5
+
6
+
7
+ async def amain():
8
+ api_config = ApiConfig()
9
+ map_config = MapConfig()
10
+ async with (
11
+ ApiClient(api_config) as client,
12
+ MapInterface(
13
+ config=map_config,
14
+ client=client
15
+ ) as map_interface
16
+ ):
17
+ await map_interface.serve()
18
+
19
+
20
+ def main():
21
+ asyncio.run(amain())
22
+
23
+
24
+ if __name__ == "__main__":
25
+ main()
@@ -0,0 +1,41 @@
1
+ from typing import Optional
2
+
3
+ from .opensky import OpenSkyClient, OpenSkyConfig
4
+ from .hexdb import HexDbClient, HexDbConfig
5
+ from .adsbexchange import AdsbExchangeClient, AdsbExchangeConfig
6
+ from .base import BBox, Location
7
+
8
+
9
+ class ApiConfig(OpenSkyConfig, HexDbConfig, AdsbExchangeConfig):
10
+ pass
11
+
12
+
13
+ class ApiClient(OpenSkyClient, HexDbClient, AdsbExchangeClient):
14
+ def __init__(self, config: Optional[ApiConfig] = None):
15
+ config = config or ApiConfig()
16
+ OpenSkyClient.__init__(self, config)
17
+ HexDbClient.__init__(self, config)
18
+ AdsbExchangeClient.__init__(self, config)
19
+
20
+ async def __aenter__(self):
21
+ """Enter the async context manager"""
22
+ await OpenSkyClient.__aenter__(self)
23
+ await HexDbClient.__aenter__(self)
24
+ await AdsbExchangeClient.__aenter__(self)
25
+ return self
26
+
27
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
28
+ """Exit the async context manager"""
29
+ await OpenSkyClient.__aexit__(self, exc_type, exc_val, exc_tb)
30
+ await HexDbClient.__aexit__(self, exc_type, exc_val, exc_tb)
31
+ await AdsbExchangeClient.__aexit__(self, exc_type, exc_val, exc_tb)
32
+
33
+
34
+ __all__ = [
35
+ k for k, v in globals().items() if v in (
36
+ ApiConfig,
37
+ ApiClient,
38
+ BBox,
39
+ Location
40
+ )
41
+ ]