forked from lancard/korea-flight-database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathetc.js
62 lines (56 loc) · 2.08 KB
/
etc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const fs = require('fs');
const util = require('./util.js');
module.exports = {
initialize() {
if (!fs.existsSync('etc')) {
fs.mkdirSync('etc');
}
},
getNuetrainerData() {
var ret = {
FixList: {},
RunwayList: {}
};
navaidList.forEach(e => {
ret.FixList[e.name] = {
latitude: e.latitudeDecimal,
longitude: e.longitudeDecimal
};
});
runwayList.filter(e => (e.airport.indexOf("RK") == 0 || e.airport.indexOf("ZK") == 0)).forEach(obj => {
if(!airportList[obj.airport])
return;
ret.RunwayList[`${obj.airport}_${obj.runway}`] = {
ThresholdSideCoordinate: {
latitude: obj.startLatitudeDecimal,
longitude: obj.startLongitudeDecimal
},
LocalizerSideCoordinate: {
latitude: obj.endLatitudeDecimal,
longitude: obj.endLongitudeDecimal
},
Elevation: airportList[obj.airport].elevationInFeet,
GlideslopeAngle: 3.0,
MagneticVariation: 7
};
ret.RunwayList[`${obj.airport}_${obj.oppositeRunway}`] = {
ThresholdSideCoordinate: {
latitude: obj.endLatitudeDecimal,
longitude: obj.endLongitudeDecimal
},
LocalizerSideCoordinate: {
latitude: obj.startLatitudeDecimal,
longitude: obj.startLongitudeDecimal
},
Elevation: airportList[obj.airport].elevationInFeet,
GlideslopeAngle: 3.0,
MagneticVariation: 7
};
});
return ret;
},
generateNuetrainerFile() {
var nuetrainer_data = this.getNuetrainerData();
fs.writeFileSync('etc/nuetrainer_sector.json', JSON.stringify(nuetrainer_data, null, '\t'));
}
};