# 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
```bash
pip install mrnet4gmns
```
## Quick Start
```python
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
```python
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 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
- `num_nodes_for_ramp_alignment` (default: 8): Number of nodes for ramp alignment
### 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'}`
### Complex Intersection Handling
`consolidateComplexIntersections()` function parameters:
- `macronet`: Macro network object
- `auto_identify` (default: True): Automatically identify complex intersections
- `intersection_list`: Manually specified list of intersections
- `int_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 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
```python
# 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](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.
Raw data
{
"_id": null,
"home_page": null,
"name": "mrnet4gmns",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "multi-resolution, network, GMNS, transportation, GIS, OSM, meso, micro",
"author": "Yajun Liu",
"author_email": "Yajun Liu <yajunliu@asu.edu>",
"download_url": "https://files.pythonhosted.org/packages/35/1e/be2fa2637731f9dc82318a6d630df1184e9e28571d766490a055cec2d2ea/mrnet4gmns-0.1.1.tar.gz",
"platform": null,
"description": "# MRNet4GMNS\n\nA 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.\n\n## Features\n\n- **Multi-Resolution Network Generation**: Automatically generate meso and micro networks from macro networks\n- **OSM Network Support**: Direct network building from OpenStreetMap files (.osm/.pbf)\n- **Automatic Movement Generation**: Intelligent generation of intersection turning movements\n- **Complex Intersection Handling**: Support for merging and simplifying complex intersections\n- **POI Integration**: Connect Points of Interest (POI) to the road network\n- **Flexible Configuration**: Rich parameter settings for different scenarios\n- **GMNS Standard Output**: Fully compliant with GMNS format specifications\n\n## Installation\n\n### From PyPI\n\n```bash\npip install mrnet4gmns\n```\n\n## Quick Start\n\n```python\nimport mrnet4gmns as mrnet\n\n# Load network from GMNS format CSV files\nnet = mrnet.loadNetFromCSV(\n folder='path/to/network',\n node_file='node.csv',\n link_file='link.csv'\n)\n\n# Build multi-resolution networks\nmrnet.buildMultiResolutionNets(\n net,\n generate_micro_net=True,\n auto_movement_generation=True,\n exclusive_bike_walk_lanes=True,\n width_of_lane=3.5,\n length_of_cell=7.0,\n num_nodes_for_ramp_alignment=8\n\n)\n\n# Output generated networks to CSV files\nmrnet.outputNetToCSV(\n net,\n output_folder='output',\n includes=['macro', 'meso', 'micro']\n)\n```\n\n### Build Network from OpenStreetMap\n\n```python\nimport mrnet4gmns as mrnet\n\n# Read network from OSM file\nnet = mrnet.getNetFromFile(\n filename='map.osm', # or 'map.osm.pbf'\n network_type='auto', # 'auto', 'bike', 'walk', or 'all'\n strict_mode=True,\n POIs=False\n)\n\n\nmrnet.outputNetToCSV(net, output_folder='output')\n```\n\n## Input Data Requirements\n\n### GMNS Network Files\n\n**node.csv** (required fields):\n- `node_id`: Unique node identifier\n- `x_coord`: Longitude (lonlat coordinate system) or X coordinate\n- `y_coord`: Latitude (lonlat coordinate system) or Y coordinate\n\n**link.csv** (required fields):\n- `link_id`: Unique link identifier\n- `from_node_id`: Starting node ID\n- `to_node_id`: Ending node ID\n- `lanes`: Number of lanes\n- `geometry`: LineString geometry in WKT format\n\n### OpenStreetMap Files\n\nSupports format:\n- `.osm`: XML format OSM file\n\n## Configuration Parameters\n\n### Multi-Resolution Network Building\n\n`buildMultiResolutionNets()` function parameters:\n\n- `macronet`: Macro network object (required)\n- `generate_micro_net` (default: True): Whether to generate micro network\n- `auto_movement_generation` (default: True): Whether to automatically generate movements\n- `exclusive_bike_walk_lanes` (default: True): Whether to set exclusive bike and walk lanes\n- `connector_type` (default: None): Connector type\n- `width_of_lane` (default: 3.5): Lane width in meters\n- `length_of_cell` (default: 7.0): Cell length in meters for micro network\n- `num_nodes_for_ramp_alignment` (default: 8): Number of nodes for ramp alignment\n\n### OSM Network Building\n\n`getNetFromFile()` function parameters:\n\n- `filename`: OSM file path\n- `network_type` (default: 'auto'): Network type\n - `'auto'`: Motor vehicle roads\n - `'bike'`: Bicycle paths\n - `'walk'`: Pedestrian paths\n - `'all'`: All types\n- `link_types`: List of road types to include\n- `POIs` (default: False): Whether to read POIs\n- `POI_set`: Set of POI types\n- `strict_mode` (default: True): Strict mode, keeps only the largest connected subgraph\n- `bounds`: Boundary range dictionary `{'minlat', 'minlon', 'maxlat', 'maxlon'}`\n\n### Complex Intersection Handling\n\n`consolidateComplexIntersections()` function parameters:\n\n- `macronet`: Macro network object\n- `auto_identify` (default: True): Automatically identify complex intersections\n- `intersection_list`: Manually specified list of intersections\n- `int_buffer` (default: 20.0): Intersection buffer radius in meters\n\n## Output\n\nThe tool generates the following network output files:\n\n### Network Output\n\n`outputNetToCSV()` function parameters:\n\n- `macronet`: Network object\n- `output_folder` (default: ''): Output folder path\n- `includes`: List of network levels to output\n - `['macro']`: Output macro network only\n - `['macro', 'meso']`: Output macro and meso networks\n - `['macro', 'meso', 'micro']`: Output all levels (default)\n\n## Advanced Usage\n\n### Custom Movement Specification\n\n```python\n# Disable automatic movement generation and use user-provided movement.csv\nnet = mrnet.loadNetFromCSV(\n folder='path/to/network',\n node_file='node.csv',\n link_file='link.csv',\n movement_file='movement.csv' # Contains user-defined movements\n)\n\n# Build with automatic generation disabled\nmrnet.buildMultiResolutionNets(\n net,\n auto_movement_generation=False\n)\n```\n\n## System Requirements\n\n- Python >= 3.8\n- numpy >= 1.20.0\n- pandas >= 1.3.0\n- shapely >= 2.0.0\n- geopandas >= 0.10.0\n- networkx >= 2.6.0\n- osmium >= 3.5.0\n\n## Citation\n\nIf you use this tool in your research, please cite this tool.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n\n## Support\n\nFor questions, issues, or feature requests, please contact us.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A multi-resolution network builder for GMNS networks",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [
"multi-resolution",
" network",
" gmns",
" transportation",
" gis",
" osm",
" meso",
" micro"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "eee6bc4ba243c11b0e83bac364227434c7b3da31f6246ceedcaf2c86fdc93f58",
"md5": "2436f38b7d59d81eebc647e4665bf03c",
"sha256": "210ceee3d52bedae081d5ebc73984a3540d0feb534abbde479be260642b3fa79"
},
"downloads": -1,
"filename": "mrnet4gmns-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2436f38b7d59d81eebc647e4665bf03c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 51783,
"upload_time": "2025-10-24T18:40:50",
"upload_time_iso_8601": "2025-10-24T18:40:50.469059Z",
"url": "https://files.pythonhosted.org/packages/ee/e6/bc4ba243c11b0e83bac364227434c7b3da31f6246ceedcaf2c86fdc93f58/mrnet4gmns-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "351ebe2fa2637731f9dc82318a6d630df1184e9e28571d766490a055cec2d2ea",
"md5": "183706187a883a3db9e9957fd06e69bd",
"sha256": "d0704b7ba57aed7d034553fd7f375c55eae31331332a90540a6de1a2a3c2d301"
},
"downloads": -1,
"filename": "mrnet4gmns-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "183706187a883a3db9e9957fd06e69bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 44669,
"upload_time": "2025-10-24T18:40:51",
"upload_time_iso_8601": "2025-10-24T18:40:51.831710Z",
"url": "https://files.pythonhosted.org/packages/35/1e/be2fa2637731f9dc82318a6d630df1184e9e28571d766490a055cec2d2ea/mrnet4gmns-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-24 18:40:51",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mrnet4gmns"
}