Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/generate-vbb-transit-map
Generate an SVG transit map for Berlin public transport.
https://github.com/derhuerst/generate-vbb-transit-map
graph map public-transport transit vbb
Last synced: 12 days ago
JSON representation
Generate an SVG transit map for Berlin public transport.
- Host: GitHub
- URL: https://github.com/derhuerst/generate-vbb-transit-map
- Owner: derhuerst
- License: isc
- Created: 2017-06-26T19:34:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-06T23:31:56.000Z (over 6 years ago)
- Last Synced: 2024-05-01T23:29:34.606Z (9 months ago)
- Topics: graph, map, public-transport, transit, vbb
- Language: JavaScript
- Homepage: https://github.com/derhuerst/generate-vbb-transit-map
- Size: 40 KB
- Stars: 7
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
- awesome-starred - derhuerst/generate-vbb-transit-map - Generate an SVG transit map for Berlin public transport. (others)
README
# generate-vbb-transit-map
**Generate an SVG transit map for Berlin public transport.** Consumes data in the [JSON Graph Format](http://jsongraphformat.info), e.g. generated by [TransitmapSolver](https://github.com/dirkschumacher/TransitmapSolver.jl), which in turn consumed data from [generate-vbb-graph](https://github.com/derhuerst/generate-vbb-graph).
[![npm version](https://img.shields.io/npm/v/generate-vbb-transit-map.svg)](https://www.npmjs.com/package/generate-vbb-transit-map)
[![build status](https://img.shields.io/travis/derhuerst/generate-vbb-transit-map.svg)](https://travis-ci.org/derhuerst/generate-vbb-transit-map)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/generate-vbb-transit-map.svg)
[![chat on gitter](https://badges.gitter.im/derhuerst.svg)](https://gitter.im/derhuerst)
[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst)## Installing
```shell
npm install -g generate-vbb-transit-map
```Or just run it using [npx](https://github.com/zkat/npx#readme):
```shell
cat graph.json | npx generate-vbb-transit-map > map.svg
```## Usage
From the command line:
```shell
Usage:
generate-vbb-transit-map
Examples:
cat graph.json | generate-vbb-transit-map > map.svg
```---
As a library:
```js
const generateTransitMap = require('generate-vbb-transit-map')const graph = require('./graph.json') // some data
const map = generateTransitMap(graph)
````map` will be a [virtual-dom](https://github.com/Matt-Esch/virtual-dom#virtual-dom) `` element. Generate an SVG string like this:
```
const toString = require('virtual-dom-stringify')console.log(toString(svg))
```## Input data format
The input data must be in the [JSON Graph Format](http://jsongraphformat.info). An example `graph.json` might look like this:
```js
{
"nodes": [ // list of all nodes
{
"id": "900000042101", // required
"metadata": {
"x": 537.029, // x-coordinate in any metric, required
"y": 673.576 // y-coordinate in any metric, required
}
}
// …
],
"edges": [ // list of all edges
{
"source": "900000120025", // node id, required
"target": "900000120008", // node id, required
"metadata": {
"line": "U5"
}
}
// …
]
}
```## Contributing
If you have a question or have difficulties using `generate-vbb-transit-map`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/generate-vbb-transit-map/issues).