Skip to main content

Net2Cell

A Python package for building multi-resolution networks from GMNS (General Modeling Network Specification) format. This tool automatically generates meso-level and micro-level networks from macro networks, supports building networks from OpenStreetMap data, and intelligently generates intersection movements.

Features

  • Multi-Resolution Network Generation: Automatically generate meso and micro networks from macro networks
  • OSM Network Support: Direct network building from OpenStreetMap files (.osm/.pbf)
  • Automatic Movement Generation: Intelligent generation of intersection turning movements
  • Flexible Configuration: Rich parameter settings for different scenarios
  • GMNS Standard Output: Fully compliant with GMNS format specifications

Installation

From PyPI

pip install net2cell

Quick Start

import net2cell as nc

# Load network from GMNS format CSV files
net = nc.loadNetFromCSV(
    folder='path/to/network',
    node_file='node.csv',
    link_file='link.csv'
)

# Build multi-resolution networks
nc.buildMultiResolutionNets(
    net,
    generate_micro_net=True,
    auto_movement_generation=True,
    exclusive_bike_walk_lanes=True,
    width_of_lane=3.5,
    length_of_cell=7.0
)

# Output generated networks to CSV files
nc.outputNetToCSV(
    net,
    output_folder='output',
    includes=['macro', 'meso', 'micro']
)

Build Network from OpenStreetMap

import net2cell as nc

# Read network from OSM file
net = nc.getNetFromFile(
    filename='map.osm',  # or 'map.osm.pbf'
    network_type='auto',  # 'auto', 'bike', 'walk', or 'all'
    strict_mode=True,
    POIs=False
)

nc.outputNetToCSV(net, output_folder='output')

Input Data Requirements

GMNS Network Files

node.csv (required fields):

  • node_id: Unique node identifier
  • x_coord: Longitude (lonlat coordinate system) or X coordinate
  • y_coord: Latitude (lonlat coordinate system) or Y coordinate

link.csv (required fields):

  • link_id: Unique link identifier
  • from_node_id: Starting node ID
  • to_node_id: Ending node ID
  • lanes: Number of lanes
  • geometry: LineString geometry in WKT format

OpenStreetMap Files

Supports format:

  • .osm: XML format OSM file

Configuration Parameters

Multi-Resolution Network Building

buildMultiResolutionNets() function parameters:

  • macronet: Macro network object (required)
  • generate_micro_net (default: True): Whether to generate micro network
  • auto_movement_generation (default: True): Whether to automatically generate movements
  • exclusive_bike_walk_lanes (default: True): Whether to set exclusive bike and walk lanes
  • connector_type (default: None): Connector type
  • width_of_lane (default: 3.5): Lane width in meters
  • length_of_cell (default: 7.0): Cell length in meters for micro network

OSM Network Building

getNetFromFile() function parameters:

  • filename: OSM file path
  • network_type (default: 'auto'): Network type
    • 'auto': Motor vehicle roads
    • 'bike': Bicycle paths
    • 'walk': Pedestrian paths
    • 'all': All types
  • link_types: List of road types to include
  • POIs (default: False): Whether to read POIs
  • POI_set: Set of POI types
  • strict_mode (default: True): Strict mode, keeps only the largest connected subgraph
  • bounds: Boundary range dictionary {'minlat', 'minlon', 'maxlat', 'maxlon'}

Output

The tool generates the following network output files:

Network Output

outputNetToCSV() function parameters:

  • macronet: Network object
  • output_folder (default: ''): Output folder path
  • includes: List of network levels to output
    • ['macro']: Output macro network only
    • ['macro', 'meso']: Output macro and meso networks
    • ['macro', 'meso', 'micro']: Output all levels (default)

Advanced Usage

Custom Movement Specification

# Disable automatic movement generation and use user-provided movement.csv
net = nc.loadNetFromCSV(
    folder='path/to/network',
    node_file='node.csv',
    link_file='link.csv',
    movement_file='movement.csv'  # Contains user-defined movements
)

# Build with automatic generation disabled
nc.buildMultiResolutionNets(
    net,
    auto_movement_generation=False
)

System Requirements

  • Python >= 3.8
  • numpy >= 1.20.0
  • pandas >= 1.3.0
  • shapely >= 2.0.0
  • geopandas >= 0.10.0
  • networkx >= 2.6.0
  • osmium >= 3.5.0

Citation

If you use this tool in your research, please cite this tool.

Suggested citation:

Lu, J., Liu, Y., & Zhou, X. (2026). Net2Cell: A multi-resolution network builder for GMNS networks (Version 0.1.4) [Computer software]. https://github.com/yajunliu99/net2cell

BibTeX:

@software{lu_zhou_liu_net2cell_2026,
  author  = {Lu, Jiawei and Liu, Yajun and Zhou, Xuesong},
  title   = {Net2Cell: A Multi-Resolution Network Builder for GMNS Networks},
  year    = {2026},
  version = {0.1.4},
  url     = {https://github.com/yajunliu99/net2cell},
  note    = {Python software package}
}

Authors

  • Jiawei Lu (lujiaweiwk@gmail.com)
  • Yajun Liu (yajunliu@asu.edu)
  • Xuesong Zhou (xzhou74@asu.edu)

License

This project is licensed under the GNU General Public License v3 or later (GPLv3+) - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For questions, issues, or feature requests, please use the GitHub repository or contact the authors listed above.

Metadata

Release files for net2cell 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for net2cell 0.1.4
File Size Uploaded Provenance
net2cell-0.1.4.tar.gz 66.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for net2cell 0.1.4
File Interpreter ABI Platform
net2cell-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 140.0 kB

Release files / net2cell-0.1.4.tar.gz

Download URL net2cell-0.1.4.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
715330e6962f469bfc498d9af2f34b8bed7ef18c27aa18b50b169326ae88d3cc
BLAKE2b-256 checksum
How to use checksums
8a5c07ec0b86534a5f39544049a45a95f514874f3b461415d5f98bf91113c975
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Release files / net2cell-0.1.4-py3-none-any.whl

Download URL net2cell-0.1.4-py3-none-any.whl
Size 73.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51cc2d3c4bb08c6217b748c9dab82df35fde1eb837a0b896784d71298d1e218a
BLAKE2b-256 checksum
How to use checksums
ea79237a14575f6600cab0e2eba98736797ef4c61e23ee9141a6d9cb53c9c287
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.0

Security for net2cell 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page