A multi-resolution network builder for GMNS networks
Project description
MRNet4GMNS
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
- Complex Intersection Handling: Support for merging and simplifying complex intersections
- POI Integration: Connect Points of Interest (POI) to the road network
- Flexible Configuration: Rich parameter settings for different scenarios
- GMNS Standard Output: Fully compliant with GMNS format specifications
Installation
From PyPI
pip install mrnet4gmns
Quick Start
import mrnet4gmns as mrnet
# Load network from GMNS format CSV files
net = mrnet.loadNetFromCSV(
folder='path/to/network',
node_file='node.csv',
link_file='link.csv'
)
# Build multi-resolution networks
mrnet.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,
num_nodes_for_ramp_alignment=8
)
# Output generated networks to CSV files
mrnet.outputNetToCSV(
net,
output_folder='output',
includes=['macro', 'meso', 'micro']
)
Build Network from OpenStreetMap
import mrnet4gmns as mrnet
# Read network from OSM file
net = mrnet.getNetFromFile(
filename='map.osm', # or 'map.osm.pbf'
network_type='auto', # 'auto', 'bike', 'walk', or 'all'
strict_mode=True,
POIs=False
)
mrnet.outputNetToCSV(net, output_folder='output')
Input Data Requirements
GMNS Network Files
node.csv (required fields):
node_id: Unique node identifierx_coord: Longitude (lonlat coordinate system) or X coordinatey_coord: Latitude (lonlat coordinate system) or Y coordinate
link.csv (required fields):
link_id: Unique link identifierfrom_node_id: Starting node IDto_node_id: Ending node IDlanes: Number of lanesgeometry: 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 networkauto_movement_generation(default: True): Whether to automatically generate movementsexclusive_bike_walk_lanes(default: True): Whether to set exclusive bike and walk lanesconnector_type(default: None): Connector typewidth_of_lane(default: 3.5): Lane width in meterslength_of_cell(default: 7.0): Cell length in meters for micro networknum_nodes_for_ramp_alignment(default: 8): Number of nodes for ramp alignment
OSM Network Building
getNetFromFile() function parameters:
filename: OSM file pathnetwork_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 includePOIs(default: False): Whether to read POIsPOI_set: Set of POI typesstrict_mode(default: True): Strict mode, keeps only the largest connected subgraphbounds: Boundary range dictionary{'minlat', 'minlon', 'maxlat', 'maxlon'}
Complex Intersection Handling
consolidateComplexIntersections() function parameters:
macronet: Macro network objectauto_identify(default: True): Automatically identify complex intersectionsintersection_list: Manually specified list of intersectionsint_buffer(default: 20.0): Intersection buffer radius in meters
Output
The tool generates the following network output files:
Network Output
outputNetToCSV() function parameters:
macronet: Network objectoutput_folder(default: ''): Output folder pathincludes: 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 = mrnet.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
mrnet.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.
License
This project is licensed under the MIT License - 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 contact us.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mrnet4gmns-0.1.1.tar.gz.
File metadata
- Download URL: mrnet4gmns-0.1.1.tar.gz
- Upload date:
- Size: 44.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0704b7ba57aed7d034553fd7f375c55eae31331332a90540a6de1a2a3c2d301
|
|
| MD5 |
183706187a883a3db9e9957fd06e69bd
|
|
| BLAKE2b-256 |
351ebe2fa2637731f9dc82318a6d630df1184e9e28571d766490a055cec2d2ea
|
File details
Details for the file mrnet4gmns-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mrnet4gmns-0.1.1-py3-none-any.whl
- Upload date:
- Size: 51.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
210ceee3d52bedae081d5ebc73984a3540d0feb534abbde479be260642b3fa79
|
|
| MD5 |
2436f38b7d59d81eebc647e4665bf03c
|
|
| BLAKE2b-256 |
eee6bc4ba243c11b0e83bac364227434c7b3da31f6246ceedcaf2c86fdc93f58
|