seaports 1.8.0 → 1.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a40505b62d1ab5de83eadd24dc5192b750df8635d7cf82293950467f4bfb9e5b
4
- data.tar.gz: 774d17934a587d1457a76efaa2eda644706aa8e32a82168fcd21eec5636922a5
3
+ metadata.gz: c6537d2c931e29e7a1a4eceff0d8e98f8443b254730eae63f3988999f1cd2850
4
+ data.tar.gz: 7b3782e91470c237fd83ecf206f78b78bc50e25764d2b70858873ba011516d4f
5
5
  SHA512:
6
- metadata.gz: bf5e04913a23194bb1b9f9b6e1a90874463d2834f432687af13bdc534f6111e364d6bf1aa6246192e4c019a8b03b09b13163f5bc283716b4fb87b6f4815155d1
7
- data.tar.gz: e8e28346ba4fb966a598bc38ead637673e9c34e3810a466186c3c23432e914124e680b009ed5de57aec2e95995ca19783a81a5ccf5ddee657f2aa1c78fa2490d
6
+ metadata.gz: aa8b172fb1ddc7f380a49e05f9c0b55070547ff86e2ad2b7e6257045a17392502b9cbf2b1ab1a6ad88d4f2779d216807c0367f62d6c1a18304b36cc20e94cd16
7
+ data.tar.gz: aedf12dc35ae99c5e30883ec673ef720ccf891e353b6a54430411de092de2f53eb21bb8e5727fbfd40d18b42db99842bd9658894b69935e15375c4149a8caeb2
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  Entries are written by `.github/workflows/refresh.yml` when it opens a refresh
4
4
  pull request, or by hand for a code change; a person merges both.
5
5
 
6
+ ## 1.9.0 — 2026-11-24
7
+
8
+ Each port's IANA time zone, so a local time with no offset, or an offset taken on another date, can be read in the port's own clock: `Seaports.timezone("ESVLC")` is `"Europe/Madrid"`, and `Seaports::Port#timezone` the same. The table gains `timezone` and `timezone_source` columns, before `alternate_names`. 17,038 of the 17,567 ports have a zone, always one tzdata's `zone.tab` lists for the port's country, except in `XZ` and `HM`, which `zone.tab` does not list and whose ports take whatever zone the map has where they are, often the open sea's (`Etc/GMT-5`, which is UTC+5):
9
+
10
+ - 11,028 from their country's single zone, which needs no position;
11
+ - 5,131 from the zone their position falls in on timezone-boundary-builder's `2026f` map with oceans (© OpenStreetMap contributors, ODbL), when it is one of the country's;
12
+ - 55 from the nearest of the country's zones, within 50 km of a position that landed next door (Detroit, Xiamen) or 250 km of one out at sea, measured in degrees of latitude and so shorter east-west (the Louisiana Offshore Oil Port, the oil terminals on the North West Shelf and off Terengganu);
13
+ - 808 with no position from the zone the placed ports of their subdivision all agree on, when at least three are placed: Bavaria's ports with no position are in `Europe/Berlin`, the Canaries' in `Atlantic/Canary`;
14
+ - 16 from a reviewed list, `data/sources/timezone_overrides.csv`: five ports whose state or province is on the other side of a zone line their position lands across (Juazeiro, Praia Norte, Ingeniero Buitrago, and Deception Bay and Kovik Bay in Nunavik), eight whose position is far from the port (in the open sea, on another continent, or in another region, as Kubekovo's is in Irkutsk Oblast), Lord Howe Island, which keeps `Australia/Lord_Howe` inside New South Wales, and the Challis Venture and Montara oil fields in the Timor Sea, filed under the Northern Territory, which take `Australia/Darwin` rather than the nearest coast's `Australia/Perth`.
15
+
16
+ The zones are worked out when the table is built, by `Seaports::Timezones` with GEOS through rgeo, as the outlines are; the gem adds no dependency and reads them as strings. `rake seaports:refresh` places every port again, `Seaports::Diff` lists each port whose zone changed and refuses a table that lost more than 2% of its zones, and the override report lists overrides that have outlived their reason. `rake seaports:apply_timezones` writes the zones into the table without the rest of a refresh, and lists the ports placed by position in another zone than the rest of their subdivision, for review. A refresh that cannot load GEOS is now refused like any other failed download, rather than failing the job. `Builder.apply_coordinates` now writes its columns in the table's header order.
17
+
6
18
  ## 1.8.0 — 2026-11-24
7
19
 
8
20
  Port outlines for seven ports at the ends of the Panama and Suez canals, so 118 in all, each the hull of its terminal cut to the water: Manzanillo International Terminal (`PAMIT`), Colón Container Terminal (`PAONX`) and Cristóbal (`PACTB`) at the Panama Canal's Atlantic entrance, Balboa (`PABLB`) and PSA Panama International Terminal at Rodman (`PAROD`) at its Pacific entrance, West Port Said (`EGPSD`), and Adabiya in Suez Bay (`EGADA`), with the two seamark anchorages OpenStreetMap names C1 south-south-east of its quays. The canals' waiting areas stay in the canal outlines, and no port's limits take one in. Balboa's and Rodman's limits overlap by under a hectare in the canal's entrance channel. Cristóbal's accept the label of the Cristóbal neighbourhood, which OpenStreetMap places inside the port area; the other six scans find no homes, residential land, schools, hospitals, places of worship or place labels. Suez and Port Tewfik are not outlined: OpenStreetMap maps no port area or terminal there.
data/README.md CHANGED
@@ -31,8 +31,8 @@ out of the default gems.
31
31
  ## What is in it
32
32
 
33
33
  Every entry UN/LOCODE classifies as a sea port: **17,567 ports**, 13,216 of them
34
- with coordinates and 15,209 with a subdivision, rebuilt from UNECE's
35
- latest published list whenever it changes.
34
+ with coordinates, 15,209 with a subdivision and 17,038 with a time zone,
35
+ rebuilt from UNECE's latest published list whenever it changes.
36
36
 
37
37
  ```ruby
38
38
  Seaports.count # => 17567
@@ -269,6 +269,84 @@ way, optional and defaulting to a shared empty list. Because it is a new member,
269
269
  `Port#to_h`, `Port.members` and `deconstruct`/`deconstruct_keys` gain a key, and
270
270
  a `Port` serialised with `Marshal` by 1.5.0 will not load in 1.6.0.
271
271
 
272
+ ### Time zones
273
+
274
+ Tracking feeds and emails give times in the port's local time, often with no
275
+ offset ("arrives 05:30"), and when one does send an offset it holds only for
276
+ that date: a winter ETD's `+01:00` is an hour out for a summer arrival. The
277
+ port's IANA time zone gives the right offset for any date:
278
+
279
+ ```ruby
280
+ Seaports.timezone("ESVLC") # => "Europe/Madrid"
281
+ Seaports.timezone("ESLPA") # => "Atlantic/Canary"
282
+ Seaports.timezone("USLO8") # => "America/Chicago" Louisiana Offshore Oil Port, about 30 km out
283
+ Seaports.timezone("AULDH") # => "Australia/Lord_Howe" UTC+10:30, half-hour daylight saving
284
+
285
+ TZInfo::Timezone.get(Seaports.timezone("ESVLC")).local_to_utc(Time.utc(2026, 7, 1, 5, 30))
286
+ # => 2026-07-01 03:30:00 UTC
287
+ ```
288
+
289
+ The gem returns the zone as a string and does not depend on TZInfo; hand the
290
+ string to whatever time zone library you use. A zone is always one tzdata
291
+ lists for the port's country, so a Spanish port is in `Europe/Madrid`,
292
+ `Africa/Ceuta` or `Atlantic/Canary` and nothing else. The exceptions are the
293
+ ports of the two codes tzdata lists no zone for, `XZ` (installations in
294
+ international waters) and `HM` (Heard and McDonald Islands), which take
295
+ whatever zone the map has where they are, often one of the open sea's:
296
+ `Etc/GMT-5` for Heard Island. Those names keep POSIX's sign, so `Etc/GMT-5`
297
+ is UTC+5. 17,038 ports have one,
298
+ and the table records how each was found (`timezone_source`), best first:
299
+
300
+ | Source | Ports | How |
301
+ | --- | --- | --- |
302
+ | `override` | 16 | A reviewed list, `data/sources/timezone_overrides.csv`, for ports whose position lands in the wrong zone or nowhere: Juazeiro, in Bahia, lands across the river in Pernambuco's zone, Lord Howe Island has no position and keeps its own time, and two Timor Sea oil fields UN/LOCODE files under the Northern Territory keep Darwin's time rather than that of Western Australia, their nearest coast. Each row says why. |
303
+ | `country` | 11,028 | The country's zone, where tzdata gives it only one. No position needed: every Dutch port is in `Europe/Amsterdam`. |
304
+ | `map` | 5,131 | The zone the port's position falls in on [timezone-boundary-builder](https://github.com/evansiroky/timezone-boundary-builder)'s map, when that zone is one of the country's. The map's land zones reach over each country's territorial sea, so a waterfront position just offshore still lands in its own zone. |
305
+ | `nearest` | 55 | The nearest of the country's zones, within 50 km of a position that landed in another country (Detroit's lands across the river in Toronto's zone), or 250 km of one out at sea (oil terminals on the North West Shelf, in the Gulf of Mexico and off Terengganu). The distance is measured in degrees of latitude, so east-west the reach is shorter, by the cosine of the latitude: 25 and 125 km at 60° N. |
306
+ | `subdivision` | 808 | For a port nothing above places, mostly ports with no position in a country with several zones: the zone every port the map placed in the same subdivision is in, when at least three are and all agree. Bavaria's are all in `Europe/Berlin`, so a Bavarian port with no position is too. Florida's are split between New York and Chicago, so one with no position gets none. |
307
+
308
+ 529 ports have none: ports with no position in a country with several zones
309
+ whose subdivision is split or unknown (Canada 134, Malaysia 88, Indonesia 82,
310
+ Russia 43), and 19 whose position lands in no zone of their own country,
311
+ all but one of them Antarctic stations. A
312
+ caller falls back to an offset the feed sent, or to UTC.
313
+
314
+ The map is pinned to timezone-boundary-builder's release `2026f`, with
315
+ tzdata's `zone.tab` from the same release vendored as
316
+ `data/sources/zone.tab`. Both are read when the table is built, with GEOS
317
+ through the rgeo gem; nothing is fetched or computed at runtime. A refresh
318
+ places every port again, lists every zone that changed, and refuses a table
319
+ that lost more than 2% of its zones at once. It also lists overrides that
320
+ have outlived their reason: a port that left UN/LOCODE, or one whose
321
+ country or position now gives the same zone. After adding a row to the overrides file, or
322
+ after `rake seaports:apply_coordinates`, `rake seaports:apply_timezones`
323
+ writes the zones into the table without the rest of a refresh, downloading
324
+ the map once into `tmp/refresh`.
325
+
326
+ Positions are UN/LOCODE's, to the minute, so a port within about two
327
+ kilometres of a line between two of its country's zones may be on the wrong
328
+ side of it. When the table was built, 42 ports the map placed lay within 3 km
329
+ of another of their country's zones. Each was checked against the state or
330
+ province UN/LOCODE files it in, and the 5 on the wrong side are overridden.
331
+ A position can also be wrong by hundreds of kilometres and still land in one
332
+ of the country's zones, so `rake seaports:apply_timezones` also lists every
333
+ port placed by its position in another zone than all the other placed ports
334
+ of its subdivision. Of the 15 it listed, 3 were wrong positions and are
335
+ overridden (Kubekovo, Indonesia Bulk Terminal, and Washington, Louisiana,
336
+ which the World Port Index puts in Alaska). The other 12 keep their own
337
+ clocks: Fort Frances is on Central time in Ontario, Invermere on Mountain
338
+ time in British Columbia, Tornillo on Mountain time in Texas, and Easter
339
+ Island, Fernando de Noronha and Macquarie Island on their own.
340
+
341
+ The map's zones are © OpenStreetMap contributors and timezone-boundary-builder,
342
+ under the [ODbL](https://www.openstreetmap.org/copyright). `zone.tab` is in the
343
+ public domain.
344
+
345
+ `Seaports::Port` gained `timezone` in 1.9.0, optional and nil by default, so
346
+ a `Port` built as before still works. It is a new member, so `Port#to_h`,
347
+ `Port.members` and `deconstruct`/`deconstruct_keys` gain a key, and a `Port`
348
+ serialised with `Marshal` by 1.8.0 will not load in 1.9.0.
349
+
272
350
  ### Port outlines
273
351
 
274
352
  A point says where a port is; an outline says whether a ship is in it. Sevilla