Manassas and Roanoke were created because of railroad junctions. The Manassas Gap Railroad was not intended to connect with the Orange and Alexandria. A level roadbed was graded through Fairfax, but the Panic of 1857 forced the backers of the Manassas Gap Railroad to economize. Costs for construction of 20-25 miles of track was eliminated by the decision to intersect the O&A at a place named Manassas Junction.
In the Civil War, the Confederates burned the facilities at the junction twice, in March and August of 1862. During the Overland Campaign of 1864-64, when Grant finally captured Richmond, the site was largely abandoned. After the Civil War, however, the junction developed into a bustling community. It was chartered as a town in 1875, and soon thereafter managed to get the county seat moved from Brentsville to Manassas. Brentsville had been bypassed by the O&A Railroad because it was on a high spot, and railroads were constructed to avoid hills wherever possible. Unlike Warrenton, county seat of Fauquier, Brentsville was unable to get a spur line built to the county seat and, in the end, disappeared from the map.
Roanoke was the last "central city" to develop in Virginia. It developed after the landowners around "Big Lick" decided the wanted the Shenandoah Valley Railroad to intersect the Norfolk and Western (the former Virginia and Tennessee) at their location. Nearby Salem was not interested in becoming a rowdy railroad town, but the landowners just downstream on the Roanoke River welcomed the economic stimulus of the railroad business.
No railroad crossed the Shenandoah Valley, uniting the James and Potomac rivers, until after the Civil War. Pre-war Virginia politicians blocked projects that would steer trade to Baltimore rather than Richmond, Petersburg, Norfolk, or Alexandria. After the war, Northern financiers had sufficient economic leverage and political influence in the General Assembly to build a new north/south railroad and merge it into the Norfolk and Western in 1881-2.
The junction of the railroads could have been located as far east as Bedford or even Lynchburg, but economically it made sense to reduce the milegage of parallel track and unite the lines west of the Roanoke River water gap through the Blue Ridge. So topography, as well as politics, determined where the junction would occur.
Had the railroad been limited to just the farm trade of the Shenandoah Valley and Southwest Virginia, Roanoke may never have grown into a city of 100,000 people. Its growth is attributable to the development of the rich coal veins of the Appalachian Plateau in West Virginia and Tazewell, Buchanan, Dickinson, and Wise counties in Virginia. Demand was so great that at Pocahontas, the coal was mined and stockpiled on the route of the railroad in advance of the tracks being laid down and trains arriving in 1883. The Norfolk and Western RR located its locomotive manufacturing and repair shops in Roanoke, and the city grew so rapidly that it was knows as the "Magic City" at the turn of the century (1900).
In contrast, the population of Manassas did not boom. Even today, with population swelling as the city is "swallowed" by the Washington megalopolis, the population of Manassas is less than half that of Roanoke. The politics are substantially different as well. For decades, Manassas has been dominated by conservatives and is a Republican stronghold. The City Council had no Democrats and just one "independent" member for the last half of the 1990's. Roanoke is much more of a blue-collar union town, reflecting its manufacturing heritage, and usually records a strong Democratic majority in elections.
The Shenandoah Valley shows most clearly that railroads were developed by Tidewater cities to steer traffic to competing ports on the Fall Line. These ports were not seeking to build a transportation infrastructure for the overall benefit of the state, even though 40-60% of the railroad funding was provided by the Virgiia General Assembly.
The tiny, undercapitalized Winchester and Potomac railroad connected Winchester and the "lower" Shenandoah Valley to Harpers Ferry and ultimately Baltimore. There was a totally separate section of the Manassas Gap Railroad further south, connecting Mount Jackson and the middle valley with Front Royal and ultimately Alexandria. Even further south, "up" the Valley, there was a separate section of the Virginia Central connecting Covington to Waynesboro and ultimately Richmond.
But prior to the Civil War, there was no railroad track connecting Covington to Mount Jackson or connecting Mount Jackson to Winchester. The path of the Wilderness Road, with the easiest topographical route from the Shenandoah Valley to a port handling ocean-going ships, was ignored.
After 25 years of intensive railroad construction in Virginia, in 1861 no track ran the length of the Shenandoah Valley - or connected the valley to Lynchburg. The Shenandoah Valley Railroad was not constructed until 1881-2, when the railroads were controlled by out-of-state owners rather than Virginians. [Roanoke did not develop until that Shenandoah Valley Railroad was connected with the old Virginia and Tennessee, 15 years after the end of the Civil War.]
Why were the railroads were so fragmented? Why didn't they connect with each other more often before 1860? Separate tracks were built through the gaps in the Blue Ridge to funnel Virginia farm goods to Virginia ports, rather than to Baltimore or (horrors!) to Philadelphia...
In 1861, there were junctions of competing railroads at:
In Alexandria and Richmond, the competing railroads had separate terminals. Different investors were not inclined to share traffic with their rivals, even when they were located in the same cities. "Union Stations," providing a common passenger terminal for more than one railroad, came later.
The failure to connect railroads ensured wagon drivers ("draymen") had work hauling products between train stations. It also had military consequences. Prior to the outbreak of fighting in the Civil War, Robert E. Lee , working at the time as the military advisor to the govrnor of Virginia, was unable to get the owners of the Alexandria, Loudoun, and Hampshire (AL&H) raiload and the Orange and Alexandria (O&A) to build a piece of track connecting the railroads. As a result, when the Yankees occupied Alexandria on March 24, two valuable locomotives were isolated on the AL&H. To keep them from the Yankees, they were driven west away from Alexandria. Before the Manassas Line was abandoned in March, 1862, the locomotives were removed from the AL&H and carried across Loudoun and Fauquier counties to the Manassas Gap railroad at Piedmont Station (now Delaplane).
NOTE: Today, the old Manassas Gap Railroad is part of the Norfolk Southern. The track crossing the Blue Ridge between Manassas and Front Royal is known as the "B Line." Branches of the Piedmont Division of the Norfolk Southern are labelled in order, stretching south from Washington DC. The old Alexandria, Loudoun and Hampshire (today's Washington and Old Dominion biking trail) was the first branch line south of Washington, so it is the A Line. The second branch leaving at Manassas for the Shenandoah Valley became the B Line.