|
25 | 25 | # replaced by more efficient Search and Update cursor code. # |
26 | 26 | # 01-23-2012: y2 variable for cmd2 re-written for new required parameters.# |
27 | 27 | # 08-07-2012: Revised to iterate through & update all route systems. # |
| 28 | +# 05-30-2017: revised to pass future route action codes to SAS for # |
| 29 | +# processing split links. # |
| 30 | +# 06-23-2017: revised to remove point_x0 and point_y0 fields from final # |
| 31 | +# node feature class. # |
28 | 32 | # # |
29 | 33 | ############################################################################# |
30 | 34 |
|
|
183 | 187 | arcpy.AddMessage("---> Updating Node Feature Class") |
184 | 188 | arcpy.MakeXYEventLayer_management(new_node_dbf, "point_x", "point_y", temp_node_Layer, "PROJCS['NAD_1927_StatePlane_Illinois_East_FIPS_1201',GEOGCS['GCS_North_American_1927',DATUM['D_North_American_1927',SPHEROID['Clarke_1866',6378206.4,294.9786982]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-88.33333333333333],PARAMETER['Scale_Factor',0.999975],PARAMETER['Latitude_Of_Origin',36.66666666666666],UNIT['Foot_US',0.3048006096012192]];IsHighPrecision") |
185 | 189 | arcpy.FeatureClassToFeatureClass_conversion(temp_node_Layer, mrn_gdb, "temp") |
| 190 | +arcpy.DeleteField_management(temp, ["point_x0", "point_y0"]) |
186 | 191 | arcpy.SelectLayerByAttribute_management(railnet_node, "CLEAR_SELECTION", "") |
187 | 192 | arcpy.DeleteRows_management(railnet_node) |
188 | 193 | arcpy.Append_management(temp, railnet_node, "TEST", "", "") |
|
237 | 242 | env.workspace = "V:/Secure/Master_Rail/mrn.gdb/railnet" ## point inside feature dataset |
238 | 243 | fcs = arcpy.ListFeatureClasses('',"arc") |
239 | 244 | fcs.remove("railnet_arc") |
| 245 | + |
240 | 246 | i = 0 |
241 | 247 | for fc in fcs: |
242 | 248 | arcpy.AddMessage("---> Updating Geometry for " + fcs[i] + " Route System ...") |
243 | 249 | itinerary = d + "\\mrn.gdb\\" + fc + "_itin" |
244 | 250 | orig_itinerary_dbf = d + "\\" + fc + "_itin_" + x1 + ".dbf" |
| 251 | + orig_future_routes_dbf = d + "\\future_routes_" + x1 + ".dbf" |
245 | 252 | ## Store copy of current itinerary coding for safekeeping ## |
246 | 253 | if os.path.exists(orig_itinerary_dbf): |
247 | 254 | arcpy.Delete_management(orig_itinerary_dbf, "DbaseTable") |
|
255 | 262 | arcpy.SelectLayerByAttribute_management(rail_lines, "CLEAR_SELECTION", "") |
256 | 263 | arcpy.FeatureClassToFeatureClass_conversion(rail_lines, e, "temp_route.shp", "", "", "") |
257 | 264 | if fc == "future": |
| 265 | + if os.path.exists(orig_future_routes_dbf): |
| 266 | + arcpy.Delete_management(orig_future_routes_dbf, "DbaseTable") |
| 267 | + arcpy.TableSelect_analysis(railrt, orig_future_routes_dbf, "\"OBJECTID\" >= 1") |
258 | 268 | outFile = open(outRtFl, "w") |
259 | 269 | f = 1 # row id number |
260 | 270 | for row in arcpy.SearchCursor(railrt): # loop through rows (features) |
|
272 | 282 |
|
273 | 283 | ## Run SAS to Update Itineraries ## |
274 | 284 | # -- finish set up to run SAS |
275 | | - y2 = c + "$" + orig_itinerary_dbf + "$X$3$X" |
| 285 | + y2 = c + "$" + orig_itinerary_dbf + "$X$3$X$X$" + orig_future_routes_dbf |
276 | 286 | cmd2 = [ bat, z2, y2, sas_log_file2, sas_list_file2 ] |
277 | 287 | subprocess.call(cmd2) |
278 | 288 | if os.path.exists(sas_list_file2): |
279 | 289 | arcpy.AddMessage("---> SAS Processing Error!! Review the List File: " + sas_list_file2) |
280 | 290 | arcpy.AddMessage("---> If there is an Errorlevel Message, Review the Log File: " + sas_log_file2) |
281 | 291 | arcpy.AddMessage("-------------------------------------------------------------------") |
282 | | - sys.exit([1]) |
| 292 | + sys.exit([1]) |
283 | 293 |
|
284 | 294 |
|
285 | 295 | ## << Part 3a: Create Routes with Updated Geometry >> ## |
|
0 commit comments