As a kid growing up in New York in the 1830s, David Shepard daydreamed about a far-off land that would become Minnesota. As a railroad engineer, he changed that land like few others.

With wide eyes, the young Shepard read about the "wonderful explorations" of 17th century friar Louis Hennepin and French mapmaker Joseph Nicollet, who came to St. Anthony Falls and charted the region more than 150 years later.

Shepard wondered "whether I should ever live to penetrate that wilderness," he wrote in a memoir when he turned 70 in 1898.

"It did not take long to solve that question," he said. By 29, Shepard moved to Minnesota — his home for the next 63 years. During that span, he arguably played as pivotal a role as his boyhood heroes in transforming a frontier region into what he called "a mighty aggregation of power."

A railroad engineer and contractor, Shepard had a hand in building 7,000 miles of tracks in 16 states and Canadian territories — including nearly 1,500 miles in Minnesota. He turned the first shovelful of sod in St. Paul in 1858 for the state's first railroad linking Stillwater, the Twin Cities, Breckenridge and Crow Wing — just as Minnesota became a state. As James J. Hill's close friend and sidekick, he would push the railroad across the Northwest during his 24-year career.

"Known as the greatest railway builder of his generation, few men have typified that generation so perfectly," the St. Paul Pioneer Press wrote in 1920 when Shepard died in his St. Paul home at 92.

Nearly a century later, nearly 100 of his descendants are wrapping up a weekend reunion in St. Paul.

"The public interest is clearly not the reunion but the story of an early Minnesota resident, employing thousands of workers building the rails that would connect our country," said great-great grandson Phil Harder of Wayzata.

In 1888, Charles Dudley Warner described in Harper's magazine the massive effort to span the nation with railroad tracks: "Those who saw this army of men and teams stretching over the prairie and casting up this continental highway think they behold one of the most striking achievements of civilization."

Shepard supervised much of that work. The year before, in 1887, his firm employed 8,000 men to grade 1,175 miles between Minot, N.D., and Helena, Mont. — and another 650 men to lay the tracks.

In Shepard's brief memoir, written "at the request of my grandchildren," he said he supervised an average of roughly 300 miles of new track a year, not counting docks, bridges, culverts, side tracks, depot grounds and grade changes. A few anecdotes help paint the portrait of this railroad giant.

At the height of his career, Shepard was inspecting a new stretch of tracks out West when he noticed a railroad spike dropped and forgotten on an embankment. He picked it up and showed it to the crew's foreman.

"I can't afford to have material wasted," he said. "Keep better tabs on your stuff."

The quick-thinking crew chief said he was so glad Shepard found the spike, which he'd been looking for in vain. Shepard walked on, "a twinkle in his eye," and soon promoted the foreman.

Then there was the time in 1870 when Shepard, then a railroad superintendent, was riding as a passenger on a train from Winona. A 50-ton boulder tumbled down an embankment, blocking the track.

The train workers decided the only option was to return to the last station and await a work train to repair the track. That's when Shepard walked up to the conductor, who asked what they should do.

"Go around it, sir," Shepard said, directing passengers and workers to tear up and rebuild the damaged stretch. Within three hours, the train was back on track.

A philanthropist who poured some of his riches back into the community, Shepard pledged $100,000 for an early St. Paul library after his pal, Hill, promised to kick in $250,000. The city decided to use public funds instead, but Shepard's offer "spurred the city to completion of the project," his obituary said.

When he penned his memoir, Shepard flashed back to that first spadeful of dirt he turned for a Minnesota railroad in 1858. "Who could have foretold that the turning of that sod was to fructify," within 40 years, into a state of nearly 1.8 million people with more than 6,000 miles on interconnecting rail lines?

"No descendant of mine who reads this memoir can ever witness the application of so many and such wonderful inventions and discoveries for the quick transmission of matter, power, intelligence, and sound to remote places, in his generation, as I have had the happiness to witness and enjoy in mine."

Not that it was always easy. After that first shovel was turned, a financial meltdown halted railroad construction for four years. Shepard bided his time, writing that "I was sure there was a future for Minnesota, and steadfastly waited for my time to come."

Curt Brown's tales about Minnesota's history appear each Sunday. Readers can send him ideas and suggestions at mnhistory@startribune.com. A collection of his columns is available as the e-book "Frozen in History" at startribune.com/ebooks.