Giter Site home page Giter Site logo

gtfs_to_igraph's Introduction

gtfs_to_igraph

This repo presents a function convert a GTFS feed (or a list of GTFS feeds) into an igraph object for network analysis in R.

Workflow

The workflow of the function is as follows:

  • Step 0: Read the GTFS data into memory
  • Steps 1 to 3: Identify and merge stops that are closer than a distance threshold (meters). This threshold is set by the user
  • Step 4: Identify transport modes, route and service level for each trip
  • Step 5: Indentify links between stops
  • Step 6: Build igraph. As it stants, the script returns a graph weighted by route frequecy
  • Step 7 (optional): the script creates a subdirectory and saves the input files to use in MuxViz

Input

This function needs three inputs:

  • list with one or more files gtfs.zip
  • a distance threshold set in meters
  • a logic value indicating whether you want to save input files to use latter in MuxViz

obs. This function was tested using the GTFS of Las Vegas, USA, downloaded on Oct. 2017. This file is made available in the GitHub repo but it can also be downloaded by running this line in R:

download.file(url="http://rtcws.rtcsnv.com/g/google_transit.zip", destfile = "google_transit.zip")

How to use the function

# set working Directory
  setwd("R:/Dropbox/github/gtfs_to_igraph")

# get a list of GTFS.zip files
  my_gtfs_feeds <- list.files(path = ".", pattern =".zip", full.names = T)

# load function
  source("gtfs_to_igraph.R")

# run function
  g <- gtfs_to_igraph(list_gtfs = my_gtfs_feeds,  dist_threshold =30 , save_muxviz =T)

Next steps: looking for collaborators :)

  • Allow the option whether graph is weighted by route frequency or by travel time
  • Allow the option to build a multilayer network where each (route? or each transport mode?) is a different layer

Related projects which I still need to learn from:

gtfs_to_igraph's People

Contributors

rafapereirabr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.