Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 1.78 KB

README.md

File metadata and controls

57 lines (37 loc) · 1.78 KB

gtfs.edn

Build Status Clojars Project

The General Transit Feed Specification (GTFS) as pure edn data

Original data taken from https://github.com/google/transit

This is a convenience tool for those who would like to work with GTFS data but dont want to manually recreate it.

Usage

This project can be used in two ways:

  • as a Clojure(script) library

This is very useful if you want to work with this data in your code. There are several convenience functions exposed through the hiposfer.gtfs.edn namespace.

(ns my.namespace
  (:require [hiposfer.gtfs.edn :as gtfs])) 

;; fetch the reference gtfs spec first
;; ONLY for clojure -> in clojurescript you would need to use the git submodule
;; approach. See below
(def gtfs-spec (gtfs/spec))

;; fetch all gtfs fields that are required
(filter :required (gtfs/fields gtfs-spec))

;; fetch all gtfs fields that represent a dataset unique attribute
(filter :unique (gtfs/fields gtfs-spec))

;; fetch all gtfs fields for the "agency.txt" feed
(filter #(= "agency.txt" (:filename %)) (gtfs/fields gtfs-spec))
  • as a git submodule

If you are only interested in the data itself, and would like to use it without Clojure, you can add it as a git submodule. You can use one of the many EDN reader implementations to parse the gtfs data to your convenience.

$ git submodule add https://github.com/hiposfer/gtfs.edn.git

## you will find the gtfs reference spec inside the resources dir
$ my-custom-script parse gtfs.edn/resources/reference.edn

Distributed under LGPL v3