Skip to main content

A tool for generating zone-to-zone travel demand based on grid cells or TAZs and gravity model

Project description

Project description

GRID2DEMAND: A tool for generating zone-to-zone travel demand based on grid cells or TAZs and gravity model

Introduction

Grid2demand is an open-source quick demand generation tool based on the trip generation and trip distribution methods of the standard 4-step travel model. By taking advantage of OSM2GMNS tool to obtain route-able transportation network from OpenStreetMap, Grid2demand aims to further utilize Point of Interest (POI) data to construct trip demand matrix aligned with standard travel models.

You can get access to the introduction video with the link: https://www.youtube.com/watch?v=EfjCERQQGTs&t=1021s

You can find base-knowledge tutorial with the link: Base Knowledge such as transportation 4 stages planning

You can find the tutorial code witht the link: How To Use Grid2demand

Quick Start

Users can refer to the code template and test data set to have a quick start.

Installation

pip install grid2demand

If you meet installation issues, please reach out to our developers for solutions.

Demand Generation

[!IMPORTANT] node.csv and poi.csv should follow the GMNS standard and you can generate node.csv and poi.csv using osm2gmns.

Generate Demand with node.csv and poi.csv (zone_id as activity nodes)

  1. Create zone from node.csv (the boundary of nodes), this will generate grid cells (num_x_blocks, num_y_blocks, or x length and y length in km for each grid cell)
  2. Generate demands for between zones (utilize nodes and pois)
from __future__ import absolute_import
import grid2demand as gd

if __name__ == "__main__":

    # Specify input directory
    input_dir = "your-data-folder"

    # Initialize a GRID2DEMAND object
    net = gd.GRID2DEMAND(input_dir=input_dir, use_zone_id=True, mode_type="auto")

    # load network: node and poi
    net.load_network()

    # Generate zone.csv from node dictionary by specifying number of x blocks and y blocks
    net.net2grid(num_x_blocks=10, num_y_blocks=10)
    # net.net2grid(cell_width=10, cell_height=10, unit="km")

    # Generate zone dictionary from zone.csv
    net.taz2zone()

    # Map zones with nodes and poi, viseversa
    net.map_mapping_between_zone_and_node_poi()

    # Calculate zone-to-zone distance matrix
    net.calc_zond_od_distance_matrix(pct=1)

    # Calculate demand by running gravity model
    net.run_gravity_model()

    # Save demand, zone, updated node, updated poi to csv
    net.save_results_to_csv(agent=True, overwrite_file=False)

Generate Demand with node.csv, poi.csv and zone.csv (from TAZ)

from __future__ import absolute_import
import grid2demand as gd

if __name__ == "__main__":

    # Specify input directory
    input_dir = "your-data-folder"

    # Initialize a GRID2DEMAND object
    net = gd.GRID2DEMAND(input_dir=input_dir, use_zone_id=True, mode_type="auto")

    # load network: node and poi
    net.load_network()

    # Generate zone dictionary from zone.csv
    net.taz2zone()

    # Map zones with nodes and poi, viseversa
    net.map_mapping_between_zone_and_node_poi()

    # Calculate zone-to-zone distance matrix
    net.calc_zond_od_distance_matrix(pct=1)

    # Calculate demand by running gravity model
    net.run_gravity_model()

    # Save demand, zone, updated node, updated poi to csv
    net.save_results_to_csv(agent=True, overwrite_file=False)

Call for Contributions

The grid2demand project welcomes your expertise and enthusiasm!

Small improvements or fixes are always appreciated. If you are considering larger contributions to the source code, please contact us through email: Xiangyong Luo, Dr. Xuesong Simon Zhou

Writing code isn't the only way to contribute to grid2demand. You can also:

  • review pull requests
  • help us stay on top of new and old issues
  • develop tutorials, presentations, and other educational materials
  • develop graphic design for our brand assets and promotional materials
  • translate website content
  • help with outreach and onboard new contributors
  • write grant proposals and help with other fundraising efforts

For more information about the ways you can contribute to grid2demand, visit our GitHub. If you' re unsure where to start or how your skills fit in, reach out! You can ask by opening a new issue or leaving a comment on a relevant issue that is already open on GitHub.

Citing Grid2demand

If you use grid2demand in your research please use the following BibTeX entry:

Xiangyong Luo, Dustin Carlino, and Xuesong Simon Zhou. (2023). xyluo25/grid2demand: Zenodo. https://doi.org/10.5281/zenodo.11212556

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

grid2demand-1.0.0a3.tar.gz (53.9 kB view details)

Uploaded Source

Built Distribution

grid2demand-1.0.0a3-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file grid2demand-1.0.0a3.tar.gz.

File metadata

  • Download URL: grid2demand-1.0.0a3.tar.gz
  • Upload date:
  • Size: 53.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for grid2demand-1.0.0a3.tar.gz
Algorithm Hash digest
SHA256 1405b80fb92e9b44846af0b136e53db554de0a949cfb2dc7a3938c8abdd0f099
MD5 e6c12c35044efcb0864c9f3623eeee00
BLAKE2b-256 4424833a657bb4db9a72572363477c160962f9e69d8d9306d00d36950bf6d544

See more details on using hashes here.

File details

Details for the file grid2demand-1.0.0a3-py3-none-any.whl.

File metadata

File hashes

Hashes for grid2demand-1.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 644386275885fda692b48422b745475f58a95c749b335a67c4dbffef355f8d22
MD5 3a25b9dd580d9cdffa378df703e58723
BLAKE2b-256 f2cca9c9e4d57cd4ef55f95331943aa9a02be10b5890e5fd2bec8a38190843d6

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