Last active
March 28, 2020 05:17
-
-
Save ycrack/280aa34bf02eacc3c3f5ca5045b6a57a to your computer and use it in GitHub Desktop.
ODPTdump
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| TOKEN='YOUR_ACCESS_TOKEN' | |
| ENDPOINT='https://api.odpt.org/api/v4/' | |
| COMMON_DATAS=("odpt:Calendar" "odpt:Operator") | |
| TRAIN_DATAS=("odpt:Station" "odpt:StationTimetable" "odpt:TrainTimetable" "odpt:TrainType" "odpt:RailDirection" "odpt:Railway" "odpt:RailwayFare" "odpt:PassengerSurvey") | |
| BUS_DATAS=("odpt:BusTimetable" "odpt:BusroutePattern" "odpt:BusroutePatternFare" "odpt:BusstopPole" "odpt:BusstopPoleTimetable") | |
| AIRPLANE_DATAS=("odpt:Airport" "odpt:AirportTerminal" "odpt:FlightSchedule" "odpt:FlightStatus") | |
| GetCommonData() { | |
| for COMMON_DATA in ${COMMON_DATAS[@]}; do | |
| aria2c -o ${COMMON_DATA}.json "${ENDPOINT}${COMMON_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetTrainData() { | |
| for TRAIN_DATA in ${TRAIN_DATAS[@]}; do | |
| aria2c -o ${TRAIN_DATA}.json "${ENDPOINT}${TRAIN_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetBusData() { | |
| for BUS_DATA in ${BUS_DATAS[@]}; do | |
| aria2c -o ${BUS_DATA}.json "${ENDPOINT}${BUS_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetAirplaneData() { | |
| for AIRPLANE_DATA in ${AIRPLANE_DATAS[@]}; do | |
| aria2c -o ${AIRPLANE_DATA}.json "${ENDPOINT}${AIRPLANE_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetCommonData | |
| GetTrainData | |
| GetBusData | |
| GetAirplaneData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ### ### | |
| # Floating Population Data (AGOOP Corp.) # | |
| # Data Duration: 20181001 - 20190930 # | |
| # Started at: 2020-02-17 # | |
| ### ### | |
| TOKEN='YOUR_ACCESS_TOKEN' | |
| AGOOP_URLBASE='https://api-tokyochallenge.odpt.org/api/v4/files/Agoop/data/' | |
| append() { | |
| # $1=url $2=out | |
| echo -e "$1\\n out=$2" >> _list.txt | |
| } | |
| CreateListPDP() { | |
| # separate by analysis type (in this case is PDP) | |
| if [ ! -d "PDP" ]; then mkdir PDP; fi | |
| cd ./PDP | |
| if [ ! -f "_list.txt" ]; then touch _list.txt; fi | |
| # Summary | |
| append "${AGOOP_URLBASE}Summary.csv?acl:consumerKey=${TOKEN}" "Summary.csv" | |
| # Data | |
| for y in 2018 2019; do | |
| if [ ${y} = 2018 ]; then m_list=(10 11 12); else m_list=(01 02 03 04 05 06 07 08 09); fi | |
| for m in ${m_list[@]}; do | |
| # 月別の日数設定 | |
| if [ ${m} = 2 ]; then ed=28; fi | |
| if [ ${m} = 4 -o ${m} = 6 -o ${m} = 9 -o ${m} = 11 ]; then ed=30; else ed=31; fi | |
| for d in $(seq -w ${ed}); do | |
| for h in {0..23}; do | |
| append "${AGOOP_URLBASE}PDP_${y}${m}${d}_${h}.csv?acl:consumerKey=${TOKEN}" "PDP_${y}${m}${d}_${h}.csv" | |
| done | |
| done | |
| done | |
| done | |
| # Master (Shift-JIS) | |
| append "${AGOOP_URLBASE}prefcode_citycode_master_SJIS.csv?acl:consumerKey=${TOKEN}" "prefcode_citycode_master_SJIS.csv" | |
| # Master (UTF-8) | |
| append "${AGOOP_URLBASE}prefcode_citycode_master_UTF-8.csv?acl:consumerKey=${TOKEN}" "prefcode_citycode_master_UTF-8.csv" | |
| cd ../ | |
| } | |
| CreateListMDP() { | |
| # separate by analysis type (in this case is MDP) | |
| if [ ! -d "MDP" ]; then mkdir MDP; fi | |
| cd ./MDP | |
| if [ ! -f "_list.txt" ]; then touch _list.txt; fi | |
| # Data | |
| for y in 2018 2019; do | |
| if [ ${y} = 2018 ]; then m_list=(10 11 12); else m_list=(01 02 03 04 05 06 07 08 09); fi | |
| for m in ${m_list[@]}; do | |
| for df in 0 1 2; do # note: df -> dayflag | |
| for h in {0..23}; do | |
| append "${AGOOP_URLBASE}MDP_${y}${m}_${df}_${h}.csv?acl:consumerKey=${TOKEN}" "MDP_${y}${m}_${df}_${h}.csv" | |
| done | |
| done | |
| done | |
| done | |
| # Mesh Attributes | |
| for y in 2018 2019; do | |
| for dist in 80k 10k 1k 500m 100m 50m; do # note: maybe 50m only | |
| append "${AGOOP_URLBASE}attribute_mesh${dist}_${y}.csv?acl:consumerKey=${TOKEN}" "attribute_mesh${dist}_${y}.csv" | |
| done | |
| done | |
| # Master | |
| append "${AGOOP_URLBASE}prefcode_citycode_master.csv?acl:consumerKey=${TOKEN}" "prefcode_citycode_master.csv" | |
| cd ../ | |
| } | |
| download() { | |
| aria2c --input-file=_list.txt -x5 | |
| } | |
| GetPDP() { | |
| CreateListPDP | |
| if [ -d "PDP" ]; then | |
| cd ./PDP && download | |
| fi | |
| } | |
| GetMDP() { | |
| CreateListMDP | |
| if [ -d "MDP" ]; then | |
| cd ./MDP && download | |
| fi | |
| } | |
| GetPDP | |
| GetMDP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| TOKEN='YOUR_ACCESS_TOKEN' | |
| ENDPOINT='https://api-tokyochallenge.odpt.org/api/v4/' | |
| COMMON_DATAS=("odpt:Calendar" "odpt:Operator") | |
| TRAIN_DATAS=("odpt:Station" "odpt:StationTimetable" "odpt:TrainTimetable" "odpt:TrainType" "odpt:RailDirection" "odpt:Railway" "odpt:RailwayFare" "odpt:PassengerSurvey") | |
| BUS_DATAS=("odpt:BusTimetable" "odpt:BusroutePattern" "odpt:BusroutePatternFare" "odpt:BusstopPole" "odpt:BusstopPoleTimetable") | |
| AIRPLANE_DATAS=("odpt:Airport" "odpt:AirportTerminal" "odpt:FlightSchedule" "odpt:FlightStatus") | |
| GetCommonData() { | |
| for COMMON_DATA in ${COMMON_DATAS[@]}; do | |
| aria2c -o ${COMMON_DATA}.json "${ENDPOINT}${COMMON_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetTrainData() { | |
| for TRAIN_DATA in ${TRAIN_DATAS[@]}; do | |
| aria2c -o ${TRAIN_DATA}.json "${ENDPOINT}${TRAIN_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetBusData() { | |
| for BUS_DATA in ${BUS_DATAS[@]}; do | |
| aria2c -o ${BUS_DATA}.json "${ENDPOINT}${BUS_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetAirplaneData() { | |
| for AIRPLANE_DATA in ${AIRPLANE_DATAS[@]}; do | |
| aria2c -o ${AIRPLANE_DATA}.json "${ENDPOINT}${AIRPLANE_DATA}.json?acl:consumerKey=${TOKEN}" | |
| done | |
| } | |
| GetCommonData | |
| GetTrainData | |
| GetBusData | |
| GetAirplaneData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ### ### | |
| # Tag information for indoor positioning # | |
| ### ### | |
| TOKEN='YOUR_ACCESS_TOKEN' | |
| ENDPOINT='https://api-tokyochallenge.odpt.org/api/v4/files' | |
| AVAILABLES=( | |
| "JREast_Shinagawa" | |
| "JREast_Shinjuku" | |
| "JREast_Yurakucho" | |
| "JREast_Tokyo" | |
| "JREast_Ikebukuro" | |
| "Odakyu_Shinjuku" | |
| "TokyoMetro_Nijubashimae" | |
| "TokyoMetro_Otemachi" | |
| "TokyoMetro_Shinjuku" | |
| "TokyoMetro_Hibiya" | |
| "TokyoMetro_Yurakucho" | |
| "TokyoMetro_Tokyo" | |
| "TokyoMetro_Higashiginza" | |
| "TokyoMetro_Ikebukuro" | |
| "TokyoMetro_Ginza" | |
| ) | |
| append() { | |
| # $1=url $2=out | |
| echo -e "$1\\n out=$2" >> _list.txt | |
| } | |
| CreateList() { | |
| if [ ! -d "IndoorPosTag" ]; then mkdir IndoorPosTag; fi | |
| cd ./IndoorPosTag | |
| if [ ! -f "_list.txt" ]; then touch _list.txt; fi | |
| for STATION in ${AVAILABLES[@]}; do | |
| append "${ENDPOINT}/MLIT/IndoorPosTag/${STATION}_IndoorPosTag.csv?acl:consumerKey=${TOKEN}" "${STATION}.csv" | |
| done | |
| cd ../ | |
| } | |
| download() { | |
| CreateList | |
| if [ -d "IndoorPosTag" ]; then | |
| cd ./IndoorPosTag && aria2c --input-file=_list.txt -x5 | |
| fi | |
| } | |
| download |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment