Skip to content

Commit

Permalink
feat: include timezone identifiers rather than UTC offsets in airport…
Browse files Browse the repository at this point in the history
… data
  • Loading branch information
johanohly committed Oct 21, 2024
1 parent 1d9bbed commit c0c7016
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 54 deletions.
7 changes: 6 additions & 1 deletion scripts/other/update-airports-data.cjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
var fs = require('fs');
const { find } = require('geo-tz');

const IGNORED_FIELDS = [
'LOCAL',
'type',
'restriction',
'alt',
'timezone',
'gmt_offset',
'region',
'municipality',
'activation',
Expand Down Expand Up @@ -36,7 +38,7 @@ const IGNORED_FIELDS = [
if (IGNORED_FIELDS.includes(headers[i])) {
return;
}
const header = headers[i] === 'gmt_offset' ? 'tz' : headers[i];
const header = headers[i];

let cell = cell_ === '' || cell_ === 'NULL' ? null : cell_;
if (!isNaN(+cell) && cell !== null) {
Expand All @@ -49,6 +51,9 @@ const IGNORED_FIELDS = [
airport[header] = cell;
}
});

const timezoneId = find(airport.lat, airport.lon)[0];
airport['tz'] = timezoneId;
return airport;
})
.filter((airport) => airport.tier > 3 && airport.ICAO.length === 4);
Expand Down
52 changes: 0 additions & 52 deletions scripts/other/update-iata-airports-data.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/data/airports.ts

Large diffs are not rendered by default.

0 comments on commit c0c7016

Please sign in to comment.