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...