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: 6 months 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 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-06T23:31:56.000Z (over 7 years ago)
- Last Synced: 2025-04-15T05:37:05.304Z (6 months ago)
- Topics: graph, map, public-transport, transit, vbb
- Language: JavaScript
- Homepage: https://github.com/derhuerst/generate-vbb-transit-map
- Size: 40 KB
- Stars: 13
- Watchers: 3
- 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).
[](https://www.npmjs.com/package/generate-vbb-transit-map)
[](https://travis-ci.org/derhuerst/generate-vbb-transit-map)

[](https://gitter.im/derhuerst)
[](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).