Skip to main content

An open-source education tool for constructing modeling datasets of railway transportation

Project description

OSM2Rail: An open-source education tool for constructing modeling datasets of railway transportation

Authors: Jiawei Lu, Qian Fu, Zanyang Cui, Dr. Junhua Chen

Email: jiaweil9@asu.edu, qian.fu@outlook.com, zanyangcui@outlook.com, cjh@bjtu.edu.cn

Introduction

The python tool of OSM2Rail is an integrated and enhanced version of two python packages, namely OSM2GMNS and Pydriosm. The former aims to convert OpenStreetMap data to generic node and link files in GMNS format, while the latter aims to enable a batch process of downloading, reading and PostgreSQL-based I/O of OpenStreetMap data.

OSM2GMNS is currently developed and maintained by Jiawei Lu and Dr. Xuesong Zhou at Arizona State University. PyDriosm published by Dr. Qian Fu at Birmingham Centre for Railway Research and Education, University of Birmingham, is an open-source tool for researchers or practitioners to easily download and read OSM map data in popular file formats such as protocolbuffer binary format (PBF) and shapefile, which are available for free download from Geofabrik and BBBike. This package also provides a convenient way for PostgreSQL-based I/O and storage of parsed OSM data.

Integrating the data conversion and online data downloading capabilities from the above 2 packages, OSM2Rail allows users to rapidly obtain OSM data for a given set of areas and convert them to node, link, and poi files for further system modeling and optimization. Users are recommended to download OSM map data in .osm or .osm.pbf format and convert them to commonly used csv files.

Requirements

  • pyhelpers==1.2.15
  • bs4
  • matplotlib<=3.3.0
  • google
  • protobuf==3.15.6

Installation

pip install osm2rail

Note

  • For Windows users, the pip method might fail to install some dependencies. If errors occur when you try to install any of those dependencies, try instead to pip install their .whl files, which can be downloaded from the Unoffical Windows Binaries for Python Extension Packages.

Simple Example

import osm2rail as orl

"""Step 1: download OSM data in .osm format from Overpass"""
subarea="IHB Blue Island Yard"
download_dir='osmfile'
osm_file=orl.download_osm_data_from_overpass(subarea_names=subarea,download_dir=download_dir,ret_download_path=True)

"""Step 2: convert OSM data in .osm format to GMNS-rail network files"""
net=orl.get_network_from_OSMFile(osm_filename=osm_file[0],strict_mode=True,POIs=True)

"""Step 3: visualize rail network data set"""
orl.showNetwork(net)

"""Step 4: output Networks to CSV"""
orl.saveNetwork(net)

all modes network

User guide

Users can check the user guide for a detailed introduction of osm2rail.

Project details


Download files

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

Source Distribution

osm2rail-0.0.1.tar.gz (1.4 MB view hashes)

Uploaded Source

Built Distribution

osm2rail-0.0.1-py3-none-any.whl (1.4 MB 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