Seoul wasn't ready to be a megacity.

Spurred by post-war migration and a booming economy, the South Korean capital has attracted millions of new residents since the 1950s. Today, about 25 million people -- roughly half of South Korea's population -- live in the wider Seoul Capital Area.

But as people flooded into Seoul in the hope of higher living standards, the 600-year-old city began to buckle under the weight of its new population.

"We had no choice to expand, build the roads and bridges to include so many people and cars," said Mayor Park Won-soon.

Related: Google to build a futuristic neighborhood in Toronto

Multi-lane overpasses were constructed in the center of the city as suburbs sprawled outward. There are now 50 times as many cars on the roads as there were in the 1970s, according to the Seoul Institute, which was set up in 1992 to research how to maintain quality of life in the city.

Rapid urbanization demanded that city planners pause, think and innovate. In 2004, the Seoul Institute partnered with the mayor's office to begin a program to overhaul the ciy's public transportation. Thirteen years later, its nine-line subway is hailed as one of the world's best and a sophisticated monitoring system helps keep road traffic flowing above ground.

Related: London architect fights climate change with timber high-rises

It's an issue that has global ramifications. More than 6 billion people will be crowded into the world's cities by 2045, according to the United Nations. Seoul's city planners believe that by prioritizing pedestrians, transportation networks can help relieve some of the pressure of urban living.

"If you imagine without this sophisticated system, we would have been a very car-oriented city," said Chang Yi, a transportation specialist at the Seoul Institute. "We would have been like a traffic hell."

So just what makes Seoul's public transportation system special?

The headquarters of the city's Transport Operation and Information Service looks as if it's designed for monitoring space missions, not city bus routes.

Real-time information is gathered to move buses, cars and trains with maximum efficiency. Smart tickets count commuters on the subway. Sensors embedded in roads traffic conditions. A GPS network tracks taxis. All this information feeds into an instant and accurate traffic prognosis that's delivered to staff who use it to update detailed digital readouts on roadside signboards.

But while traffic congestion has significantly improved in the past decade, the mayor still sees work to be done.

"Seoul citizens have been addicted to cars for a long time," he said. In the task of reorienting the city to favor pedestrians rather than automobiles, "changing of the minds of the citizens is the most difficult and time-consuming job," he observed.

Related: Detroit's tiny homes offer a big chance for struggling residents

Seoul has embraced a series of urban-planning projects to make public spaces more attractive to pedestrians.

The latest is Seoullo 7017, an old highway overpass that has been converted into a garden in the sky. Much like New York City's Highline, the project has turned a hulking eyesore into green space for the public.

Seoul's government built it, and the people came. More than 3 million pedestrians have visited the walkway since it opened in May, according to the city government.

Seoullo 7017 gets its name from the opening of the highway overpass in 1970 and the opening of the new garden walkway in 2017. It's a nod to how Seoul has changed and a symbol for a city that puts its pedestrians first.