-
Notifications
You must be signed in to change notification settings - Fork 0
Maintain Highway Project Coding
This page describes m_hwyproj_coding.py, a script which modifies and maintains the highway project coding table. To use this script, run
[path-to-script] with an optional -f flag if you want it to be the final version.
This script is a translation of the Import Highway Projects tool in the mhn_programs repository.
input
|-- input_years.csv
`-- 1_travel
`-- MHN.gdb
|-- import_hwyproj_coding.xlsx
To run this script, you must have a copy of the MHN as MHN.gdb.
If you just want to check the integrity of the project table, you do not need import_hwyproj_coding.xlsx. In the diagram below, '3' will be skipped.
If you do want to import new project coding, you must have an excel file called import_hwyproj_coding.xlsx. This excel file must have 28 columns: tipid, anode, bnode, action, directions, type1, type2, ampm1, ampm2, speed1, speed2, lanes1, lanes2, feet1, feet2, parklanes1, parklanes2, parkres1, parkres2, buslanes1, buslanes2, sigic, cltl, rrgradex, tolldollars, modes, vclearance, and remove. It's alright if it has extra columns on top of that, but those 28 must be included.
The column 'remove' indicates rows to be dropped from the project table. Set remove = Y if you want to remove that row.
In templates, there is a template file called import_hwyproj_coding_template.xlsx which you can just fill in.
The script imports the new highway project coding into the output MHN gdb and then checks for the integrity. If the final flag -f is called, the output gdb will be cleaned up and finalized so that you have a brand new updated MHN. Rows with errors (USE = 0) will be dropped.
This script imports the HN module. The way it uses the methods is shown below:

output
`-- 1_travel
`-- MHN_{base}.gdb
|-- base_feature_class_errors.txt
|-- base_project_table_errors.txt
|-- base_project_table_errors.xlsx
|-- import_project_coding_errors.csv
- The script outputs a new geodatabase called MHN_{base}.gdb. For example, if the base year is 2015, then it will be called MHN_2015.gdb. It will either be in a draft or final state depending on if -f was used.
- The script outputs the file base_feature_class_errors.txt if there were issues with the base feature classes.
- The script outputs the file import_project_coding_errors.csv if the projects were not successfully imported. The csv file will contain the unusable rows.
- The script outputs the files base_project_table_errors.txt and base_project_table_errors.xlsx if the projects were successfully imported- the text file will contain a summary of errors and warnings, and the excel file will have the rows with errors and warnings.
- This file maintains the highway project coding, but it can't add any TIPIDs which don't already exist in hwynet/hwyproj. If there's a new highway project TIPID, it has to be added to hwynet/hwyproj beforehand.
- The output file base_project_table_errors.xlsx has the 28 required columns, so you can directly edit it to fix the errors, change the name to import_hwy_project_coding.xlsx, and then stick it in the input folder to be re-imported.