-
Notifications
You must be signed in to change notification settings - Fork 0
Create Meso Layers
ccai-cmap edited this page Jan 6, 2026
·
23 revisions
This page describes 1_create_meso_layers.py, a script which creates link and node layers for the meso-scale freight network across scenarios. To use this script, run
python [path-to-script].
Note: Before you run this tool, you MUST have already have run the Export Future Highways tool, so that your output folder already contains MHN_all.gdb.
input
|-- input_years.csv
`-- 2_freight
`-- MFN.gdb
output
`-- 1_travel
`-- MHN_all.gdb
- MHN_all.gdb is copied to a GDB called MFHN_all.gdb.
- Within that GDB, the relevant feature classes from the MFN are copied into a feature dataset called meso_info.
- The centroid nodes and logistic nodes are merged into a feature class called special_nodes.
- The highway nodes (hwynode_all) are joined to their corresponding mesozones (Meso_External_CMAP_merge) which creates a new feature class (hwynode_zone). If anything goes wrong in this part, it's written to meso_join_errors.txt.
- For the years specified in the input csv, this method copies the highway links into a feature dataset called hwylinks_meso and subsets to the links which (1) exist in that year (NEW_BASELINK = 1), (2) are part of the meso-scale freight highway network (MESO = 1), and (3) are not centroid connectors (TYPE1 != 6).
- With networkx's function to determine connected components, hanging nodes and links (nodes and links which are not connected to the rest of the meso network) are discovered and marked.
- A feature dataset called conn_links is created. For each of the build years, the special nodes in the special_nodes feature class are connected to the ANODE of the nearest non-hanging link.
- For the final network, a feature dataset called final_links is created. For each of the build years, non-hanging highway links are written into a feature class, as well as connector links. A feature dataset called final_nodes is created. For each of the build years, relevant nodes are written into a feature class.
output
`-- 2_freight
`-- MFHN_all.gdb
|-- base_feature_class_errors.txt
|-- meso_join_errors.txt
- The script copies 1_travel/MHN_all.gdb into 2_freight/MFHN_all.gdb, and creates the final link and node layers within that gdb.
- The script outputs the file base_feature_class_errors.txt if there were issues with the base feature classes.
- The script outputs the error file, meso_join_errors.txt, for highway nodes which do not have a corresponding mesozone, or have multiple corresponding mesozones.