Anagram hikes

Anagram Hikes
Anagram Hikes


bpost has a postal code validation tool, providing a spreadsheet of postal codes with names of Belgian communes and their deelgemeenten. We can convert the spreadsheet to a CSV file using ssconvert, and filter out all special postal codesSinterklaas has his own postal code: 612, for 6th of December. (which are not linked to a commune, but to large public institutions and broadcasters that get their own postal codePostal codes in BelgiumWikipedia) with xan.

ssconvert zipcodes_num_nl_2025.xls postal.csv
xan head postal.csv | xan view
Displaying 5 cols from 10 rows of <stdin>
┌───┬──────────┬────────────────┬──────────────┬────────────────┬───────────┐
│ - │ Postcode │ Plaatsnaam     │ Deelgemeente │ Hoofdgemeente  │ Provincie │
├───┼──────────┼────────────────┼──────────────┼────────────────┼───────────┤
│ 0 │      612 │ Sinterklaas    │ <empty>      │ Sinterklaas    │ <empty>   │
│ 1 │     1000 │ Brussel        │ Neen         │ BRUSSEL        │ BRUSSEL   │
│ 2 │     1005 │ Verenigde Ver… │ <empty>      │ Verenigde Ver… │ <empty>   │
│ 3 │     1006 │ Raad van de V… │ <empty>      │ Raad van de V… │ <empty>   │
│ 4 │     1007 │ Assemblée de … │ <empty>      │ Assemblée de … │ <empty>   │
│ 5 │     1008 │ Kamer van Vol… │ <empty>      │ Kamer van Vol… │ <empty>   │
│ 6 │     1009 │ Belgische Sen… │ <empty>      │ Belgische Sen… │ <empty>   │
│ 7 │     1011 │ Vlaams Parlem… │ <empty>      │ Vlaams Parlem… │ <empty>   │
│ 8 │     1012 │ Parlement de … │ <empty>      │ Parlement de … │ <empty>   │
│ 9 │     1020 │ Laken          │ Ja           │ BRUSSEL        │ BRUSSEL   │
└───┴──────────┴────────────────┴──────────────┴────────────────┴───────────┘

Filtering out these special cases:

Displaying 5 cols from 10 rows of <stdin>
┌───┬──────────┬─────────────────────┬───────────┬─────────────────────┬───────────┐
│ - │ Postcode │ Plaatsnaam          │ Deelgeme… │ Hoofdgemeente       │ Provincie │
├───┼──────────┼─────────────────────┼───────────┼─────────────────────┼───────────┤
│ 0 │     1000 │ Brussel             │ Neen      │ BRUSSEL             │ BRUSSEL   │
│ 1 │     1020 │ Laken               │ Ja        │ BRUSSEL             │ BRUSSEL   │
│ 2 │     1030 │ Schaarbeek          │ Neen      │ SCHAARBEEK          │ BRUSSEL   │
│ 3 │     1040 │ Etterbeek           │ Neen      │ ETTERBEEK           │ BRUSSEL   │
│ 4 │     1050 │ Elsene              │ Neen      │ ELSENE              │ BRUSSEL   │
│ 5 │     1060 │ Sint-Gillis         │ Neen      │ SINT-GILLIS         │ BRUSSEL   │
│ 6 │     1070 │ Anderlecht          │ Neen      │ ANDERLECHT          │ BRUSSEL   │
│ 7 │     1080 │ Sint-Jans-Molenbeek │ Neen      │ SINT-JANS-MOLENBEEK │ BRUSSEL   │
│ 8 │     1081 │ Koekelberg          │ Neen      │ KOEKELBERG          │ BRUSSEL   │
│ 9 │     1082 │ Sint-Agatha-Berchem │ Neen      │ SINT-AGATHA-BERCHEM │ BRUSSEL   │
└───┴──────────┴─────────────────────┴───────────┴─────────────────────┴───────────┘

We are interested in both the names of hoofdgemeenten and deelgemeenten in lowercase. We put both of these in one column using xan unpivot 1,3, which puts all values in a column named value. We now have some duplicates in this column, which is why we also need dedup before writing these to a towns.txt file.

xan filter "!eq(Deelgemeente, '')" postal.csv \
	| xan transform 1,3 'lower(_)' \
	| xan unpivot 1,3 \
	| xan select value \
	| xan dedup > towns.txt

We end up with a list of 2733 names:

xan head towns.txt | xan view
Displaying 1 col from 10 rows of <stdin>
┌───┬─────────────────────┐
│ - │ value               │
├───┼─────────────────────┤
│ 0 │ brussel             │
│ 1 │ laken               │
│ 2 │ schaarbeek          │
│ 3 │ etterbeek           │
│ 4 │ elsene              │
│ 5 │ sint-gillis         │
│ 6 │ anderlecht          │
│ 7 │ sint-jans-molenbeek │
│ 8 │ koekelberg          │
│ 9 │ sint-agatha-berchem │
└───┴─────────────────────┘

With the alphabetic map of these names, we get 18 anagram town pairs for which we plan hiking routes using the openrouteservice API.

rosée ⟷ sorée
idegem ⟷ diegem
olen ⟷ olne
tiegem ⟷ itegem
seraing ⟷ ragnies
herent ⟷ herten
erpe ⟷ peer
laken ⟷ alken
meerbeke ⟷ meerbeek
mere ⟷ meer
mollem ⟷ lommel
herve ⟷ hever
virelles ⟷ serville
veulen ⟷ leuven
borsbeke ⟷ borsbeek
berloz ⟷ borlez
lembeke ⟷ lembeek
edingen ⟷ gedinne

Anagram Hikes
Anagram Hikes