Technical notes
Total goods exports and imports (all 123 commodity categories summed via the workbook's own "T Total" row, not summed by hand, so sub-categories are never double-counted with their parent category) for the UK's top 90 trading partners by 2025 combined trade (99% of the value of UK goods trade), every year 1997-2025 carried as a property so the year slider restyles the layer without loading new tiles. Aggregate rows (Whole world, EU totals) are excluded -- only real countries are shown. 26MB of tiles; small enough to commit rather than gitignore. The first version carried the top 40; it was widened to 90 on 2026-10-08 because 40 left out big partners such as Turkey, Indonesia, Nigeria and Algeria. Jersey and Guernsey are in the ONS figures but not in HMRC's port data, so they have lines but no mode or goods detail; Serbia is code XS in HMRC's tables. How goods crossed the border (added 2026-10-06, docs/DECISIONS_LOG.md #150): HMRC's Overseas Trade in Goods Statistics (OTS, Open Government Licence v3.0, "(c) Crown copyright" per the dataset record) record the port or airport of every declaration. Grouped by id into air (airports and airbases, ids 419-482), the Channel Tunnel and rail freight terminals, sea (every named seaport) and other (port not collected, estimates, postal, free zones, the Irish land border). Value and net mass summed by flow (exports = EU + non-EU exports, imports likewise), partner and year 2000-2025. It is the port, not the vehicle: a lorry on a ferry is sea. EU trade has no port on record before 2021 (exports) and 2022 (imports), so an icon is drawn only where at least 70% of the value has a recorded port. HMRC's trade-basis totals differ from ONS's balance-of-payments totals used for the line widths, so only shares are shown from this source. Lorry icon (added 2026-10-08, docs/DECISIONS_LOG.md #163): HMRC names the port, not the vehicle, so seaports are split by what the DfT says they mostly handle (layers/hmrc_trade_modes.py, FERRY_SHARE): a port where roll-on roll-off is at least 35% of its tonnage in 2025 (Dover, Immingham and Grimsby, Harwich, Holyhead, Heysham, Portsmouth, Fishguard, Poole, Belfast) is a ferry port, shown with a lorry, and every other seaport a ship. That is a stand-in for lorries on ferries, not a count of lorries, and it is judged by tonnes, which understates roll-on roll-off at mixed ports such as Hull. Lorry and train journeys on the click panel are drawn London, Dover (or the Channel Tunnel), Calais, then along hand-placed legs between about 90 European cities (pipeline/layers/land_lanes.py, docs/DECISIONS_LOG.md #164) to the country's capital or main entry city, with the Little Belt, Great Belt and Oresund bridges for Denmark and Sweden (Ireland: Holyhead to Dublin). They are drawing aids, straight lines between cities, not motorways or tracks. A lorry or train icon is shown only for a country such a route reaches; for any other (Morocco, Colombia, Malta...) goods that left by a ferry port or the tunnel go on by ship, so they count as sea. How "Play this route" travels (added 2026-10-07, docs/DECISIONS_LOG.md #159): the ship, plane and train routes on the click panel are drawing aids, not records. Ship routes follow about 150 hand-placed open-water legs (pipeline/layers/sea_lanes.py), each checked against Natural Earth's 1:10m land polygons so none cuts across land (the Suez Canal, and the Dardanelles, are the only exceptions, said in the code and tests), from Felixstowe, Southampton or Liverpool to the partner country's main container port. Flights run by great circle from London Heathrow to that country's main airport. Port and airport positions come from Natural Earth's 1:10m ports and airports (public domain, naturalearthdata.com, downloaded 2026-10-07) and were checked by name; five ports (Aarhus, Genoa, Busan, Port Klang, Constanta) and two airports (Larnaca, Bucharest) that Natural Earth does not list use the cities' well-known coordinates. A country with no coast is shown with the sea leg ending at its usual port in a neighbour (Rotterdam or Bremerhaven), and the goods go on overland. Journey times are the real length of each drawn route at a typical 40 km/h for a container ship and 850 km/h for a cargo jet. Real voyages vary with the carrier, weather and canal closures. Prices (added 2026-10-08, docs/DECISIONS_LOG.md #172): the card's Prices switch restates every year in 2025 pounds with the ONS consumer price index, series D7BT "CPI INDEX 00: ALL ITEMS 2015=100" (dataset MM23, Open Government Licence v3.0, annual averages, release of 15 September 2026, read live from https://www.ons.gov.uk/economy/inflationandpriceindices/timeseries/d7bt/mm23/data on 2026-10-08; pipeline/layers/ons_cpi.py writes web/public/layers/uk-cpi.json). The factor for a year is the 2025 index divided by that year's (1997: 1.97; 2020: 1.27). It is general consumer inflation, not the price of traded goods, said on the layer. One product at a time (added 2026-10-08, docs/DECISIONS_LOG.md #172): the card's Product picker redraws the map for one HS chapter (two-digit commodity code) from the same HMRC OData records as the goods lists, but for every chapter, not just the top five (pipeline/layers/hmrc_trade_goods.py writes web/public/layers/trade-products/<chapter>.json: exports and imports per partner and year, 2000-2025, GBP million, HMRC's own trade-basis values, which differ a little from ONS's totals). Figures are drawn at a scale of their own, so the biggest partner for a product stands out. A data fix made on the same day: HMRC lists the United States under two ids (902 "USA" to 2008, 400 "United States" from 2009), and the first version read only 902, so the USA had no port, mode or goods records after 2008; both ids are now read (layers/hmrc_trade_modes.py country_ids, test_trade_modes.py). Services (added 2026-10-08, docs/DECISIONS_LOG.md #172): ONS "UK trade in services: service type by partner country, non-seasonally adjusted" (Q1 2026 edition, released 24 July 2026, Open Government Licence v3.0; landing page https://www.ons.gov.uk/businessindustryandtrade/internationaltrade/datasets/uktradeinservicesservicetypebypartnercountrynonseasonallyadjusted, file https://www.ons.gov.uk/file?uri=/businessindustryandtrade/internationaltrade/datasets/uktradeinservicesservicetypebypartnercountrynonseasonallyadjusted/current/servicetypebycountry2026q1.xlsx, read 2026-10-08). Its "Sheet 1. Time Series" gives exports and imports in GBP million, current prices, for the 13 top-level service types and each country, annually 2016-2025. Each service type is a "product" of the map (web/public/layers/trade-products/S<n>.json, pipeline/layers/ons_services.py). Only the 61 of the 90 goods partners that ONS lists as a country of their own are drawn; ONS groups the rest (the Gulf states, Kenya, Nigeria...) into "other" rows that cannot sit on one country. Cells ONS withholds as confidential ("C") are left out. "United States" is ONS's "United States inc Puerto Rico". Services are not added to the goods totals.