|
1 | | -############################################################################# |
2 | | -# IMPORT_ROUTES.PY # |
3 | | -# Craig Heither, last revised 05/17/2012 # |
4 | | -# # |
5 | | -# This program is used to import new or revised rail route coding into # |
6 | | -# "railnet_route_rail_lines". The "xls" variable listed below should be # |
7 | | -# updated to identify the spreadsheet in the Import\ directory that # |
8 | | -# holds the coding. # |
9 | | -# # |
10 | | -# All routes are re-built based on the arc geometry to ensure they are # |
11 | | -# coincident with the underlying links. # |
12 | | -# # |
13 | | -# ------------------------- # |
14 | | -# revision summary: # |
15 | | -# 06-03-2010: added coding to update route geometry when run. # |
16 | | -# 09-14-2010: updated for ArcMap 10 (arcgisscripting replaced by arcpy & # |
17 | | -# revised cursor coding based on ESRI changes). # |
18 | | -# 04-05-2011: SAS call moved to sasrun.bat. # |
19 | | -# 09-26-2011: For Route table update: Index and Table join procedures # |
20 | | -# replaced by more efficient Search and Update cursor code. # |
21 | | -# 01-24-2012: Revised to accept GTFS or spreadsheet coding. |
22 | | -# # |
23 | | -############################################################################# |
| 1 | +############################################################################### |
| 2 | +# IMPORT_RAIL_CODING.PY # |
| 3 | +# Craig Heither # |
| 4 | +# Last revised 8/22/2017 # |
| 5 | +# # |
| 6 | +# This program is used to import new or revised rail route coding into # |
| 7 | +# "railnet_route_rail_lines". The "xls" variable listed below should be # |
| 8 | +# updated to identify the spreadsheet in the Import\ directory that # |
| 9 | +# holds the coding. # |
| 10 | +# # |
| 11 | +# All routes are re-built based on the arc geometry to ensure they are # |
| 12 | +# coincident with the underlying links. # |
| 13 | +# ------------------------- # |
| 14 | +# Revision summary: # |
| 15 | +# 06-03-2010: added coding to update route geometry when run. # |
| 16 | +# 09-14-2010: updated for ArcMap 10 (arcgisscripting replaced by arcpy & # |
| 17 | +# revised cursor coding based on ESRI changes). # |
| 18 | +# 04-05-2011: SAS call moved to sasrun.bat. # |
| 19 | +# 09-26-2011: For Route table update: Index and Table join procedures # |
| 20 | +# replaced by more efficient Search and Update cursor code. # |
| 21 | +# 01-24-2012: Revised to accept GTFS or spreadsheet coding. # |
| 22 | +# NRF 8/22/17: Updates new future coding TOD field. # |
| 23 | +############################################################################### |
24 | 24 |
|
25 | 25 |
|
26 | 26 | # --------------------------------------------------------------------------- |
|
222 | 222 | b_row.HEADWAY = d_row.getValue("hdwy1") |
223 | 223 | b_row.SPEED = d_row.getValue("speed1") |
224 | 224 | if flag == "1": # update variables unique to future rail coding |
| 225 | + b_row.TOD = string.strip(d_row.getValue("tod1")) |
225 | 226 | b_row.SCENARIO = string.strip(d_row.getValue("scen1")) |
226 | 227 | b_row.ACTION = d_row.getValue("action1") |
227 | 228 | b_row.NOTES = d_row.getValue("notes1") |
|
266 | 267 | # --------------------------------------------------------------- |
267 | 268 | # Cleanup files if needed |
268 | 269 | # --------------------------------------------------------------- |
269 | | -# if os.path.exists(temp_route_shp): |
270 | | - # arcpy.Delete_management(temp_route_shp, "ShapeFile") |
271 | | -# if os.path.exists(new_segments_dbf): |
272 | | - # arcpy.Delete_management(new_segments_dbf, "DbaseTable") |
273 | | -# if os.path.exists(rte_updt): |
274 | | - # arcpy.Delete_management(rte_updt, "DbaseTable") |
275 | | -# if os.path.exists(test): |
276 | | - # arcpy.Delete_management(test) |
277 | | -# if os.path.exists(outFl): |
278 | | - # os.remove(outFl) |
279 | | -# if os.path.exists(infl): |
280 | | - # os.remove(infl) |
281 | | -# if os.path.exists(outRtFl): |
282 | | - # os.remove(outRtFl) |
| 270 | +if os.path.exists(temp_route_shp): |
| 271 | + arcpy.Delete_management(temp_route_shp, "ShapeFile") |
| 272 | +if os.path.exists(new_segments_dbf): |
| 273 | + arcpy.Delete_management(new_segments_dbf, "DbaseTable") |
| 274 | +if os.path.exists(rte_updt): |
| 275 | + arcpy.Delete_management(rte_updt, "DbaseTable") |
| 276 | +if os.path.exists(test): |
| 277 | + arcpy.Delete_management(test) |
| 278 | +if os.path.exists(outFl): |
| 279 | + os.remove(outFl) |
| 280 | +if os.path.exists(infl): |
| 281 | + os.remove(infl) |
| 282 | +if os.path.exists(outRtFl): |
| 283 | + os.remove(outRtFl) |
283 | 284 |
|
0 commit comments