Skip to main content

TransNet Generator is a Python library for generating transport network from GTFS data.

Project description

TransNet Generator

TransNet Generator is a Python library for generating transport networks from GTFS data. The library provides a convenient and efficient way to generate transport network graphs from one or multiple GTFS directories to a graph in Pajek or GML format, which can be used for network analysis and visualization.

Installation

To install TransNet Generator, you can use pip:

pip install transnet-generator

Usage

To use TransNet Generator, you can import the transnet_generator module and use the generate_graph function:

from transnet_generator import generate_graph

input_GTFS = ["path/to/gtfs/directory1", "path/to/gtfs/directory2"]
output_path = "path/to/output/graph"

generate_graph(input_GTFS, output_path)

The generate_graph function takes two required arguments:

input_GTFS - A list containing the paths to the directories containing the GTFS files.
output_path - The path to the output graph file.

Supported Output Formats

TransNet Generator supports the following output formats:

Pajek (.net)
GML (.gml)

To specify the output format, simply pass the desired format as a string to the output_format parameter of the generate_graph function.

Examples

Here's an example of how to generate a graph file in Pajek format from one GTFS directory:

from transnet_generator import generate_graph

input_GTFS = ["path/to/gtfs/directory"]
output_path = "path/to/output/graph.net"

generate_graph(input_GTFS, output_path, format="pajek")

Here's an example of how to generate a graph file in GML format from three GTFS directories:

from transnet_generator import generate_graph

input_GTFS = ["path/to/gtfs/directory1", "path/to/gtfs/directory2", "path/to/gtfs/directory3"]
output_path = "path/to/output/graph.gml"

generate_graph(input_GTFS, output_path, format="gml")

License

TransNet Generator is released under the MIT License. See the LICENCE file for details.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transnet_generator-0.1.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

transnet_generator-0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page