generate-vbb-transit-map

0.3.2 • Public • Published

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.

npm version build status ISC-licensed chat on gitter support me on Patreon

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.

Package Sidebar

Install

npm i generate-vbb-transit-map

Weekly Downloads

4

Version

0.3.2

License

ISC

Unpacked Size

11.4 kB

Total Files

8

Last publish

Collaborators

  • derhuerst