airport-data-js 1.0.0
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.
- package/INSTRUCTIONS_NODE.md +78 -0
- package/INSTRUCTIONS_REACT.md +2 -0
- package/LICENSE +21 -0
- package/README.md +169 -0
- package/data/airports.json +1 -0
- package/dist/219.airports.bundle.js +1 -0
- package/dist/23.airports.bundle.js +1 -0
- package/dist/284.airports.bundle.js +1 -0
- package/dist/30.airports.bundle.js +1 -0
- package/dist/346.airports.bundle.js +1 -0
- package/dist/372.airports.bundle.js +1 -0
- package/dist/402.airports.bundle.js +1 -0
- package/dist/418.airports.bundle.js +1 -0
- package/dist/503.airports.bundle.js +1 -0
- package/dist/528.airports.bundle.js +1 -0
- package/dist/530.airports.bundle.js +1 -0
- package/dist/602.airports.bundle.js +1 -0
- package/dist/64.airports.bundle.js +1 -0
- package/dist/66.airports.bundle.js +1 -0
- package/dist/693.airports.bundle.js +1 -0
- package/dist/697.airports.bundle.js +1 -0
- package/dist/893.airports.bundle.js +1 -0
- package/dist/934.airports.bundle.js +1 -0
- package/dist/airports.bundle.js +2 -0
- package/dist/airports.bundle.js.LICENSE.txt +1 -0
- package/dist/airports_chunk_0.bin +0 -0
- package/dist/airports_chunk_1.bin +0 -0
- package/dist/airports_chunk_10.bin +0 -0
- package/dist/airports_chunk_11.bin +0 -0
- package/dist/airports_chunk_12.bin +0 -0
- package/dist/airports_chunk_13.bin +0 -0
- package/dist/airports_chunk_14.bin +0 -0
- package/dist/airports_chunk_15.bin +0 -0
- package/dist/airports_chunk_16.bin +0 -0
- package/dist/airports_chunk_17.bin +0 -0
- package/dist/airports_chunk_2.bin +0 -0
- package/dist/airports_chunk_3.bin +0 -0
- package/dist/airports_chunk_4.bin +0 -0
- package/dist/airports_chunk_5.bin +0 -0
- package/dist/airports_chunk_6.bin +0 -0
- package/dist/airports_chunk_7.bin +0 -0
- package/dist/airports_chunk_8.bin +0 -0
- package/dist/airports_chunk_9.bin +0 -0
- package/package.json +53 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Airports - Node.js Usage Instructions
|
|
2
|
+
|
|
3
|
+
This document provides step-by-step instructions on how to use the `airport-data-js` library in a Node.js environment.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Setting Up](#setting-up)
|
|
8
|
+
2. [Integrating the Library](#integrating-the-library)
|
|
9
|
+
3. [Fetching Data](#fetching-data)
|
|
10
|
+
4. [Error Handling](#error-handling)
|
|
11
|
+
5. [Additional Notes](#additional-notes)
|
|
12
|
+
|
|
13
|
+
## Setting Up
|
|
14
|
+
|
|
15
|
+
1. **Initialize a new Node.js project (if you haven't already):**
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm init -y
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. **Install the `airport-data-js` library:**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install airport-data-js
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Integrating the Library
|
|
28
|
+
|
|
29
|
+
1. **Import the library in your Node.js script:**
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
const airports = require('airport-data-js');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Fetching Data
|
|
36
|
+
|
|
37
|
+
Use the available methods to fetch airport data:
|
|
38
|
+
|
|
39
|
+
1. **By IATA Code:**
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
const dataByIata = await airports.getAirportByIata('MAA');
|
|
43
|
+
console.log(dataByIata);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
2. **By ICAO Code:**
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
const dataByIcao = await airports.getAirportByIcao('VOMM');
|
|
50
|
+
console.log(dataByIcao);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
3. **By City Code:**
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
const dataByCity = await airports.getAirportByCityCode('NYC');
|
|
57
|
+
console.log(dataByCity);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
... and so on for other methods.
|
|
61
|
+
|
|
62
|
+
## Error Handling
|
|
63
|
+
|
|
64
|
+
Each method returns a promise. Handle errors using `try/catch`:
|
|
65
|
+
|
|
66
|
+
```javascript
|
|
67
|
+
try {
|
|
68
|
+
const data = await airports.getAirportByIata('AAA');
|
|
69
|
+
console.log(data);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error('Failed to fetch data:', error.message);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Additional Notes
|
|
76
|
+
|
|
77
|
+
- The library fetches data based on the provided codes. Ensure the codes are valid and in the expected format.
|
|
78
|
+
- For any issues or further documentation, refer to the main [README.md](./README.md).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Creative Commons Attribution 4.0 International (CC BY 4.0)
|
|
2
|
+
|
|
3
|
+
You are free to:
|
|
4
|
+
|
|
5
|
+
Share — copy and redistribute the material in any medium or format
|
|
6
|
+
Adapt — remix, transform, and build upon the material
|
|
7
|
+
for any purpose, even commercially.
|
|
8
|
+
|
|
9
|
+
The licensor cannot revoke these freedoms as long as you follow the license terms.
|
|
10
|
+
|
|
11
|
+
Under the following terms:
|
|
12
|
+
|
|
13
|
+
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
|
|
14
|
+
|
|
15
|
+
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
|
|
16
|
+
|
|
17
|
+
Notices:
|
|
18
|
+
|
|
19
|
+
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
|
|
20
|
+
|
|
21
|
+
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
|
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# airport-data-js
|
|
2
|
+
|
|
3
|
+
A comprehensive library providing easy retrieval of airport data based on IATA, ICAO, city codes, country codes, and continents. Ideal for developers building applications related to aviation, travel, and geography.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Retrieve airport data using IATA code.
|
|
8
|
+
- Retrieve airport data using ICAO code.
|
|
9
|
+
- Fetch data using city codes.
|
|
10
|
+
- Fetch data using country codes.
|
|
11
|
+
- Retrieve data based on continents.
|
|
12
|
+
- Built-in error handling for invalid input formats.
|
|
13
|
+
- Efficiently packaged with minimized and gzipped data.
|
|
14
|
+
- **Comprehensive Data Access**: Retrieve airport data using IATA code, ICAO code, city codes, country codes, and continents.
|
|
15
|
+
- **Unique Link Integration**: The first library to provide direct links to [FlightRadar24](https://www.flightradar24.com/), [Radarbox](https://www.radarbox.com/), and [FlightAware](https://www.flightaware.com/) for each airport, giving users immediate access to live flight tracking and airport data.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
You can install `airport-data-js` using npm:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install airport-data-js
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For detailed instructions on how to use this library in different environments, please refer to the following links:
|
|
26
|
+
|
|
27
|
+
- [Node.js Instructions](./INSTRUCTIONS_NODE.md)
|
|
28
|
+
- [React Instructions](./INSTRUCTIONS_REACT.md) *(Coming Soon)*
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Here's how you can use the library:
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
const airportData = require('airport-data-js');
|
|
36
|
+
|
|
37
|
+
// Retrieve airport data using IATA code
|
|
38
|
+
const airportByIATA = airportData.getAirportByIata("AAA");
|
|
39
|
+
console.log(airportByIATA);
|
|
40
|
+
|
|
41
|
+
// Retrieve airport data using ICAO code
|
|
42
|
+
const airportByICAO = airportData.getAirportByIcao("NTGA");
|
|
43
|
+
console.log(airportByICAO);
|
|
44
|
+
|
|
45
|
+
// Fetch data using city codes
|
|
46
|
+
const airportByCityCode = airportData.getAirportByCityCode("NYC");
|
|
47
|
+
console.log(airportByCityCode);
|
|
48
|
+
|
|
49
|
+
// Fetch data using country codes
|
|
50
|
+
const airportByCountryCode = airportData.getAirportByCountryCode("US");
|
|
51
|
+
console.log(airportByCountryCode);
|
|
52
|
+
|
|
53
|
+
// Retrieve data based on continents
|
|
54
|
+
const airportByContinent = airportData.getAirportByContinent("AS");
|
|
55
|
+
console.log(airportByContinent);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Example Data Fields
|
|
59
|
+
|
|
60
|
+
For Chennai International Airport:
|
|
61
|
+
|
|
62
|
+
| Field Name | Data |
|
|
63
|
+
|----------------------|----------------------------------------------------------|
|
|
64
|
+
| IATA | MAA |
|
|
65
|
+
| ICAO | VOMM |
|
|
66
|
+
| Time Zone | Asia/Kolkata |
|
|
67
|
+
| City Code | MAA |
|
|
68
|
+
| Country Code | IN |
|
|
69
|
+
| Name | Chennai International Airport |
|
|
70
|
+
| Latitude | 12.99 |
|
|
71
|
+
| Longitude | 80.1693 |
|
|
72
|
+
| Altitude (in feet) | 52 |
|
|
73
|
+
| State | Tamil Nadu |
|
|
74
|
+
| City | Pallavaram |
|
|
75
|
+
| County | Kancheepuram |
|
|
76
|
+
| State Code | Tamil Nadu |
|
|
77
|
+
| Airport Type | large_airport |
|
|
78
|
+
| Continent | AS |
|
|
79
|
+
| State Abbreviation | IN-TN |
|
|
80
|
+
| International | TRUE |
|
|
81
|
+
| Wikipedia Link | [Wikipedia](https://en.wikipedia.org/wiki/Chennai_International_Airport)|
|
|
82
|
+
| Official Website | [Chennai Airport](http://chennaiairport.com) |
|
|
83
|
+
| Location ID | 12513629 |
|
|
84
|
+
| Phone Number | 044-2340551 |
|
|
85
|
+
| Runway Length (in meters) | 10050 |
|
|
86
|
+
| Flightradar24 | [Flightradar24](https://www.flightradar24.com/airport/MAA)|
|
|
87
|
+
| Radarbox | [Radarbox](https://www.radarbox.com/airport/VOMM) |
|
|
88
|
+
| Flightaware Link | [Flightaware](https://www.flightaware.com/live/airport/VOMM)|
|
|
89
|
+
|
|
90
|
+
### Singapore Changi Airport:
|
|
91
|
+
|
|
92
|
+
| Field Name | Data |
|
|
93
|
+
|----------------------|----------------------------------------------------------|
|
|
94
|
+
| IATA | SIN |
|
|
95
|
+
| ICAO | WSSS |
|
|
96
|
+
| Time Zone | Asia/Singapore |
|
|
97
|
+
| City Code | SIN |
|
|
98
|
+
| Country Code | SG |
|
|
99
|
+
| Name | Singapore Changi Airport |
|
|
100
|
+
| Latitude | 1.35019 |
|
|
101
|
+
| Longitude | 103.994 |
|
|
102
|
+
| Altitude (in feet) | 22 |
|
|
103
|
+
| State | Singapore |
|
|
104
|
+
| City | Singapore |
|
|
105
|
+
| County | Singapore |
|
|
106
|
+
| State Code | South East |
|
|
107
|
+
| Airport Type | large_airport |
|
|
108
|
+
| Continent | AS |
|
|
109
|
+
| State Abbreviation | SG-04 |
|
|
110
|
+
| International | TRUE |
|
|
111
|
+
| Wikipedia Link | [Wikipedia](https://en.wikipedia.org/wiki/Singapore_Changi_Airport)|
|
|
112
|
+
| Official Website | [Changi Airport](http://www.changiairport.com/) |
|
|
113
|
+
| Location ID | 12517525 |
|
|
114
|
+
| Phone Number | (65) 6542 1122 |
|
|
115
|
+
| Runway Length (in meters) | 13200 |
|
|
116
|
+
| Flightradar24 | [Flightradar24](https://www.flightradar24.com/airport/SIN)|
|
|
117
|
+
| Radarbox | [Radarbox](https://www.radarbox.com/airport/WSSS) |
|
|
118
|
+
| Flightaware | [Flightaware](https://www.flightaware.com/live/airport/WSSS)|
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## Running the Project Locally
|
|
122
|
+
|
|
123
|
+
1. Clone the repository:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
git clone https://github.com/aashishvanand/airport-data-js.git
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
2. Change into the cloned directory:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
cd airport-data-js
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
3. Install the necessary dependencies:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
npm install
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
4. To bundle the source code using Webpack:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npm run build
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
5. To run tests:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
npm test
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Troubleshooting
|
|
154
|
+
|
|
155
|
+
1. **Issue**: "Module not found: Error: Can't resolve 'babel-loader'".
|
|
156
|
+
**Solution**: Ensure that you have installed all the necessary dependencies. If the issue persists, reinstall the library.
|
|
157
|
+
|
|
158
|
+
2. **Issue**: "Error: Automatic publicPath is not supported in this browser".
|
|
159
|
+
**Solution**: Ensure that you're using the library in a supported environment (Node.js or a modern browser).
|
|
160
|
+
|
|
161
|
+
If you encounter other issues, consider raising an issue on the [GitHub repository](https://github.com/your-repo-link).
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
This project is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0) - see the [LICENSE](LICENSE) file for details.
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/aashishvanand/airport-data-js/issues).
|