Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

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).