generate-vbb-transit-map
v0.3.2
Published
Generate an SVG transit map for Berlin public transport.
Downloads
7
Maintainers
Readme
generate-vbb-transit-map
Generate an SVG transit map for Berlin public transport. Consumes data in the JSON Graph Format, e.g. generated by TransitmapSolver, which in turn consumed data from generate-vbb-graph.
Installing
npm install -g generate-vbb-transit-map
Or just run it using npx:
cat graph.json | npx generate-vbb-transit-map > map.svg
Usage
From the command line:
Usage:
generate-vbb-transit-map
Examples:
cat graph.json | generate-vbb-transit-map > map.svg
As a library:
const generateTransitMap = require('generate-vbb-transit-map')
const graph = require('./graph.json') // some data
const map = generateTransitMap(graph)
map
will be a virtual-dom <svg>
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. An example graph.json
might look like this:
{
"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.