Madina

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 tools (Homepage). The source code for Madina is available on github.

Referencing in Your Research

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

  • Sevtsuk, A., & Alhassan, A. (2025). Madina Python Package: Scalable Urban Network Analysis for Modeling Pedestrian and Bicycle Trips in Cities. Journal of Transportation Geography, Online (Feb 2025). https://doi.org/10.1016/j.jtrangeo.2025.104130

    @article{Sevtsuk2025,
    author = {Andres Sevtsuk and Abdulaziz Alhassan},
    journal = {Journal of Transportation Geography},
    title = {Madina Python Package: Scalable Urban Network Analysis for Modeling Pedestrian and Bicycle Trips in Cities},
    volume = {Online (Feb 2025)},
    url = {https://doi.org/10.1016/j.jtrangeo.2025.104130},
    year = {2025},
    

}

Examples and Notebooks

The example notebooks and the datat needed to run them are available in the github repository, or could be downloaded from this link

Here is a link to a generated map : Light Map and Dark Map

UNA Access Metrics Workflow

The package provides a streamlined way to measure multiple access metrics from one origin to multiple destinations

  • Prepare input data files (Network, origin and destination layers) inside a folder Cities/city_name/Data

  • Prepare and fill a pairing table and save it in the input folder

  • Run this code snippet:

    from madina.una.workflows import betweenness_flow_simulation
    
     KNN_accessibility(
         city_name='Somerville',
         pairings_file="pairing.csv",
         num_cores=8,
     )
    
Instruction Guide

UNA Pedestrain Flow Simulation

The package enables modelling pedestrian accessibility and movement 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

Instruction Guide Instruction Guide