trackberry-airports 0.2.0 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/LICENSE.txt +6 -0
- data/README.md +41 -8
- data/data/airports.csv +9053 -9053
- data/lib/trackberry/airports/builder.rb +125 -17
- data/lib/trackberry/airports/diff.rb +64 -6
- data/lib/trackberry/airports/short_name.rb +48 -0
- data/lib/trackberry/airports/timezones.rb +173 -0
- data/lib/trackberry/airports/version.rb +1 -1
- data/lib/trackberry/airports.rb +41 -4
- metadata +10 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c0adb1a8d8728f17513398872ffa35ebe4c2b5cff90365094bbdb52e50ac1d30
|
|
4
|
+
data.tar.gz: dd94334c6151407ccc72549d84f4588c5b9c47b05766dd39dd497e6daed6a9f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 728f96a4b451ef2c3e1be5b1a81a9c262f490739e0d24116559fa452cf4ebbba6a50c4682ff8b6bfa6f763b11272f447ac63dab3f0ccf7510fcdb83e9b3b3a68
|
|
7
|
+
data.tar.gz: c14f5c1db396cad61e5ec7b3199df9f8e84c9605b165dda237cb4d66a73a2c368198240b4c9358fdaa1b62a901a27f1597a669b603ff3ee3382c14e64123058d
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Data refreshes are minor versions, opened as pull requests by the monthly refresh workflow. Code changes are written here by hand.
|
|
4
4
|
|
|
5
|
+
## 0.4.0 — 2026-11-24
|
|
6
|
+
|
|
7
|
+
Added `Trackberry::Airports.timezone(iata)` and `Airport#timezone`: the IANA zone each airport keeps time in, such as "Europe/Madrid", built into new `timezone` and `timezone_source` columns of the table. Every airport has one: 9,048 from timezone-boundary-builder's map (release 2026f) checked against tzdata's zones for the airport's country, and four reviewed overrides in `data/sources/timezone_overrides.csv`. Xinjiang's airports get Beijing time, which aviation keeps there. The table is now also under OpenStreetMap's ODbL. `Airport` has a new member, `timezone`, which defaults to nil, so code that builds one without it still works. No other method or field changed, and the airport data is the same as in 0.3.0.
|
|
8
|
+
|
|
9
|
+
Requires Ruby 3.3 or newer. Ruby 3.2 reached end of life on 2026-03-31 and is no longer tested.
|
|
10
|
+
|
|
11
|
+
## 0.3.0 — 2026-11-08
|
|
12
|
+
|
|
13
|
+
Added `Trackberry::Airports.short_name(iata)`: a compact label such as "London Heathrow" or "Lima Jorge Chávez", built into a new `short_name` column of the table, with nine reviewed overrides in `data/sources/short_name_overrides.csv`. No existing method or `Airport` field changed.
|
|
14
|
+
|
|
5
15
|
## 0.2.0 — 2026-11-03
|
|
6
16
|
|
|
7
17
|
OurAirports as of 2026-11-03. 9052 airports (9051 before): 2 added, 1 removed, 3 renamed, 0 with a new city, 7 repositioned, 0 with a new subdivision (0 moved to another principal one).
|
data/LICENSE.txt
CHANGED
|
@@ -32,6 +32,12 @@ contents of the database are licensed under the Database Contents License:
|
|
|
32
32
|
https://opendatacommons.org/licenses/dbcl/1-0/. Both files are made available
|
|
33
33
|
under the same terms.
|
|
34
34
|
|
|
35
|
+
data/airports.csv also contains information from timezone-boundary-builder
|
|
36
|
+
(https://github.com/evansiroky/timezone-boundary-builder), built from
|
|
37
|
+
OpenStreetMap data, © OpenStreetMap contributors
|
|
38
|
+
(https://www.openstreetmap.org/copyright), which is made available under the
|
|
39
|
+
ODbL 1.0 too.
|
|
40
|
+
|
|
35
41
|
The rest of the table comes from public-domain sources: OurAirports
|
|
36
42
|
(https://ourairports.com/data/) for the airports, and Natural Earth
|
|
37
43
|
(https://www.naturalearthdata.com) for the states-and-provinces map that
|
data/README.md
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# trackberry-airports
|
|
2
2
|
|
|
3
|
-
Every airport with an IATA code (about 9,000), with its name, city, position
|
|
3
|
+
Every airport with an IATA code (about 9,000), with its name, city, position, ISO 3166-2 subdivision and IANA time zone, as a table shipped inside the gem. No network calls.
|
|
4
4
|
|
|
5
5
|
```ruby
|
|
6
6
|
require "trackberry/airports"
|
|
7
7
|
|
|
8
8
|
Trackberry::Airports.find("FRA") # => #<data Trackberry::Airports::Airport iata="FRA", icao="EDDF", ...>
|
|
9
9
|
Trackberry::Airports.city("FRA") # => "Frankfurt"
|
|
10
|
+
Trackberry::Airports.short_name("LIM") # => "Lima Jorge Chávez"
|
|
10
11
|
Trackberry::Airports.country("FRA") # => "DE"
|
|
11
12
|
Trackberry::Airports.coordinates("FRA") # => { "lat" => 50.0267, "lng" => 8.5584 }
|
|
12
13
|
Trackberry::Airports.subdivision_path("SXB") # => ["FR-67", "FR-6AE", "FR-GES"]
|
|
14
|
+
Trackberry::Airports.timezone("MAD") # => "Europe/Madrid"
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
An unknown code answers `nil` (or `[]` for a path): carriers send city codes ("LON") and codes of airports that have closed, and that is ordinary, not an error.
|
|
@@ -21,8 +23,7 @@ An unknown code answers `nil` (or `[]` for a path): carriers send city codes ("L
|
|
|
21
23
|
- **Fresh data.** `airports` is built from OpenFlights, which stopped updating in 2019, and adds the airports opened since by hand (`BER`, `HYD`). This one is built from OurAirports, which is still maintained, and rebuilt every month behind checks that stop a bad download from shipping.
|
|
22
24
|
- **Where the airport is, inside its country.** `airports` gives the country as a name ("United Kingdom"). This one gives the ISO 3166-2 country code and subdivision path, which is what a regional holiday calendar or a customs rule keys on.
|
|
23
25
|
- **Numbers as numbers.** Coordinates are floats, not strings.
|
|
24
|
-
|
|
25
|
-
`airports` has time zones; this one does not. If that is all you need, use it.
|
|
26
|
+
- **Time zones from the map, not a 2019 list.** `airports` takes OpenFlights' zone names, which often stand in a neighbouring zone for the airport's own: Anchorage for Nome, Mexico City for Matamoros, Santiago for Punta Arenas. Those agree for a while and part ways at the next daylight saving rule change, and for about fifty airports they already have. See [Time zones](#time-zones).
|
|
26
27
|
|
|
27
28
|
## Subdivisions
|
|
28
29
|
|
|
@@ -49,6 +50,29 @@ The map is used two ways:
|
|
|
49
50
|
|
|
50
51
|
Every code is checked against ISO 3166-2 when the table is built. The ISO hierarchy and the map lookup are seaports' `Seaports::Subdivisions` and `Seaports::Boundaries`, used by the build only: the gem itself depends on neither.
|
|
51
52
|
|
|
53
|
+
## Time zones
|
|
54
|
+
|
|
55
|
+
`timezone` is the IANA id of the zone the airport keeps time in, `"Europe/Madrid"`, so a local time read from a waybill or an email ("lands 05:30") can be turned into an instant for any date, before any feed has sent an offset, and across a daylight saving change. It is a string: hand it to `TZInfo::Timezone.get` or `ActiveSupport::TimeZone[]`. The gem has no time zone dependency.
|
|
56
|
+
|
|
57
|
+
Every airport has one. Where it comes from (the `timezone_source` column):
|
|
58
|
+
|
|
59
|
+
| Source | Airports | Example |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| `override`: a reviewed list, `data/sources/timezone_overrides.csv` | 4 | Gold Coast `Australia/Brisbane` |
|
|
62
|
+
| `boundaries`: the airport's position on [timezone-boundary-builder](https://github.com/evansiroky/timezone-boundary-builder)'s map | 9,048 | Madrid `Europe/Madrid`, Nome `America/Nome` |
|
|
63
|
+
|
|
64
|
+
The map is the "with oceans" edition, whose zones reach over territorial waters, so an airport on reclaimed land (HKG, KIX, MLE) still falls in its country's zone. Every zone it gives is checked against tzdata's list of zones for the airport's country: a Spanish airport can be in `Europe/Madrid`, `Africa/Ceuta` or `Atlantic/Canary` and nothing else. One that fails is left without a zone and listed in the refresh pull request until an override gives it one. Guantánamo's base, inside Cuba on US Eastern time, is the case the check catches.
|
|
65
|
+
|
|
66
|
+
One rule overrides the map: Xinjiang's airports get `Asia/Shanghai`, not `Asia/Urumqi`. Xinjiang keeps a local clock two hours behind Beijing, which is what tzdata records, but its airports and airlines run on Beijing time.
|
|
67
|
+
|
|
68
|
+
### Your tzdata has to know the zone
|
|
69
|
+
|
|
70
|
+
The table is built against tzdata 2026f, and the application that reads a zone has to know it too. tzinfo, and so ActiveSupport, reads the system's zoneinfo (`/usr/share/zoneinfo`, from the OS `tzdata` package) unless the `tzinfo-data` gem is installed, in which case it reads that instead. Either can be older than the table: `America/Coyhaique`, Chile's Aysén region, has only existed since tzdata 2025b.
|
|
71
|
+
|
|
72
|
+
- In a Docker image, the base image's `tzdata` package is what counts. Current Debian and Ubuntu images carry it, and rebuilding picks up updates.
|
|
73
|
+
- With `tzinfo-data` in the Gemfile (Windows, JRuby, or by choice), keep the gem current.
|
|
74
|
+
- An unknown zone raises `TZInfo::InvalidTimezoneIdentifier`, and `ActiveSupport::TimeZone[]` answers nil. Treat that as an airport with no zone rather than an error.
|
|
75
|
+
|
|
52
76
|
## Cities
|
|
53
77
|
|
|
54
78
|
`city` is the city the airport serves, the one a carrier, a courier or a person names: "Brussels", "Athens", "Leipzig". `municipality` is the town it stands in, as OurAirports gives it: "Zaventem", "Spata-Artemida", "Schkeuditz". They are the same for most airports.
|
|
@@ -57,33 +81,42 @@ The served city comes from [OpenFlights](https://openflights.org/data) for the 6
|
|
|
57
81
|
|
|
58
82
|
The subdivision always follows where the airport is, not the city it serves: Cincinnati's airport is in Kentucky (`US-KY`), not Ohio.
|
|
59
83
|
|
|
84
|
+
## Short names
|
|
85
|
+
|
|
86
|
+
`short_name` is the label to show beside a code when the city alone is not enough ("London" is five airports): "London Heathrow", "Lima Jorge Chávez", "Dubai". It is the airport's name without "Airport", "International" and their translations, with the city put in front when what is left does not already say it (compared without accents or case).
|
|
87
|
+
|
|
88
|
+
Where that reads badly (an official name that runs to eight words, a repeated word, a dotted İ), a reviewed label wins: `data/sources/short_name_overrides.csv`, as `iata,short_name,note`. Like the subdivision overrides it is a build input, not shipped; the label is built into the `short_name` column of the table, so a monthly refresh keeps it. Each refresh lists the rows whose airport has gone or that the rule now labels the same, so they can be removed. An unknown code answers `nil`.
|
|
89
|
+
|
|
60
90
|
## Data
|
|
61
91
|
|
|
62
92
|
[OurAirports](https://ourairports.com/data/) (public domain), filtered to airports with an IATA code that are not closed. When two rows share a code, the one with scheduled flights wins, then the larger airport. Coordinates are rounded to four decimal places (about ten metres).
|
|
63
93
|
|
|
64
94
|
Served cities: [OpenFlights](https://openflights.org/data), © OpenFlights contributors, available under the [Open Database License](https://opendatacommons.org/licenses/odbl/1-0/).
|
|
65
95
|
|
|
96
|
+
Time zones: [timezone-boundary-builder](https://github.com/evansiroky/timezone-boundary-builder), built from [OpenStreetMap](https://www.openstreetmap.org/copyright) data, © OpenStreetMap contributors, available under the [Open Database License](https://opendatacommons.org/licenses/odbl/1-0/).
|
|
97
|
+
|
|
66
98
|
## License
|
|
67
99
|
|
|
68
|
-
The code is MIT. The table (`data/airports.csv`) is a derivative of OpenFlights' database, so it is under the [ODbL 1.0](https://opendatacommons.org/licenses/odbl/1-0/): a database you build from it and use publicly has to credit OpenFlights and be offered under the ODbL too. Using the gem to look airports up does not. See `LICENSE.txt`.
|
|
100
|
+
The code is MIT. The table (`data/airports.csv`) is a derivative of OpenFlights' database and of OpenStreetMap's (through the time zone map), so it is under the [ODbL 1.0](https://opendatacommons.org/licenses/odbl/1-0/): a database you build from it and use publicly has to credit OpenFlights and OpenStreetMap and be offered under the ODbL too. Using the gem to look airports up does not. See `LICENSE.txt`.
|
|
69
101
|
|
|
70
102
|
## Refresh
|
|
71
103
|
|
|
72
104
|
`.github/workflows/refresh.yml` runs on the 3rd of every month:
|
|
73
105
|
|
|
74
|
-
1. `rake airports:refresh` downloads OurAirports, the ISO 3166-2 list
|
|
106
|
+
1. `rake airports:refresh` downloads OurAirports, the ISO 3166-2 list, the Natural Earth map and the time zone map, and rebuilds `data/airports.csv`. The time zone map is 185 MB unzipped: the rebuild takes about a minute and 1.5 GB of memory.
|
|
75
107
|
2. `Trackberry::Airports::Diff` checks the result before anything ships:
|
|
76
108
|
- at least 8,500 airports;
|
|
77
109
|
- the table shrinks by no more than 2%;
|
|
78
110
|
- airports with a subdivision fall by no more than 2%;
|
|
79
111
|
- no more than 2% move to another principal subdivision;
|
|
80
112
|
- two dozen major airports (FRA, LHR, JFK, LIM…) are all present;
|
|
81
|
-
- fourteen of them, in countries whose holidays differ by region, keep their principal subdivision (FRA in `DE-HE`, MUC in `DE-BY`…), because one country's codes breaking stays under the percentage caps
|
|
82
|
-
|
|
113
|
+
- fourteen of them, in countries whose holidays differ by region, keep their principal subdivision (FRA in `DE-HE`, MUC in `DE-BY`…), because one country's codes breaking stays under the percentage caps;
|
|
114
|
+
- airports with a time zone fall by no more than 2%, no more than 2% move to another zone, and seven anchors keep theirs (FRA in `Europe/Berlin`, URC in `Asia/Shanghai`…).
|
|
115
|
+
3. If it passes, the job opens a pull request listing every added, removed, renamed, moved, re-citied, resubdivided and rezoned airport, and starts CI on it. If it fails, or a download fails, it opens an issue instead.
|
|
83
116
|
|
|
84
117
|
Merging a refresh bumps the minor version, and `.github/workflows/release.yml` publishes it to [rubygems.org](https://rubygems.org/gems/trackberry-airports).
|
|
85
118
|
|
|
86
|
-
To rebuild from files already on disk: `bundle exec rake "airports:refresh[airports.csv,iso_3166-2.json,admin1.geojson]"`.
|
|
119
|
+
To rebuild from files already on disk: `bundle exec rake "airports:refresh[airports.csv,iso_3166-2.json,admin1.geojson,timezones-with-oceans.geojson.zip]"` (the time zone map can also be the unzipped `.json`). The `.zip` needs `unzip` on the path.
|
|
87
120
|
|
|
88
121
|
## Install
|
|
89
122
|
|