-
Notifications
You must be signed in to change notification settings - Fork 0
Maintain Highway Project Coding
This page describes m_hwy_project_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_MHN
`-- MHN.gdb
|-- import_hwy_project_coding.xlsx
To run this script, you must have a copy of the MHN as MHN.gdb and an excel file called import_hwy_project_coding.xlsx. The excel file will contain the project coding which will be imported.
The excel file must have 25 columns: tipid, anode, bnode, action, directions, type1, type2, ampm1, ampm2, speed1, speed2, lanes1, lanes2, feet1, feet2, parklanes1, parklanes2, sigic, cltl, rr_grade_sep, tolldollars, modes, tod, rep_anode, rep_bnode. It's alright if it has extra columns on top of that, but those 25 must be included.
In templates, there is a template file called import_hwy_project_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_MHN
`-- 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 where USE has been set to 0.
- 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 25 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.