peartree是一个将gtfs转换为有向图的库。
peartree的Python项目详细描述
peartree是一个库,用于将GTFSfeed计划转换为具有代表性的有向网络图。该工具使用Partridge将目标运算符计划数据转换为Pandas数据帧,然后NetworkX将操作的计划数据保存为有向多重图。
以上是将多个湾区运输运营商增量加载到PearTree中的示例。
安装
pip install peartree
用法
请参阅this gist上的完整笔记本,以查看一个简单的、逐步的ipython笔记本,它会拉入ac transit gtfs提要并将其转换为networkx图形。
importpeartreeasptpath='path/to/actransit_gtfs.zip'# Automatically identify the busiest day and# read that in as a Partidge feedfeed=pt.get_representative_feed(path)# Set a target time period to# use to summarize impedancestart=7*60*60# 7:00 AMend=10*60*60# 10:00 AM# Converts feed subset into a directed# network multigraphG=pt.load_feed_as_graph(feed,start,end)
示例
我还没有为这个库制作一个完整的操作指南,但是我将开始用我或其他人制作的任何博客文章或笔记本来填充这个部分,其中包括使用peartree的工作流。
Calculating betweeness centrality with Brooklyn bus network
Combining a peartree transit network and an OpenStreetMap walk network
Generating comparative acyclic route graphs
Coalescing transit network graphs and spectral clustering methods
Exploratory graph analysis with betweenness and load centrality