A quick update post to help get my latest project’s new dataset more readily indexed on Google search, etc. (Feb 8th 2021)
I’ve recently been working on risk assessment for COVID-19 in our 2nd wave. To create an email alert per province (taking account of local regional data) I needed to join provincial data together. It turns out that for much of Thailand’s publicly available government datasets (particularly in Office of Agricultural Economics, Land Department, etc) the data is summarised at Province level (i.e. is not GIS coordinate-based). Yet, there’s no mapping of province -> [neighbouring provinces] dataset out there (that I could find), so I created one the other night and wrote the code to verify and integrate it.
That dataset/code is now on github: https://github.com/pmdscully/thailand_province_border_adjacency
An obligatory requirement of using data relations (X->Y) is making a pretty visualisation on GraphViz, so dutifully — here it is: ^^ (Along with Wikipedia’s provincial public map for comparison..)
Q & A
Is it correct & up to date? Yes. The newest Thai province change was adding Bueng Kan, which was split-off from Nong Khai, effective on 23 March 2011 – that’s included; so it’s up-to-date as of Feb 2021. Bangkok is referred to as a Special Administrative Area, but it’s included as province in the mappings; giving a total of 77 entries.
Is it easy to use the mapping dataset by importing a Python module into my own software application? Yes, you can join province datasets together based on their semantic geo-neighbourhoods – 🙂
git clonethe repository,
download a province naming dataset,
import the python module,
- Write about 4 lines of code gives you a dictionary lookup (see the readme.md for full details).
I want to SQL join my provincial datasets together, but only for the provinces nextdoor, how can I do that? Yes, that’s precisely what this dataset and code is for. Before you create your SQL query,
- import the Python module (
- instantiate the ProvinceRelationsParser object,
- get the dictionary,
- perform the dictionary lookup on your key province, this will give you the list of neighbouring provinces.
- Simply plug those names into your SQL query and you are ready! (Find a code example in the readme.md).
Can I use Thai language (UTF-8) as my lookup and get neighbour results in Thai (UTF-8)? Short answer is yes. See the readme.md on the Github repo for full details with code samples.
Over to you
Feel free to check it out.