Sunday, July 08, 2018

Seoul Bus Information - TOPIS (download, sqlite)

# -*- coding: utf-8 -*-
#+STARTUP: overview
#+LANGUAGE: ko
#+PROPERTY: header-args:sqlite :dir ~/pkg/map/topis/20180403/ :db topis.db :var rel="cur" :results line :colnames yes :exports results
: #+PROPERTY: header-args:sqlite :dir ~/org/ :db journal.db :var rel="cur" :results silent :colnames yes
: #+PROPERTY: Effort_ALL 0 0:10 0:20 0:30 1:00 2:00 4:00 6:00 8:00


* download
** 정류장
http://data.seoul.go.kr/dataList/datasetView.do?infId=OA-15067&srvType=F&serviceKind=1

http://opengov.seoul.go.kr/data/15223948

서울시 버스정류소 위치 데이터(20180502).xls

** 노선
http://topis.seoul.go.kr/refRoom/openRefRoom_3_1.do
201804_Bus_노선.xls

http://topis.seoul.go.kr/
교통정보 자료실 > 버스 운행노선 현황
홈 > 교통자료실 > 기타 정보 > 버스 운행노선 현황

http://topis.seoul.go.kr/refRoom/openRefRoom_1_2.do#
번호     제목     첨부     작성일     다운로드수
966    2017 11월 버스 운행노선 현황    첨부파일 있음    2017-12-22    52
965    2017 10월 버스 운행노선 현황    첨부파일 있음    2017-12-22    4

서울시 교통량 생성개요
수집기간 : 1년 365일, 24시간 (00 ~ 24시)
수집범위 : 주요간선도로 및 도시고속도로

    도심24개소
    시계36개소
    교량22개소
    간선54개소
    도시고속9개소

http://bus.go.kr/

순번    노선ID    정류소ID    노선번호    정류소명    정류소번호    Y좌표    X좌표    YX좌표
1    100100124    102000271    0017    청암자이아파트    03689    37.5345469961    126.9465552752    37.5345469961, 126.9465552752


* 다국어 버스노선
서울시 버스 정류소 노선도 다국어 목록 정보.xls

#+name: creating
#+begin_src sqlite :var tb="mlineinfo"
-- drop table if exists $tb;
create table $tb (
  sn int, -- 연번
  stid varchar(30), -- 정류소ID
  stnmkr varchar(50), -- 정류소명
  stnmen varchar(100), -- 정류소명
  stnmcn varchar(100), -- 정류소명
  stnmjp varchar(100), -- 정류소명
  note varchar(50) -- 유형
);
#+end_src

#+RESULTS: creating

#+name: insert
#+begin_src sqlite :var tb="mlineinfo"
insert into $tb values (0,'my id', 'my station','a-en' ,'a-cn', 'a-jp','note');
#+end_src

#+RESULTS: insert

#+begin_src sqlite :var tb="mlineinfo"
select count(*) from $tb;
#+end_src

#+RESULTS:
| count(*) |
|----------|
|        0 |

#+begin_src sqlite :var tb="mlineinfo"
delete from $tb;
#+end_src

#+RESULTS:



* lineinfo

-- 기존
업체명,노선번호,유형,
기점,종점,인가대수,
인가거리,운행시간,
운행횟수,최소,최대,
첫차시간,막차시간

company,line,types,
starting,ending,nums,
distance,taketime,
carsby,mimby,maxby,
stime,etime


-- 변경
업체명,노선번호,유형,
기점,종점,인가대수,
운행대수,예비대수, -- new added 2 column
인가거리,운행시간,
총운행횟수,최소,최대,
첫차시간,막차시간

#+name: creating
#+begin_src sqlite :var tb="lineinfo"
drop table $tb;
#+end_src

#+name: creating
#+begin_src sqlite :var tb="lineinfo"
-- drop table if exists $tb;
create table $tb (
  company varchar(50), -- 업체명
  line varchar(20), -- 노선번호
  types varchar(10), -- 유형
  starting varchar(50), -- 기점
  ending varchar(50), -- 종점
  nums int, -- 인가대수
  allocated int, -- 운행대수
  areserved int, -- 예비대수
  distance int, -- 인가거리
  taketime int, -- 운행시간
  carsby int, -- 운행횟수
  mimby int, -- 최소
  maxby int, -- 최대
  stime varchar(5), -- 첫차
  etime varchar(5) -- 막차시간
);
#+end_src
* station

#+name: creating - Year 2017
#+begin_src sqlite :var tb="station"
drop table if exists $tb;
create table $tb (
  sn integer, -- 순번
  lid int2, -- 노선ID
  stid int2, -- 정류소ID
  lnum varchar(10), -- 노선번호
  stname varchar(50), -- 정류소명
  stnum varchar(15), -- 정류소번호
  xpos varchar(20), -- Y좌표
  ypos varchar(20), -- X좌표
  xypos varchar(40) -- YX좌표
);
#+end_src


#+name: creating Year 2018
#+begin_src sqlite :var tb="station"
drop table if exists $tb;
create table $tb (
  sn integer, -- 순번 --> add excel -- o
  stid varchar(14), -- 정류소ID or 정류소번호 -- o
  stname varchar(50), -- 정류소명 --> o
  xpos varchar(20), -- Y좌표 o
  ypos varchar(20), -- X좌표 o
  xypos varchar(40) -- YX좌표 --> add
);
#+end_src

No comments:

Pranten

 Pranten