Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hiposfer/gtfs.edn

the General Transit Feed Specification (GTFS) as pure edn data
https://github.com/hiposfer/gtfs.edn

edn-data gtfs

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# gtfs.edn

[![Build Status](https://travis-ci.com/hiposfer/gtfs.edn.svg?branch=master)](https://travis-ci.com/hiposfer/gtfs.edn)
[![Clojars Project](https://img.shields.io/clojars/v/hiposfer/gtfs.edn.svg)](https://clojars.org/hiposfer/gtfs.edn)

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.

```clojure
(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](https://github.com/edn-format/edn/wiki/Implementations)
to parse the gtfs data to your convenience.

```bash
$ 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