Enough self-promotion, much more interesting are the details on these codes which I could find out during this work. When I first discovered them I only did a short look into the system to create the codes, and falsely claimed that for each of the levels the entities are numbered starting with the last two digits 01. This is however only partially true - the municipalities existing before 1999 are always having numbers starting with 01, and the TAO start with 01 as well. Those municipalities which upgraded from sanitary districts in 1999 however have their last two digits following the TAO codes. Also, the TAO upgraded to municipalities also kept their last two digits and only had the leading digit changed from 6 (for TAO) to 5 (for subdistrict municipality) - though a lot of them upgraded in the last years are listed as municipality but still have their code start with 6.
An interesting fact I could deduce from the numbers - these codes were adopted in 2003. I can make this quite exact dating due to the fact that between 2000 and 2004 it had several TAO merged with each other or with a neighboring municipality, but also the last of the Tambon councils getting upgraded into TAO. For those TAO abolished in 2004 it (almost) always had a code left out in the numbering, those TAO created in 2004 are added after the former sanitary districts. On the other hand, those few TAO abolished 2000-2002 have no empty space in the numbers.
To prove it with actual cases
- Wang Kapi (วังกะพี้), Mueang Uttaradit, Uttaradit province - the TAO was merged into the municipality Wang Kapi in 2002, but the codes 6530101 till 5530117 leave final two digit free.
- Khun Yuam (อบต.ขุนยวม), Khun Yuam district, Mae Hong Son province - the TAO was created in 2004, and has the code 6580206. The former sanitary district Khun Yuam has code 5580205.
- Talat Chaiya (ตลาดไชยา), Chaiya district, Surat Thani district - the TAO was merged with the municipality Talat Chaiya in 2004. The codes for the district omit the number 03, so I presume that this TAO had the code 6840603.