Taipei Metro Data to Drawing Data Converter
Convert simple Taipei Metro station and line data into structured drawing data with coordinates, colors, and paths for map rendering.
About
Transit map rendering requires precise drawing data: station coordinates on an orthogonal grid, line paths as polyline segments snapped to 45° or 90° angles, color codes per line, and label offsets to avoid overlap. Manually assembling this from raw station lists is error-prone. A misplaced coordinate shifts an entire branch. A wrong color hex breaks visual line identity. This tool parses simplified Taipei Metro definitions - station names, line assignments, ordering, and optional coordinates - and outputs structured drawing data (JSON) containing x, y positions, RGB stroke values, connection paths, and text anchor points ready for Canvas or SVG renderers.
The converter handles all 6 main MRT lines (Brown, Red, Green, Orange, Blue, Yellow) plus airport and circular segments. When coordinates are omitted, an auto-layout engine places stations on a schematic grid at 60px intervals, routing lines along cardinal and diagonal axes. Transfer stations are detected automatically when a station name appears on multiple lines. The output format is deterministic: identical input always produces identical drawing data, making it suitable for version-controlled map assets.
Formulas
Station positions on the schematic grid are computed when explicit coordinates are absent. Each station Si on line L receives a position:
Where x0, y0 is the starting anchor of the line segment, Δx = Δy = 60px (grid spacing), i is the station index along that segment, and θ ∈ {0°, 45°, 90°, 135°, 180°, 225°, 270°, 315°}.
Transfer stations are detected by name collision across lines. When station name N appears in lines La and Lb, both line paths converge to a single coordinate, and the station object gains a transfer: TRUE flag. The drawing radius increases from 6px to 9px and fill becomes #FFFFFF with a 2px black stroke.
Label anchor offset is computed as: labelX = x + 12 ⋅ cos(θ + 90°), labelY = y + 12 ⋅ sin(θ + 90°). This places the label perpendicular to the line direction.
Reference Data
| Line Code | Line Name | Color | Hex | Stations | Opened | Length (km) | Terminal A | Terminal B |
|---|---|---|---|---|---|---|---|---|
| BR | Wenhu (Brown) | █ | #C48C31 | 24 | 1996 | 25.7 | Taipei Zoo | Nangang Exhibition Center |
| R | Tamsui-Xinyi (Red) | █ | #E3002C | 33 | 1997 | 32.3 | Tamsui | Xiangshan |
| G | Songshan-Xindian (Green) | █ | #008659 | 20 | 1999 | 21.3 | Songshan | Xindian |
| O | Zhonghe-Xinlu (Orange) | █ | #F8B61C | 25 | 1998 | 31.5 | Luzhou | Nanshijiao |
| BL | Bannan (Blue) | █ | #0070BD | 23 | 1999 | 28.2 | Dingpu | Nangang Exhibition Center |
| Y | Circular (Yellow) | █ | #FFDB00 | 14 | 2020 | 15.4 | Dapinglin | Xinbeitou |
| A | Taoyuan Airport MRT | █ | #954688 | 22 | 2017 | 51.0 | Taipei Main | Taoyuan Airport T2 |
| LG | Xiaobitan Branch (Green) | █ | #CFDB00 | 1 | 2004 | 1.9 | Qizhang | Xiaobitan |
| R-XB | Xinbeitou Branch (Red) | █ | #F090A0 | 1 | 1997 | 1.2 | Beitou | Xinbeitou |
| - | Transfer Station | █ | #FFFFFF | - | - | - | Rendered as larger circle with white fill + black stroke | |
| Drawing Defaults | ||||||||
| Grid Spacing | 60px | |||||||
| Station Radius | 6px (normal) / 9px (transfer) | |||||||
| Line Stroke Width | 8px | |||||||
| Label Font Size | 11px | |||||||
| Allowed Angles | 0°, 45°, 90°, 135°, 180°, 225°, 270°, 315° | |||||||
Frequently Asked Questions
::, followed by station entries as STATION: or STATION::: for explicit coordinates. Transfer stations are detected automatically when identical station names appear on multiple lines. Comments start with # and blank lines are ignored.