MyNixOS website logo
Description

Call the Bus Open Data Service ('BODS') API Through R.

A wrapper to allow users to download Bus Open Data Service 'BODS' transport information from the API (<https://www.bus-data.dft.gov.uk/>). This includes timetable and fare metadata (including links for full datasets), timetable data at line level, and real-time location data.

The goal of bodsr is to allow easy interface between the Bus Open Data Service (BODS) API and R. The BODS dataset provides fares, timetable and vehicle location information about bus services in England. Further details and documentation on the BODS API can be found here.

Installation

You can install the development version of bodsr from GitHub with:

install.packages("devtools")

devtools::install_github("department-for-transport-public/bodsr")

Usage

bodsr has a range of functions designed to make it easy for you to interrogate the BODS API and receive the results as R data objects.

To begin, you will need to create a BODS account and obtain your BODS access token. You can pass this to individual bodsr functions, or save it as an environmental variable called BODS_KEY which the functions will automatically check.

Fare and timetable metadata

The BODS API initially returns metadata about the fare and timetable data held. You can use this metadata to understand the data that is available, as well as locate download links to download full data sets.

The functions get_timetable_metadata() and get_fares_metadata() allow you to return records for timetable and fare metadata respectively. You can filter the records on a number of variables including:

For fares:

  • National Operator Codes
  • Status
  • Bounding box

For timetables:

  • National Operator Codes
  • Status
  • BODS compliance
  • Modified date
  • Admin area
  • Search terms

Check individual function documentation and BODS API help for further details on these variables.

Location data

Granular vehicle-level location data can be extracted from the API in two different formats (more detail of different data formats can be found here):

  • get_location_gtfs(): returns location data in GTFS-RT format
  • get_location_xml(): returns location data in SIRI-VM XML format

As for fare and timetable data, location data can be filtered on a range of parameters including location bounding box, provider, line and vehicle reference.

Timetable data

Once timetable metadata has been returned, this data can be provided to the get_timetable_data() function, which will parse the xml/zip files specified and return the timetable data as a list with one bus line per row and one dataframe per parsed file.

Please note that due to the size of the data files involved, queries using this function can be slow to run and use a large amount of RAM to perform.

Metadata

Version

0.1.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows