Skip to content

Commit 53f7c94

Browse files
committed
Move Bangkok transit code to here
1 parent 9fca42b commit 53f7c94

File tree

5 files changed

+9018
-0
lines changed

5 files changed

+9018
-0
lines changed

bangkok_transit/README.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Bangkok Transit
2+
3+
Scrape data from [transitbangkok.com](http://www.transitbangkok.com/) and put it online. Adding some tiny snippet for querying commute instruction.
4+
5+
### Usage
6+
7+
```python
8+
import transit
9+
stations = transit.read_stations('data/stations.csv')
10+
route_descriptions = transit.get_commute_instruction('บางรัก', 'สีลม', stations) # return route instruction
11+
```
12+
13+
**Output**
14+
15+
```python
16+
{'query_link': 'http://www.transitbangkok.com/showBestRoute.php?from=Bang+Rak+Market&to=Si+Lom&originSelected=false&destinationSelected=false&lang=en',
17+
'route_descrtions':
18+
[{'action': 'Walk by foot',
19+
'lines': [],
20+
'to': 'Sathorn/Saphan Taksin'},
21+
{'action': 'Public Transport',
22+
'lines': ['BTS - Silom Line', '76', '163', '164', '172', '177', '504', '544', '547'],
23+
'to': 'Sala Daeng'},
24+
{'action': 'Walk by foot',
25+
'lines': [],
26+
'to': 'Si Lom'}],
27+
'station_end':
28+
{'station_link': 'http://www.transitbangkok.com/stations/Bangkok%20Bus/Si%20Lom',
29+
'station_name': 'Si Lom',
30+
'station_thai_name': 'สีลม'},
31+
'station_start':
32+
{'station_link': 'http://www.transitbangkok.com/stations/Bangkok%20Bus/Bang%20Rak%20Market',
33+
'station_name': 'Bang Rak Market',
34+
'station_thai_name': 'ตลาดบางรัก'}
35+
}
36+
```
37+
38+
The output (if both stations start and end match with their database)
39+
will be list of instructions to go to the destination.

0 commit comments

Comments
 (0)