# Taiwan Power Company grid

The Taiwan Power Company grid is significant in that it presents a freely available "poorman's GPS" on every power pole and switch box in Taiwan, and could be readily incorporated into projects like Openstreetmap as a supplemental grid. Here we present how to convert the Taiwan Power Company grid into Taiwan datums thus ultimately connecting it to worldwide coordinate systems.

Unlike some proprietary systems the algorithm is open and you can memorize it and use pencil and paper to do your conversions. No need to wait for the electric company's office hours to ask for help.

## 電力座標與TWD67 2度TM座標的換算公式 Taiwan Power Company grid and TM-2 relationship

### 總攬 Overview

Figure 1. G8150 HD78

```G  is a 80 × 50 km rectangle 如圖二 see figure 2.
PP increments by 1, every 800 m eastward,  00-99
QQ increments by 1, every 500 m northward, 00-99
R  increments by 1, every 100 m eastward,  A=0...H=7
S  increments by 1, every 100 m northward, A=0...E=4
T  increments by 1, every 10  m eastward,  0-9
U  increments by 1, every 10  m northward. 0-9
```

```V increments by 1, every 1 m eastward,  0-9
W increments by 1, every 1 m northward, 0-9
```

Let's take a deeper look at that TaiPower pole number plate. Again, the last two lines of that plate, G8150 HD78, are the coordinates. We can convert them to TM-2 coordinates, version TWD67, one of the common systems found on Taiwan maps, don't confuse them. Let's take a look at the meaning of each of those numbers.

### A-Z 區 areas

Figure 2. Taiwan: TM-2 TWD67 grid with TaiPower 80×50km area letters

Figure 2. As we see, TaiPower has divided Taiwan into 80 km wide, 50 km tall lettered rectangular sectors. For instance, Taizhong County, Dongshi Township, which lies in the G sector.

### 800×500m

Figure 3. Location of G8150 inside G sector

Figure 3. This G sector is divided up into 10000 charts back at the electric company office. Each covers 800 * 500 meters. The west edge of sector G is at x=170000 meters East. The south edge is at y=2650000 meters North. The west edge of the 8150th chart is at x=170000mE+81*800m=234800mE, the south edge is at y=2650000mN+50*500m=2675000mN. Now we understand the meaning of G8150.

### 100×100m

Figure 4. Breakdown of area 8150 from AA to HE

Figure 4. This 8150th sector is further given ABCDEFGH grids, going west to east, each 100 meters apart; ABCDE grids south to north, each 100 meters apart.

As can be seen, TaiPower grid HD area's southwest corner lies 700 meters east of the west edge of box 8150, and lies 300 meters north of the south edge of box 8150. Note, A=0, B=100, C=200...

### 10×10m

Figure 5. Position of 78 inside G8150 HD

Figure 5. Next, the "78" portion of the grid has its southwest corner at 7*10=70 meters east of the west edge of area HD, and 8*10=80 meters north of the south edge of HD.

### 總合 Summing up

Summing up the above, power co. pole/box grid number G8150 HD78's TM-2 grid value is:

``` 170000+81*800+(8-1)*100+7*10 =  235570 meters East  米東
2650000+50*500+(4-1)*100+8*10 = 2675380 meters North 米北
```

The smallest unit of our grid is still a 10*10 meter square, but that ought to be small enough for, say, a traveler to find his spot on maps.

### 1×1m

In cities, where electrical line density is high, we can often find box and pole labels with an additional two digits, e.g. G8150 HD7812, which means add 1 meter east and 2 meters north to the above result. Indeed, the dense part of cities have tall buildings, hindering Global Positioning System (GPS) reception, so with one meter accuracy, it seems we do better than the basic hand held GPS in this case…

### 400x250 圖 maps

```+----+----+500
| A  | B  |
+----+----+250
| C  | D  |
+----+----+0
0   400  800
```

```#!/usr/bin/perl
while (<>) {
unless (/[A-H][A-E]\d\d/) { print "Invalid: \$_"; next; }
my \$x = 0 + /[E-H][A-E]/;
my \$y = 0 + ( /[A-H][AB]/ || /[A-H]C[0-9][0-4]/ );
my \$c = chr( ord('A') + oct("0b\$y\$x") );
s/ /\$c /;
print;
}
```

## 街景例 Street View Examples

### 台灣 Taiwan

```\$ echo G8152 FC56 | taipowergrid
#1 G8152 FC56
235350 2676260
\$ echo 235350 2676260 | cs2cs -f %.7f +proj=tmerc +lon_0=121 +k=0.9999 +x_0=\$((250000-828)) +y_0=207
120.8639458	24.1898278 0.0000000
```

```\$ echo G8152 FC56 | taipowergrid | proj -I +init=epsg:3828 | cs2cs -f %.6f +init=epsg:4236 +to +init=epsg:3824
#1 G8152 FC56
120.8639476	24.1898534 20.6759462
```

```use Math::Trig qw(great_circle_distance deg2rad);
sub NESW { deg2rad( \$_[0] ), deg2rad( 90 - \$_[1] ) }
my @L = NESW( 120.8639476, 24.1898534 );
my @T = NESW( 120.8639458, 24.1898278 );
print great_circle_distance( @L, @T, 6378137 );
2.85599755549883
```

```\$ echo B0000 AA00 | taipowergrid | proj -I +init=epsg:3828 | cs2cs -f %.6f +init=epsg:4236 +to +init=epsg:3824
#1 B0000 AA00
121.008200	24.855717 20.319216
```

#### 反之 Reversing

```\$ echo 120.8639458 24.1898278 | cs2cs -I -f %.0f +proj=tmerc +lon_0=121 +k=0.9999 +x_0=\$((250000-828)) +y_0=207
235350	2676260 0
\$ echo 235350 2676260 | taipowergrid
#1 235350 2676260
G8152 FC5600
```
```<<EOF cs2cs -I +init=epsg:4236 +to +init=epsg:3824 | \
proj -f %.0f +init=epsg:3828 | perl -awle 'print "@F[0,1]"' | taipowergrid
120.863948 24.189853
121 24
EOF
#1 235350 2676260
G8152 FC5600
#2 249171 2655228
G9810 HC7218
```

### 澎湖 Penghu

```+------+2664000
|  X   |
|      |
+------+2614000
|  Y   |
|      |
+------+2564000
275000 355000
```

#### 例 Examples

```\$ echo  Y4087 DD1053 | taipowergrid
#1 Y4087 DD1053
307315 2607803 119
\$ echo 307315 2607803 | cs2cs -f %.7f +proj=tmerc +lon_0=119 +k=0.9999 +x_0=\$((250000-828)) +y_0=207
119.5695971	23.5706975 0.0000000
```

### 金門 Jinmen

```+------+------+2725800
|  Z   |  Z   |
|      |      |
+------+------+2675800
10000 90000 170000
```

#### 例 Examples

1. 參數由 2015 年 12 月詢問台電包商。 The parameters come from 2015/12 conversations with Taipower's contractors. 係他們發現較適用之參數， 絕非任何原始定義之意！ They are just ones they discovered get the conversion done pretty well. They are in no way any kind of original official definition! ```\$ echo Z0054 EC0222 | taipowergrid \$ echo 90402 2703022 | cs2cs -f %.7f +proj=tmerc +lon_0=117 +ellps=intl +x_0=-42160 +y_0=-205 +k=0.9996 +towgs84=-637,-549,-203 +to +proj=longlat +ellps=WGS84 +towgs84=0,0,0 118.3157370 24.4349832 ```
2. Z1856 FC34

### 馬祖 Mazu

```+------+2944000
|  S   |
|      |
+------+2894000
10000 90000
```

`cs2cs +proj=tmerc +lon_0=117 +ellps=intl +x_0=-279825 +y_0=20830 +k=0.9996 +towgs84=-637,-549,-203 +to +proj=longlat +ellps=WGS84 +towgs84=0,0,0`

#### 新桿設牌 Calculating new pole labels

` \$ echo 119.9589775 26.1653413 | cs2cs -I +proj=tmerc +lon_0=117 +ellps=intl +x_0=-279825 +y_0=20830 +k=0.9996 +towgs84=-637,-549,-203 +to +proj=longlat +ellps=WGS84 +towgs84=0,0,0`

```15149.56	2918400.53 -2.31
```

`\$ echo 15149 2918400 | taipowergrid`

```#1 15149 2918400
S0648 DE4090
```

## 提醒 Notices

Grid numbers might be on front or cement base of switch boxes.

All of the switch boxes we've seen have grid numbers, but sometimes you have to look at the cement foundation, as well as the front. The poles on the other hand vary. Some districts only have older poles whose labels lack coordinates.

## 警告 Warnings

Taiwan datums#混淆 TWD67, TWD97 易耽誤救援 confusion can delay rescues: 台電電力座標採TWD67,非TWD97! Taiwan Power Company grid uses TWD67, not TWD97!

Taiwan Power Company grid is not an exact system. It was intended for internal company property management. Sometimes it might be in error several hundred meters -- so then use GPS. Also beware of reused poles still bearing the labels from their former positions. Thus one should check neighboring pole labels for consistency. In any case when using it to report positions, also include names of neighboring roads, etc.