Analyzing Taipei’s Bus Network

This is an explanation of my blog article titled “Revealing Taipei’s Bus Labyrinth: Surprising Insights, Dynamics, and Details.” Here, I will provide information on the source of the original data, the modifications made to the data, and the process involved in creating the maps and graphs showcased in the blog article. If you haven’t read the blog article yet, please click the link above.

Data sources

The original data was downloaded from on February 5, 2023. The bus lines and bus stops in Taipei City are provided as ESRI shapefiles (*.shp). Here are the direct links to the files:

Please note that these files may be subject to updates, and the version you find might differ from the version I used.

Data cleaning and data enrichment

The first issue with the data files was that they used different coordinate reference systems (CRS). The shapefile for the bus stops was in WGS84, but the shapefile for the bus lines was in TWD97 (Taiwanese reference system). I used QGIS to reproject both files to WGS84/Pseudo Mercator, aligning them with other shapefiles of Taipei that I already had.

The next step involved cleaning up and enriching the data, which was done specifically for the bus lines. The original file only had two columns: one for an ID number and another for the bus line number, which was written in Chinese. Some entries were truncated and displayed an invalid character (a black diamond with a question mark). It was unclear whether this issue occurred during the export of the files by the provider or if it was related to text encoding. Nevertheless, this problem was addressed in the subsequent steps.

Chinese names and numbering systems for bus lines were translated into English or adapted to the English notation commonly used on buses in Taipei. For example, “303區間車” became “303 shuttle.” Additionally, a column for bus line types was added, with the information retrieved from the Wikipedia page that lists all bus lines in Taipei:

Two additional columns were added, containing information about the bus line operator and the parent company of the operator. The information was gathered through research, utilizing various Chinese Wikipedia articles focused on the bus system in Taipei.

Finally, in QGIS, the length of each bus line was calculated using the field calculator (Ctrl + i) after accessing the attribute table (F6). The formula $length was utilized to determine the length of a linestring. However, it is important to note that the bus lines in the shapefile form a loop, starting from the departure station, passing through various stops until the terminal station, and returning to the departure station. Consequently, the resulting length had to be divided by 2 to account for this looped path.

During this process, only bus lines belonging to the types Regular, MRT Shuttle, Small bus, Express bus, Mainline, and Minibus were retained, while all other bus lines were removed. As a result, the dataset was reduced from 506 entries to 393.

Maps and Analysis

All maps presented in the blog article were created using QGIS. The initial map, illustrating bus lines by type, was generated by employing categorized symbology and assigning one category per map. The bus line density map was created using the “line density” tool from the toolbox.

The final map, showcasing the density of bus lines by operator, entailed a slightly more intricate process. I utilized the “sum line length” tool from the toolbox to calculate the number of bus lines per village. In this case, villages represent the smallest administrative units in Taiwan, and I utilized a shapefile containing village boundaries for Taipei City. Essentially, I tallied the number of lines per village for each bus company, consolidating this data into a single table from which the maps were generated.

Concluding remarks

In conclusion, our exploration of Taipei City’s bus network has uncovered fascinating insights through meticulous data analysis. From reprojecting shapefiles to enriching the information and creating detailed maps, we have delved into the dynamics and details of this densely interconnected system.

By examining the distribution of bus lines, the roles of different operators, and the calculation of line lengths, we have gained a deeper understanding of the complexity and significance of Taipei’s bus network. However, it is important to note that the data presented may not be complete and could contain errors.

Through this exploration, we hope to have shed light on the intricate nature of Taipei’s bus network and sparked further curiosity in understanding the intricacies of urban transportation systems.

Thank you for joining us on this enlightening journey through Taipei City’s bus network, where data analysis has revealed a wealth of valuable insights and provided a deeper appreciation for this essential mode of transportation.

If you like this content and don’t want to miss new blog posts, consider subscribing to our newsletter!