All Projects → juliuste → korail

juliuste / korail

Licence: ISC license
Client for the South Korean korail railway API.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to korail

comboios
Comboios de Portugal (CP, Portugese Railways) API client.
Stars: ✭ 32 (-31.91%)
Mutual labels:  railway, public-transport
db-prices
Find journey prices using the DB Sparpreise API.
Stars: ✭ 82 (+74.47%)
Mutual labels:  railway, public-transport
interrail
Find european train stations and routes. Client for the European Interrail / EuRail API.
Stars: ✭ 24 (-48.94%)
Mutual labels:  railway, public-transport
oebb
Austrian Federal Railways (ÖBB) API client.
Stars: ✭ 40 (-14.89%)
Mutual labels:  railway, public-transport
sdk
🔧 TypeScript SDK for Entur APIs
Stars: ✭ 36 (-23.4%)
Mutual labels:  public-transport
Next-Station-iOS
Source code of Next Station iOS app, available on App Store for downloading.
Stars: ✭ 15 (-68.09%)
Mutual labels:  railway
transport-apis
machine-readable list of transport API endpoints
Stars: ✭ 32 (-31.91%)
Mutual labels:  public-transport
gtfstools
General Transit Feed Specification (GTFS) Editing and Analysing Tools
Stars: ✭ 31 (-34.04%)
Mutual labels:  public-transport
Railroad and Obstacle detection
This program detect and identify obstacle on railway. If program detect some obstacle that train must stop, program gives you warning sign. This program Also estimate riskiness of obstacle how it is negligible or not. We provide many models to you to detect railways and obstacles.
Stars: ✭ 14 (-70.21%)
Mutual labels:  railway
3D-Public-Transport-Simulator
The 3D Public Transport Simulator is a Unity-based simulation, which uses OpenStreetMap data in order to support the simulation of worldwide locations. The development was part of a Bachelor thesis.
Stars: ✭ 87 (+85.11%)
Mutual labels:  public-transport
cli
Railway CLI
Stars: ✭ 167 (+255.32%)
Mutual labels:  railway
github client
Open source bot telegram menggunakan bahasa code dart
Stars: ✭ 24 (-48.94%)
Mutual labels:  railway
linked-connections-server
Express based server that exposes Linked Connections.
Stars: ✭ 12 (-74.47%)
Mutual labels:  public-transport
waline
💬 A Simple, Safe Comment System
Stars: ✭ 1,145 (+2336.17%)
Mutual labels:  railway
raptor
Implementation of the Route Based Public Transit Algorithm (Raptor)
Stars: ✭ 64 (+36.17%)
Mutual labels:  public-transport
tripkit
Swift library for querying data from public transport providers.
Stars: ✭ 50 (+6.38%)
Mutual labels:  public-transport
grafikon
Timetables for model railway. Useful for meets with modules (like FREMO, Free-mo etc).
Stars: ✭ 19 (-59.57%)
Mutual labels:  railway
fastgtfs
A pure Rust library that provides GTFS parsing, navigation, time table creation, and real-time network simulation.
Stars: ✭ 21 (-55.32%)
Mutual labels:  public-transport
matsim-sbb-extensions
matsim swiss rail
Stars: ✭ 23 (-51.06%)
Mutual labels:  public-transport
european-transport-operators
NOT UP-TO-DATE ANYMORE, UNMAINTAINED. CHECK european-transport-feeds INSTEAD. List of european long-distance transport operators, available API endpoints, GTFS feeds and client modules.
Stars: ✭ 47 (+0%)
Mutual labels:  public-transport

korail

JavaScript client for the South Korean 🇰🇷 korail railway API. Inofficial, using korail endpoints. Ask them for permission before using this module in production.

This module conforms to the FPTI-JS 0.3.2 standard for JavaScript public transportation modules.

npm version Build Status license fpti-js version chat on gitter

Installation

npm install korail

Usage

const korail = require('korail')

The korail module conforms to the FPTI-JS 0.3.2 standard for JavaScript public transportation modules and exposes the following methods:

Method Feature description FPTI-JS 0.3.2
stations.all([opt]) All stations of the Korail network, such as 서울, 부산 or 목포 yes
journeys(origin, destination, [opt]) Journeys between stations yes
tripStopovers(tripId) All stopovers for a trip (all stations a given train passes) no

stations.all([opt])

Get all stations of the Korail network, such as 서울, 부산 or 목포. See this method in the FPTI-JS 0.3.2 spec.

Supported Options

There currently aren't any supported options for this method, but this might change in a future release.

Example

const korail = require('korail')
const stationStream = korail.stations.all()

stationStream.on('data', item => {
    // item is an FPTF station object
    console.log(item)
})
{
    type: "station",
    id: "0001",
    name: "서울",
    location: {
        type: "location",
        longitude: 126.9708191,
        latitude: 37.551856
    },
    group: "7",
    major: "1"
}

journeys(origin, destination, [opt])

Find journeys between stations. See this method in the FPTI-JS 0.3.2 spec.

Supported Options

Attribute Description FPTI-spec Value type Default
when Journey date, synonym to departureAfter Date new Date()
departureAfter List journeys with a departure (first leg) after this date Date new Date()
results Max. number of results returned Number null
interval Results for how many minutes after when/departureAfter Number null
transfers Max. number of transfers Number null
product Filter journey for specific train type Enum (String) KTX, 새마을, 무궁화 (includes 누리로), 청춘

Please note that this module fetches a list of stations using the stations.all() method upon initialization, which takes about 3-4 seconds.

Example

const seoul = '0001' // station id
const busan = { // FPTF station
	type: 'station',
	id: '0020'
	// …
}
korail.journeys(seoul, busan, { when: new Date('2019-06-27T05:00:00+0200'), product: 'KTX', transfers: 0 }).then()
{
    type: "journey",
    id: "0001-2019-06-27t12-00-00-000-09-00-0020-2019-06-27t14-42-00-000-09-00-ktx-127",
    legs: [
        {
            origin: {
                type: "station",
                id: "0001",
                name: "서울",
                location: {
                    type: "location",
                    longitude: 126.9708191,
                    latitude: 37.551856
                },
                group: "7",
                major: "1"
            },
            destination: {
                type: "station",
                id: "0020",
                name: "부산",
                location: {
                    type: "location",
                    longitude: 129.0415717,
                    latitude: 35.1150906
                },
                group: "6",
                major: "21"
            },
            departure: "2019-06-27T12:00:00.000+09:00",
            arrival: "2019-06-27T14:42:00.000+09:00",
            mode: "train",
            public: true,
            operator: {
                type: "operator",
                id: "korail",
                name: "korail",
                url: "https://www.letskorail.com"
            },
            line: {
                type: "line",
                id: "127",
                name: "KTX 127",
                product: {
                    id: "100",
                    name: "KTX"
                },
                mode: "train",
                operator: {
                    type: "operator",
                    id: "korail",
                    name: "korail",
                    url: "https://www.letskorail.com"
                }
            },
            tripId: "127###20190627"
        }
    ],
    price: {
        amount: 59800,
        currency: "KRW"
    }
}

tripStopovers(tripId)

All stopovers for a given trip (all stations a given train passes). Obtain a tripId using the journeys(origin, destination, [opt]) method. Returns a Promise that resolves in a list of stopovers.

Example

const tripId = '127###20190627' // taken from the journeys example above
korail.tripStopovers(tripId).then()
[
    {
        type: "stopover",
        stop: {
            type: "station",
            id: "0001",
            name: "서울"
        },
        arrival: null,
        departure: "2019-06-27T12:00:00.000+09:00"
    },
    {
        type: "stopover",
        stop: {
            type: "station",
            id: "0501",
            name: "광명"
        },
        arrival: "2019-06-27T12:15:00.000+09:00",
        departure: "2019-06-27T12:16:00.000+09:00"
    },
    {
        type: "stopover",
        stop: {
            type: "station",
            id: "0502",
            name: "천안아산"
        },
        arrival: "2019-06-27T12:37:00.000+09:00",
        departure: "2019-06-27T12:39:00.000+09:00"
    },
    // …
    {
        type: "stopover",
        stop: {
            type: "station",
            id: "0020",
            name: "부산"
        },
        arrival: "2019-06-27T14:42:00.000+09:00",
        departure: null
    }
]

Contributing

If you found a bug or want to propose a feature, feel free to visit the issues page.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].