Skip to main content

convert map data from OpenStreetMap to network files in GMNS format

Project description

osm2gmns

Authors: Jiawei Lu, Xuesong (Simon) Zhou

osm2gmns is an open-source Python package that enables users to conveniently obtain and manipulate any networks from OpenStreetMap (OSM). With a single line of Python code, users can obtain and model drivable, bikeable, walkable, railway, and aeroway networks for any region in the world and output networks to CSV files in GMNS format for seamless data sharing and research collaboration. osm2gmns mainly focuses on providing researchers and practitioners with flexible, standard and ready-to-use multi-modal transportation networks, as well as a bunch of customized and practical functions to facilitate various research and applications on traffic modeling.

Publication

Lu, J., & Zhou, X.S. (2023). Virtual track networks: A hierarchical modeling framework and open-source tools for simplified and efficient connected and automated mobility (CAM) system design based on general modeling network specification (GMNS). Transportation Research Part C: Emerging Technologies, 153, 104223. paper link

Main Features

  • Obtain any networks from OSM. osm2gmns parses map data from OSM and output networks to csv files in GMNS format.

  • Standard network format. osm2gmns adopts GMNS as the network format for seamless data sharing and research collaboration.

  • Ready-to-use network. osm2gmns cleans erroneous information from osm map data and is able to fill up critical missing values, i.e., lanes, speed and capacity, to quickly provide ready-to-use networks.

  • Directed network. two directed road links are generated for each bi-directional osm ways identified by osm2gmns

  • Multi-module support. five different network types are supported, including auto, bike, walk, railway, and aeroway

  • Customized and practical functions to facilitate traffic modeling. functions include complex intersection consolidation, moevement generation, traffic zone creation, short link combination, network visualization.

  • Multi-Resolution modeling. osm2gmns automatically construct the corresponding mesoscopic and microscopic networks for any macroscopic network in GMNS format.

Installation

pip install osm2gmns

If you meet installation issues, please refer to the user’s guide for solutions.

Simple examples

You can find the osm map file used in the examples below at ‘sample networks/Arizona State University, Tempe Campus’

Quickly get the network with point of interest (POI) information from an osm file

>>> import osm2gmns as og
>>> net = og.getNetFromFile('asu.osm', POI=True)
>>> og.outputNetToCSV(net)

Generate multi-resolution networks from an osm file

>>> import osm2gmns as og
>>> net = og.getNetFromFile('asu.osm')
>>> og.consolidateComplexIntersections(net, auto_identify=True)
>>> og.buildMultiResolutionNets(net)
>>> og.outputNetToCSV(net)

Get relation id of a place of interest and download the corresponding osm file

You can use the following code to get the relation id of a place of interest and download the corresponding osm file.

>>> import osm2gmns as og
# get relation id of a place of interest
# For the place of interest, e.g. Arizona State University
# e.g. "Tempe, Arizona, United States"
# e.g. "Arizona, US"
# e.g. "Beijing Jiaotong University, Beijing, China"
>>> rel_id = og.getOSMRelationID('Arizona State University')
>>> rel_id
    Info: Found relation id 3444656 from web
    Info: location of the place of interest:
    {
        "place_id": 318528634,
        "licence": "Data \u00a9 OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
        "osm_type": "relation",
        "osm_id": 3444656,
        "lat": "33.4213174",
        "lon": "-111.93316305413154",
        "class": "amenity",
        "type": "university",
        "place_rank": 30,
        "importance": 0.5547365758311374,
        "addresstype": "amenity",
        "name": "Arizona State University",
        "display_name": "Arizona State University, 1151, South Forest Avenue, Tempe Junction, Tempe, Maricopa County, Arizona, 85281, United States",
        "boundingbox": [
            "33.4102062",
            "33.4329786",
            "-111.9411651",
            "-111.9092447"
        ]
    }
3444656

# download the corresponding osm file
>>> og.downloadOSMData(rel_id, 'asu.osm')

User’s guide

You can check the user’s guide for a detailed introduction of osm2gmns.

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

osm2gmns-0.7.6.tar.gz (65.4 kB view details)

Uploaded Source

Built Distribution

osm2gmns-0.7.6-py3-none-any.whl (77.5 kB view details)

Uploaded Python 3

File details

Details for the file osm2gmns-0.7.6.tar.gz.

File metadata

  • Download URL: osm2gmns-0.7.6.tar.gz
  • Upload date:
  • Size: 65.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.3

File hashes

Hashes for osm2gmns-0.7.6.tar.gz
Algorithm Hash digest
SHA256 ed7c22bb26c511112aff896528f9af64a22ede8ebe5c5445fedc4f34969172c4
MD5 ff4357428093527baa4a42a10fcb6708
BLAKE2b-256 250b98bba13129085c17603ed8a053c7473960be0bc91c89cb616b1127fc0267

See more details on using hashes here.

File details

Details for the file osm2gmns-0.7.6-py3-none-any.whl.

File metadata

  • Download URL: osm2gmns-0.7.6-py3-none-any.whl
  • Upload date:
  • Size: 77.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.3

File hashes

Hashes for osm2gmns-0.7.6-py3-none-any.whl
Algorithm Hash digest
SHA256 786a0ad8f806f4482b3efe378bd09cba48b1b6f4abbb067057f46baca31a5b0d
MD5 d9b9bf745d4c97a169eacea19ee236b4
BLAKE2b-256 cae48141a51bfa4043caecb0a252ee430835d12504878e8c5567c32bbee12c40

See more details on using hashes here.

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