Skip to content

A Python library modeling pedestrian and bicycle trips over networks.

License

Notifications You must be signed in to change notification settings

City-Form-Lab/madina

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5dab506 · Feb 17, 2025
Feb 17, 2025
Feb 16, 2024
Jan 23, 2024
Feb 6, 2024
Dec 4, 2023
Oct 24, 2023
Apr 5, 2024
Nov 14, 2023
Nov 14, 2023
Feb 16, 2024
Feb 16, 2024
Dec 23, 2023

Repository files navigation

Madina

Example of trip flows generated for New York City

Madina (Arabic for the word 'city') is a package of classes and functions to streamline the representation and analysis of urban networks. The package includes a python implemetation of the Urban Network Analysis Toolbox (Homepage - User Guide). More detailed documentation of the package is available here.

To reference this package in your research, you can cite the paper available on SSRN:

Alhassan, Abdulaziz and Sevtsuk, Andres, Madina Python Package: Scalable Urban Network Analysis for Modeling Pedestrian and Bicycle Trips in Cities. Available at SSRN: https://ssrn.com/abstract=4748255 or http://dx.doi.org/10.2139/ssrn.4748255

@article{alhassan2024madina,
  title={Madina Python Package: Scalable Urban Network Analysis for Modeling Pedestrian and Bicycle Trips in Cities},
  author={Alhassan, Abdulaziz and Sevtsuk, Andres},
  journal={SSRN},
  year={2024},
  publisher={Elsevier}, 
  doi={10.2139/ssrn.4748255},
  url={https://ssrn.com/abstract=4748255}
}

Highlights

  • Organization of data layers using Geopandas
  • Creation of topological (Routable) networks from a geometric representaion. Networks are represented using NetworkX
  • Insertion of origin and destination nodes from data layers into topological networks
  • Creating maps using DeckGL with various streamlined styling options
  • Improved implementation of UNA Tools that use multiprocessing and novel path generation algorithoms to enable effecient pedestrian accessibility and flow simulations on large-scale networks.
  • Added functionalities for UNA, including percieved segment costs that can account for segment quality attributes, elastic trip generation with respect to destination availability, KNN-Access metrics that allows WalkScore-type access calculations, turn penalties, etc.
  • Automated workflows for pedestrian flow simulation in urban environments.
  • User-friendly workspace environment that requires minimal coding experience.

Pedestrain Flow Simulations

The package features a streamlined way to model pedestrian activity in urban areas between pairs of pre-specified origins and destinations. This can be done by following these steps:

  • Prepare input data files for the network, and each origin and destination. Place all data in a folder called Cities/city_name/Data
  • Fill in the pairing table to specify origin-destination pairs, and specify specific parameters for each pair. Save the filled pairing table in the same Cities/city_name/Data folder
  • run the simulation:
from madina.una.betweenness import betweenness_flow_simulation

betweenness_flow_simulation(
    city_name="new_york"
)
  • Output would be saved in Cities/city_name/Simulations.
  • More instructions on running a pedestrain flow simulation, preparing data and creating the pairing table are found in the documentation here

Installation

First, install geopandas through conda in a new environment

conda create -n madina_env -c conda-forge --strict-channel-priority geopandas

Activate the newly created environment

conda activate madina_env

Install Madina through pip

pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple madina

Detailed instructions are available in the documentation here.

Library Structure

  • Zonal class: This is the main class that the user interacts with. A user would create a Zonal object, populate it with data layers and calls functions to create a network object within a Zonal object.
  • Network Class: Created inside a Zonal ovject to represent a network of origins, destinations and 'street' connections. This object is used internally as input to most network algorithms.
  • UNA Module: A set of functions implementing the UNA functionalities. Each function tales a Zonal object as input.
  • Workflows module: A set of standarized workdlows that takes a set of structured inpurs. Examples for Pedesstrain flow simulartiob

About

A Python library modeling pedestrian and bicycle trips over networks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published