0.1.0 • Published 7 years ago

generate-db-graph v0.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

generate-db-graph

Generate a JSON graph of Deutsch Bahn public transport.

npm version ISC-licensed chat on gitter

Installing

npm install -g generate-db-graph
# or with ad-hoc install
npx generate-db-graph <station-id>

Usage

Usage:
    generate-db-graph <station-id>
Examples:
    generate-db-graph 8011102 # start at Berlin Gesundbrunnen

This tool generates data in the JSON Graph Format. Note that instead of storing all nodes and edges in one JSON file, it will create nodes.ndjson and edges.ndjson. These are ndjson-encoded lists of all nodes and edges, respectively.

A node from nodes.ndjson looks like this:

{
	"id": "8013487",
	"label": "Oranienburg",
	"metadata": {
		"latitude": 52.754697,
		"longitude": 13.249084
	}
}

An edge from edges.ndjson looks like this:

{
	"source": "8081722",
	"target": "8013487",
	"relation": "suburban",
	"metadata": {
		"line": "S 1",
		"time": 180000
	}
}

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.