Tuesday, September 9, 2014

Area definition for Nong Khanan subdistrict municipality

After a long time of inactivity due to the political lock of the country, the Royal Gazette contains a new announcement by the Ministry of Interior, by which the area of the subdistrict municipality Nong Khanan (เทศบาลตำบลหนองขนาน) [Wikidata] was modified. The municipality was created in August 2012 by upgrading the TAO Nong Khanan, and though the municipality covers the whole subdistrict Nong Khanan there seem to have been problems with the exact boundaries. In March this year, the boundaries of the subdistrict were revised by a publication in the Royal Gazette, updating the original definition from 1998 [Gazette] for the subdistricts Nong Khanan and Hat Chao Samran. Since none of the subdistrict area definitions contains a map, I only have the map embedded with the current announcement showing the current boundaries of the subdistrict and municipality.

As the municipality boundaries were not well-defined, the Election Commission did not prepare any constituencies for the municipality council yet, so there was no election for either the municipal council or the mayor since 2012 - and as the coup junta stopped all local elections until further notice, there will be an appointed council sometime soon (or maybe there is already and I just did not find anything on the web about it yet), whereas the permanent secretary will continue to be acting mayor as long as the junta sees the country not ready to have any elections.

Friday, July 4, 2014

New ccaatt geocodes

Yesterday DOPA updated their website describing the ccaatt geocodes, those codes on which the Thai standard TIS 1099 as well as ISO 3166:2 are based. Though just published yesterday, the codes are dated from March 19. As there have been no new Amphoe or Tambon, the only real changes were within the RCode table, which gives codes to several of the municipalities.
  1. Ban Klang (เทศบาลตำบลบ้านกลาง), Mueang Pathum Thani district, Pathum Thani getting code 1381.
  2. In Chonburi, the codes 2065 to 2069 were readded - they were removed in the previous list from 2013, but were present in 2012 already.
  3. Nong Wa (เทศบาลตำบลหนองหว้า), Kumphawaphi district, Udon Thani getting the code 4158.
  4. Mueang Bua (เทศบาลตำบลเมืองบัว), Kaset Wisai district, Roi Et readded as 4578. The code was missing in 2013, and in 2012 marked as obsolete.
  5. The same happened for San Pu Loei (5046) and Fa Ham (5059) in Chiang Mai province. Also, the codes 5045 and 5047 to 5049 are re-added, but still marked as obsolete.
  6. Mae Yao (เทศบาลตำบลแม่ยาว), Mueang Chiang Rai, Chiang Rai getting code 5764.
  7. Nai Mueang (เทศบาลตำบลในเมือง), Sawankhalok district, Sukhothai getting code 6484.
All other changes are status upgrades of already existing and numbered municipality, or name changes of such municipalities.

Thursday, July 3, 2014

Local governments and Tambon

On the German Wikipedia, there was recently a little discussion on how to better organized the administration section of the articles on the districts. Following the outline used on the English Wikipedia, first it listed the numbers of Tambon and Muban, then the local governments, and finally a table listing all the Tambon in the district. The Thai Wikipedia separates the two classes of subdivisions, it moves all the information on the local governments into a separate subsection. It seems that I am to blame for the original outline in the English Wikipedia, though I cannot remember exactly I think this was caused by the fact that I didn't know much about the local governments when starting the the districts, and only later started to add the local governments into the text of the administration section. Now the two German Wikipedians doing a lot of the work for articles around Thailand are migrating the articles into the new format, but having to work on nearly 900 articles will obviously take quite some time.

Since the local governments aren't always straight-forward one Tambon one local government - the municipalities existing before the year 2000 usually covered only parts of a Tambon, thus there are TAO which have to share the area of a Tambon with a municipality. On the other hand, there are TAO which have responsibility over more than one adjoining Tambon - especially in 2004 several smaller TAO were merged together, as well as the remaining Tambon Councils were merged into already existing TAO. Which Tambon is covered by which local government can be found in the Thai Wikipedia articles, but that's of course not easy to read for most non-Thai. I was asked whether I can supply a list of the TAO which are not responsible for exactly one Tambon, but sadly I did not have this information at hand.

I have now added some more optional data into my XML, defining a structure in the XSD to allow to add a list of Tambon covered by a local government together with the information whether it is a complete or a partial coverage. Without any special reason - I was just adding the Wikidata links to the Tambon there - I picked Mae Phrik district of Lampang province, where the newly added lines in the XML look like the following.

  <entity type="Amphoe" name="แม่พริก" english="Mae Phrik" geocode="5209"> 
    <entity type="Tambon" name="แม่พริก" english="Mae Phrik" geocode="520901">
      <office type="TAOOffice">
        <areacoverage>
          <entity geocode="520901" coverage="partially" />
          <entity geocode="520902" coverage="completely" />
        </areacoverage>
      </office>
    </entity>
    <entity type="Tambon" name="ผาปัง" english="Pha Pang" geocode="520902" />
    <entity type="Tambon" name="แม่ปุ" english="Mae Pu" geocode="520903" />
    <entity type="Tambon" name="พระบาทวังตวง" english="Phra Bat Wang Tuang" geocode="520904">
       <office type="MunicipalityOffice">
        <areacoverage>
          <entity geocode="520904" coverage="completely" />
        </areacoverage>
      </office> 
    </entity>
  </entity> 
  <entity type="ThesabanTambon" name="แม่ปุ" english="Mae Pu" geocode="5288" parent="5209">
    <office type="MunicipalityOffice">
      <areacoverage>
        <entity geocode="520903" coverage="completely" />
      </areacoverage>
    </office>
  </entity>
  <entity type="ThesabanTambon" name="แม่พริก" english="Mae Phrik" geocode="5287" parent="5209">
    <office type="MunicipalityOffice">
      <areacoverage>
        <entity geocode="520901" coverage="partially" />
      </areacoverage>
    </office>
  </entity>
 
With 7775 local governments (not counting the PAO as for those the area of coverage is obvious), I won't be able to fill this information to all any time soon, so this is yet another data item prepared and filled on demand, and it could be a nice task for any potential contributor to my XML to add this data more systematically. While the XML look quite technical, especially for anyone who has a bit of background in programming it should be very easy to contribute to them. Having the data structure defined, I guess my next step should be to add some code using this data to help Wikipedia editors...

Monday, June 30, 2014

What happened to Mu 9 and 10 of Nong Khanak

When someone created the Wikipedia article on Nong Khanak TAO in Ayutthaya province - however just by copying content from the TAO website and thus the article should be deleted soon as being a copyright violation - I nevertheless created the Wikidata item and checked if I have all data up to date in my XML. At first it just seemed that I had the two administrative villages 9 and 10 missing, maybe area covered by a municipality and thus not included in the Muban list of the TAO.

So I checked with the website which has both the postal codes as well as the most complete list of the Muban (as far as  know), but to my surprise this also lacks Mu 9 and 10 [Source]. This might still be possible if these two Muban are part of a town or city, and thus have been abolished altogether. Next step was to check the Royal Gazette - end of the 1990s the boundaries of every Tambon were defined in  announcements by the Ministry of Interior, and these contain both the description of the boundary as well as the names of the Muban. The 1997 announcement for Tha Ruea district lists 10 Muban for Nong Khanak, thus ends with the two names I was looking for.

However, this isn't the end of the story, because the TAO covers the whole Tambon, so there is no municipality which could have led to the abolishment of these two Muban. The TAO website even includes a map, which clearly shows no trace of these two Muban. Taking a look at the names of these two Muban is also interesting: Mu 9 was named Khok Khram (บ้านโคกคราม), and the postal code list names Mu 11 as Khok Khram with the alternative name of Bo Rae (บ้านบ่อแร่), whereas the TAO website names Mu 11 just Bo Rae. Similar for Mu 9, in 1997 named Nong Muang (บ้านหนองม่วง), the same name is listed for Mu 12 in the postal code list, and the TAO names it Nong Buang (บ้านหนองบ่วง).

It thus looks like as if these two Muban were renamed and received new numbers, something I never seen before - normally Muban don't change their number if they change name, the only occasion when Muban changed numbers were when a Tambon was split and the Muban in the remaining area are changed to be consecutive again.Thus, if anyone can explain me this special case, I'd appreciate it.

In my XML I have encoded this oddity by marking Mu 9 and 10 as obsolete, this way it will not look like these numbers are really missing, but will still calculate the number of Muban as 10.

<entity type="Muban" geocode="14020909" name="บ้านโคกคราม" english="Ban Khok Khram" obsolete="1" />
<entity type="Muban" geocode="14020910" name="บ้านหนองม่วง" english="Ban Nong Muang" obsolete="1" />
<entity type="Muban" geocode="14020911" name="บ้านบ่อแร่" english="Ban Bo Rae" />
<entity type="Muban" geocode="14020912" name="บ้านหนองบ่วง" english="Ban Nong Buang" />

Tuesday, May 13, 2014

Local elections 2014

For the last years I had found Excel sheets or PDF files which listed all the local administrative units which have a term end in the respective year, which helped me a lot to get a complete coverage of the local governments and their elections. Though I knew this year is a rather quiet year with only relative few term ends, I was hoping to find the same list again. However, in yet another redesign of their website, the Election Commission removed the page which collected the links to these files, and I wasn't able to find any new source. With lots of other sources I was however able to fill in all the election dates in 2010, except one I could not find anywhere - the subdistrict municipality Tha Kham (เทศบาลตำบลท่าข้าม) in Phetchabun. The Election Commission only had the confirmation of the 2010 election results which listed all the names of the elected councilors and the mayor, but not the date of the election. Also the source where I get most of the local government election data, a database by the Department of Local Administration, omits the councilors and mayor in this case.

Though I had done several attempts with Google before, this time I finally stumbled on a document database of the Election Commission containing many of announcements - interestingly named "OldDocList" even though it is still actively used, the latest document is dated May 12th, just one day old. I tried my luck to search for the words "local term ends" (ท้องถิ่นที่ครบวาระ), and to my surprise there was one PDF for 2014 together with the old one I already knew, the document I failed to find for months. Sadly a PDF again, and only a scan of a PDF, so no way to convert it into a Excel sheet to be easier processed, but since I only needed one of the dates that is no problem. So finally could add the missing election to be dated October 3rd.

Though the year is already half over, the little statistics from the first page is worth noting. There are 690 local elections scheduled this year, 524 in municipalities, 145 in TAO, 2 PAO chairmen elections, and one the Bangkok council elections someday in October. Last year there were 3596, and 2012 a total of 3116 elections - and I am still working through the backlog from these years to get the XML up to date.

Friday, March 21, 2014

Wikidata lists and categories

Wikipedia Infobox
On his blog "Words and what not", Gerard Meijssen is showing and advocating the many possible uses of Wikidata beyond what most Wikipedia users know so far. By collecting the actual data in a structured way, it allows queries which would be very difficult to do by extracting data from the infoboxes in the Wikipedias, or simply impossible since the data isn't complete on Wikipedia.

If you are familiar with the articles on the administrative units on the English Wikipedia, you might have encountered the corresponding categories, which help to sort together related items. For example, all the districts of Surat Thani province are within the category Amphoe of Surat Thani Province, and this category like (almost) all Wikipedia pages has a corresponding Wikidata item. Following Gerard's idea that categories are almost the same as a list, and thus using the property "is a list of" in this case as well, Resonator as the smart viewer of Wikidata items is then able to create a list of all the items which should belong to the category - in this case not surprisingly the same 19 entries. Well, almost, the English Wikipedia article on Ko Samui and Ko Pha Ngang are mainly on the island and thus not linked to the data item of the district, someone still has to split the two topics into two separate articles - e.g. in German the two topics have two separate articles.

The categories for the districts are on several language editions already, for the other types of entities (Tambon, Thesaban, TAO) the Thai Wikipedia has the best coverage, but still far from a complete category tree. And of course to use the auto-created list the Wikidata item must be set accordingly, something I have done only for a handful of categories so far. For example, the Tambon of Surat Thani right now show 98 entries, I simply haven't added items for all 131 subdistrict yet. When done, it will in fact show 132 entries, because Tambon Kraison dissolved 1986 because most of its area was submerged by Chao Lan lake. Another interesting category are the Thesaban of Nakhon Ratchasima, because an anonymous editor at the Thai Wikipedia adds article on them from time to time, so unless I create the item before you could see the above list slowly growing from its current value of 75.

While the above is done behind the surface by Resonator creating a database query from the property, one can query Wikidata directly as well. The above Tambon of Surat Thani visualized with the query maker is a start, but only allows a subset of the query API. But somehow I wasn't successful to build a working query to show only those Tambon having an Wikipedia article, maybe this is all not yet fully implemented. But of course the basis of all this is to have complete and good data in Wikidata, and I continue to work on that, just recently I could add the first population data with my bot...

Monday, March 10, 2014

Population census data since 1960

While working on adding the census 2010 data into my spreadsheet, I noticed that for many provinces I already had the exact population numbers since 1960, however not for all yet. Some of the PDF files with the census results for each province published after the 2000 census had the population history listed. So I tried the same trick which helped me to find the 2010 results - simply put a few of the numbers into Google together with the Thai province name and see if it has some hits.

What I found were some data pages from a Chulalongkorn university study, which listed data on elderly people from the censuses, including the total population. For example with the page on Surat Thani - one of the provinces where I did not have the exact data before - showed the total population in the 1960 census was 324,784, and grew to 747,049 in 1990. The more recent datapoints were then taken from the registration data. Once I filled all the holes, the sum however did not match with the total number, which took some time to finally spot those provinces where I had entered the number wrongly in past - or where the PDF had a mistake, I did not verify back with that one.

Just one thing did not add up correctly - 1960 and 1960 there were still the two provinces Phra Nakhon and Thonburi, which were merged into the special administrative area Bangkok in the early 1970s. The Chulalongkorn data had separate data for Thonburi and Phra Nakhon, but the numbers don't add to the value listed at the NSO as the regional sum.
YearPhra NakhonThonburiSumNSO
19601,577,003559,3762,136,3792,136,435
19702,157,303920,0333,077,3363,077,361
It is just a difference of 56 and 25 respectively, so the numbers are really close. Sadly, this final step I wasn't able to find on the net, so I have to wait until I can visit the National Library in Bangkok to check out the corresponding issues of the NSO publication - I only have the 1960 Chiang Mai issue depicted above. If anyone has access to these publication and can find it for me it'd be nice. But since Thonburi had no TIS1099 geocode, I cannot get this into my XML style anyway.

For the older censuses I wasn't able to find the data for each province - while Statoids has numbers listed, the sum 17,256,840 given there is not the same as found in the NSO table, according to that the total population in the 1947 census was 17,442,689.