-
Notifications
You must be signed in to change notification settings - Fork 2
/
aerodrome.js
53 lines (48 loc) · 1.48 KB
/
aerodrome.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
import { getOSMAerodromeData, getOSMParkingPositionData } from './client.js';
import { point, featureCollection } from '@turf/helpers';
import booleanPointInPolygon from '@turf/boolean-point-in-polygon';
import bunyan from 'bunyan';
import config from 'config';
var log = bunyan.createLogger({name: config.get('app.name'), level: config.get('app.log_level')});
export async function getAerodromes(){
try{
var data = await getOSMAerodromeData(config.get('data.osm.aerodromesArea'));
if(data){
if(data.type === "FeatureCollection"){
return data;
}else{
return false;
}
};
}catch(err){
log.error(err)
return false;
}
}
export async function getMajorAerodromes(){
const config = config.get('map.majorAerodromes')
var aerodromes = getAerodromes();
var majorAerodromes = [];
aerodromes.forEach(function(element){
config.forEach(function(majorIcao){
if(element.properties.tags.icao==majorIcao){
majorAerodromes.push(element);
}
});
});
}
export async function getAerodromeBays(){
try{
var data = await getOSMParkingPositionData(config.get('data.osm.aerodromesArea'));
if(data){
if(data.type === "FeatureCollection"){
return data;
}else{
return false;
}
};
}catch(err){
log.error(err)
return false;
}
}