Giter VIP home page Giter VIP logo

generate-vbb-transit-map's Introduction

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.

generate-vbb-transit-map's People

Contributors

derhuerst avatar juliuste avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

generate-vbb-transit-map's Issues

Generating SVG map file

It seems when using global option for install the node_modules does install in

:/usr/lib/nodemodules$ ls
generate-vbb-transit-map  npm  npx
:/usr/lib/node_modules$ cd generate-vbb-transit-map
:/usr/lib/node_modules/generate-vbb-transit-map$ ls
cli.js  index.js  lib  license.md  node_modules  package.json  readme.md

Does the command graph.json also requires to be inside the above directory that does require root access . I tried both and got the following error

https://pastebin.ubuntu.com/p/nsy8Tv3crR/
Copying the json file http://loom.cs.uni-freiburg.de/nyc_subway/export/network.json
to the root access does not help either
https://pastebin.ubuntu.com/p/nsy8Tv3crR/

Error: Cannot find module './lib/parallelise'

I simply tried to run it.

module.js:474
    throw err;
    ^

Error: Cannot find module './lib/parallelise'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/generate-vbb-transit-map/index.js:9:21)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)

Error: division by zero

When trying to render a map. Maybe that information already helps?

Error: division by zero
    at Vec2.divide (/usr/local/lib/node_modules/generate-vbb-transit-map/node_modules/vec2/vec2.js:401:15)
    at parallelise (/usr/local/lib/node_modules/generate-vbb-transit-map/lib/parallelise.js:46:32)
    at generate (/usr/local/lib/node_modules/generate-vbb-transit-map/index.js:58:16)
    at Socket.process.stdin.on.on.once (/usr/local/lib/node_modules/generate-vbb-transit-map/cli.js:58:15)
    at Socket.g (events.js:292:16)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.