@fboes/aerofly-data 1.5.3 → 1.6.1

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/get-airports.js CHANGED
@@ -40,6 +40,7 @@ let airportsRecordsProcessed = 0;
40
40
 
41
41
  // Collect all ICAO codes
42
42
  const icaoCodes = [];
43
+ const icaoCoordinatesObject = [];
43
44
 
44
45
  for (const airportsRecord of airportsRecords) {
45
46
  // 3685,"KMIA","large_airport","Miami International Airport",25.79319953918457,-80.29060363769531,8,"NA","US","US-FL","Miami","yes","KMIA","MIA","MIA","http://www.miami-airport.com/","https://en.wikipedia.org/wiki/
@@ -73,8 +74,6 @@ for (const airportsRecord of airportsRecords) {
73
74
 
74
75
  if (length !== undefined && aeroflyCode !== undefined) {
75
76
  const bestCode = icaoCode || aeroflyCode || ident;
76
- // Add the ICAO code to the list
77
- icaoCodes.push(bestCode);
78
77
 
79
78
  // Remove airport from list of Aerofly FS4 Airports
80
79
  aeroflyAirports.delete(aeroflyCode);
@@ -92,6 +91,17 @@ for (const airportsRecord of airportsRecords) {
92
91
  type = type.replace(/port/, "base");
93
92
  }
94
93
 
94
+ // Filter community airports and add regular airports to secondary lists
95
+ if (length > 0) {
96
+ icaoCodes.push(bestCode);
97
+ icaoCoordinatesObject.push({
98
+ code: bestCode,
99
+ name: airportsRecord[3],
100
+ lat: airportsRecord[4],
101
+ lon: airportsRecord[5],
102
+ });
103
+ }
104
+
95
105
  const feature = new GeoJSON.Feature(
96
106
  new GeoJSON.Point(Number(airportsRecord[5]), Number(airportsRecord[4]), Number(airportsRecord[6]) * 0.3048),
97
107
  {
@@ -138,19 +148,19 @@ const icaoListFilePath = path.join(outputDirectory, "airport-list.json");
138
148
  fs.writeFileSync(icaoListFilePath, JSON.stringify(icaoCodes.sort(), null, 2) + "\n", "utf-8");
139
149
  process.stdout.write(`ICAO code list written to \x1b[92m${icaoListFilePath}\x1b[0m\n`);
140
150
 
141
- // Write the ICAO codes with aiport names and geocoordinates to airport-coordinates.json
142
- const icaoCoordinates = aeroflyGeoJson.features.map((feature) => {
143
- return [
144
- feature.properties.title,
145
- feature.properties.description,
146
- feature.geometry.coordinates[1],
147
- feature.geometry.coordinates[0],
148
- ];
151
+ // Write the ICAO codes with airport names and geocoordinates to airport-coordinates.json
152
+ const icaoCoordinates = icaoCoordinatesObject.map((feature) => {
153
+ return [feature.code, feature.name, feature.lat, feature.lon];
149
154
  });
150
155
  const icaoCoordinatesFilePath = path.join(outputDirectory, "airport-coordinates.json");
151
156
  fs.writeFileSync(icaoCoordinatesFilePath, JSON.stringify(icaoCoordinates, null, 2) + "\n", "utf-8");
152
157
  process.stdout.write(`ICAO coordinates list written to \x1b[92m${icaoCoordinatesFilePath}\x1b[0m\n`);
153
158
 
159
+ // Write the ICAO codes with airport names and geocoordinates to airport-coordinates-object.json
160
+ const icaoCoordinatesObjectFilePath = path.join(outputDirectory, "airport-coordinates-object.json");
161
+ fs.writeFileSync(icaoCoordinatesObjectFilePath, JSON.stringify(icaoCoordinatesObject, null, 2) + "\n", "utf-8");
162
+ process.stdout.write(`ICAO coordinates objrct list written to \x1b[92m${icaoCoordinatesObjectFilePath}\x1b[0m\n`);
163
+
154
164
  // Write the missing codes to airports-unmatched.md
155
165
  const unmatchedFilePath = path.join(outputDirectory, "airports-unmatched.md");
156
166
  const unmatchedCodes = [...aeroflyAirports]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fboes/aerofly-data",
3
- "version": "1.5.3",
3
+ "version": "1.6.1",
4
4
  "description": "This project contains data sets for airports and aircraft present in Aerofly FS 4.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,6 +26,10 @@
26
26
  "default": "./data/airport-coordinates.json",
27
27
  "types": "./data/airport-coordinates.json.d.ts"
28
28
  },
29
+ "./data/airport-coordinates-object.json": {
30
+ "default": "./data/airport-coordinates-object.json",
31
+ "types": "./data/airport-coordinates-object.json.d.ts"
32
+ },
29
33
  "./data/airport-list.json": {
30
34
  "default": "./data/airport-list.json",
31
35
  "types": "./data/airport-list.json.d.ts"