When people talk about cities of the future, they’re often picturing something like the old Jetsons cartoons, with lots of robots and flying cars. Robots and flying cars are coming alright. But the key thing, if we want to have cities we love, is to remember who we’re designing them for: People.

In the 20th century, we lost sight of that. Back then a different technological revolution was upon us—automobiles. We fell so hard for them that we redesigned our cities around them. Especially in the United States, we created a sprawl of highways and parking lots, strip malls and cul-de-sacs, a landscape that is accessible only by car.

It’s a landscape that, as Atlanta urban designer Ryan Gravel put it to me recently, “is so not what the future wants.”

Sprawl is bad for climate, bad for our health, bad for our sanity, and bad for our wallets. In 2018 congestion cost the average American nearly 100 hours and more than $1,300, according to INRIX, a traffic research firm. In some other countries the problem is even worse.

In the April issue of National Geographic magazine, which is devoted to cities, I write about efforts to fix sprawl. I focused on people and places that are trying to walk back this fundamental error of the past, not just because it makes economic or environmental sense, but because we want cities to be places we love to live.

Peter Calthorpe is a pioneer of the New Urbanism, an urban design movement that’s been combatting sprawl in the U.S. for decades. “You know what cities are in essence?” he said to me one morning, as we sat in traffic on the San Francisco Bay Bridge. “They're about shared space.”

“You know, instead of a private yard, you have a great park. Instead of spending all your time in your living room, you spend time at the pub or the café. Instead of driving your own car, you use transit. But to make that competitive, all those things need to be high quality. Otherwise it probably is better to escape into your private little bubble.”

The purpose of cities is to get us out of our bubbles and bring us together. Here are five cities that are trying hard to do better:

1. Los Angeles: The streetcars’ revenge

Los Angeles ripped up or paved over the last of its streetcar tracks half a century ago. So did just about every other city in the U.S. But Los Angeles is an especially heartbreaking case: The sprawling metropolis we now think of as the paragon of car culture actually grew up around an urban rail network, which until after World War II was one of the world’s most extensive. From most places in the city you could walk to a stop.

View Images The Expo light rail line, completed in 2016, runs 15 miles from downtown Los Angeles to Santa Monica. It's one of several new metro and light rail-lines financed by sales tax hikes approved by two thirds of Los Angeles voters, who are tired of freeway congestion. Photograph by Monica Almeida, The New York Times/Redux

Now Los Angeles is in the midst of a major expansion of its metro and light-rail—in some cases following old streetcar lines. In the last decade L.A. county voters have twice approved sales tax increases to fund transit, most recently adding $120 billion to the budget over 40 years. The Expo light-rail line from downtown to Santa Monica opened in 2016, and the Crenshaw line to LAX airport is scheduled to be completed next year. The Purple line subway is being extended west along Wilshire Boulevard and is expected to reach Beverly Hills by 2023.

New public transit alone, experts agree, can’t cure sprawl or the city’s famously congested freeways. That won’t happen unless and until enough new multi-family housing has grown up around the transit lines, and the city has changed some of the policies that subsidize driving—by adding tolls on the freeways, for instance.

But investing in transit is a necessary first step. The goal, says Borja Leon, who was transportation deputy in the mayor’s office until last year, is to “create that spider web around Los Angeles, to have the option to abandon your car.”

2. Hamburg: Growing the inner city

In the 750-year-old church of St. Katharinen, in downtown Hamburg, I sat with pastor Frank Engelbrecht and talked about urban planning. When the city was fire-bombed in World War II, he told me, the church’s copper roof melted and its tower collapsed. After the war, the church was rebuilt, but Hamburgers themselves chose to blast a six-lane road through downtown, right past St. Katharinen. “There were two destructions of the city,” Engelbrecht said. Downtown Hamburg became a business district where almost no one lived.

View Images Residents and workers enjoy a sunny day in HafenCity, a new district rising from the old harbor in central Hamburg, Germany. The distinctive silhouette of the new concert hall, the Elbphilharmonie, is visible in the background, on the bank of the Elbe River. Photograph by Ralf Brunner, laif/Redux

That is changing now—and St. Katharinen’s congregation is swelling again—thanks to HafenCity, Europe’s largest inner-city redevelopment project. A few hundred yards south of the church and less than a mile from city hall, on more than 300 acres of derelict port and industrial land along the Elbe River, Hamburg is building an entirely new urban district—a walkable, vibrant one that is meant to meld with the rest of the inner city and rejuvenate it. HafenCity will enlarge the city center by about 40 percent.

The city is very much in charge: It owns the land. And instead of auctioning it off wholesale to one or two large developers, it’s meting the land out parcel by small parcel, setting aside some for homeowners’ co-ops and for affordable housing. “You get a property not because you offered the highest price but because you had an interesting concept,” said Franz-Josef Höing, Hamburg’s city-planning chief.

Each individual building plot in HafenCity is being raised around 13 feet above its current level, to prepare for the rising seas and storm tides of the next century; basement garages are being protected with water-tight doors. But with HafenCity, Hamburg is also planning for sustainability in a broader sense. “Just saying we’re not going to keep building the city out at the edges, but in the center, is a big sustainability statement,” Höing says.

The guiding principle of the new district is mixed use: HafenCity is getting office and residential buildings in roughly equal measure, with generous amounts of public spaces and parks. The idea is that people should, if they want to, be able to live, work, shop, play, and go to school in one place, without long commutes. It’s an idea that was once obvious—but in the second half of the 20th century, as cities in both Europe and the U.S. flung themselves outward into the suburbs, it was somehow forgotten.

3. Shanghai: Reclaiming the river

Shanghai is returning the Huangpu River to its citizens. The city had been talking about the idea for more than a decade, but the scale and speed of the project, when it finally began in 2016, still surprised Qian Xin. Qian is a vice president at the Shanghai Urban Planning and Design Research Institute, which was tasked with planning the project: a 14-mile-long park through the dense core of China’s largest city, on both sides of the Huangpu, with walking, running, and bike trails, a lot of it on industrial land that had blocked access to the river.

The Huangpu project is just one sign of a fundamental shift in China: After decades of explosive growth, during which a half billion people moved into Chinese cities, the government says it wants to make them more humane. “China is experiencing huge change in urban planning,” Qian said.

From the windows of our restaurant on the Bund, the old colonial-era district on the west bank of the Huangpu, we could look across the river to the bright lights and gaudy skyscrapers of Pudong: a district of five million people that did not exist in 1993, when Qian started his career. That was an exciting time to be an urban planner. It was also an unsustainable time, Qian said. Many regrettable decisions were made.

Shanghai avoided some of the worst. Even as it was building Pudong on the east side of the river, it preserved the old courtyard houses of Xintiandi on the west side. “This is the first demonstration in China that historical buildings have value in modern life,” said Pan Haixiao, a transportation researcher at Tongji University in Shanghai. When the car explosion happened in the 2000s, and cities all over China were building cookie-cutter apartment towers on broad boulevards, so there would be a place to put all the cars—a kind of vertical sprawl—Shanghai held onto part of its dense city center. Now it’s trying to make the city more livable.

China moves fast: It took just a year, 2017, to build 14 miles of trails along the east bank of the river, at the foot of the Pudong skyline. I walked and biked along a few miles of it, past giant grain silos that are now an exhibition space, past an art gallery and cafes and benches. The trails were mostly empty in the mid-afternoon, but as the sun went down behind the Bund, young office workers started to stream into the park from the towers of the financial district. They leaned on the railing and watched the freighters go by, headed to and from the Yangtze.

4. La Paz: Flying to work

In Bolivia you can fly over the capital city for about 40 cents. You can sail from the center of La Paz up the steep mountainsides that surround it, looking down on kids playing soccer in the streets and underwear drying on rooftops and the dead lying in a cemetery as tightly packed as the living city. Floating above it all, you watch one neighborhood gradually change to another—from the more affluent ones in the valley to the poorer ones high up the slopes.

View Images In La Paz, Bolivia's mountainous capital, ten cable-car lines built since 2014 provide the city's first effective mass transit, transporting 250,000 people a day. Photograph by Andrew Moore, National Geographic

La Paz has acquired its first real mass transit system—and it’s a system of cable cars called Mi Teleférico. Since 2014 Dopplmayr, an Austrian firm known for its work in ski areas, has been building cable-car lines in the mountainous Bolivian capital; the tenth line opened on March 8. Installing cable cars is a lot cheaper and easier than building a light-rail line, let alone a subway. The gondolas arrive every 12 seconds or so and carry 10 people each. All together they now carry an average of 250,000 people a day—more than many American transit systems.

Along with a public bus system that also launched in 2014, the cable cars are tying the sprawling city together as never before. It used to take an hour in a minibus or cab to ride from the poor district of El Alto, on the plateau, down a thousand feet of altitude into the city center. Now it takes 10 or 15 minutes in a gondola that floats serenely over the jammed and smoggy mountain roads. The regular fare is 3 Bolivianos, or 42 cents, but senior citizens and students get a discount.

5. Atlanta: A belt of connection

Atlanta is one of the most sprawling cities on Earth, and that won’t change soon. But if it does, Ryan Gravel told me, it will be because the culture has changed, because what people expect from their city has changed. It will be in part because of inspiring projects like the BeltLine.

View Images A couple takes an early-morning walk on the east side of the Beltline, a trail that reuses abandoned rail lines to connect neighborhoods in Atlanta. When completed it will form a 22-mile loop around the city—some or all of which may also be occupied by a streetcar line. Photograph by Dustin Chambers, The New York Times/Redux

Conceived by Gravel after he spent a junior year abroad in Paris, where he discovered the joys of a walkable city, the BeltLine is an effort to convert a 22-mile loop of abandoned rail lines around central Atlanta into a walking and biking trail—and ultimately, it’s hoped, into a streetcar line. Around a third of the trail has been completed, and it has catalyzed $4 billion in economic development in the city. Little towns around Atlanta now want their own walking trails, said Ellen Dunham-Jones, an architect and urban designer at Georgia Tech.

From his workspace in the Ponce City Market, Gravel and I walked a few blocks along the BeltLine, past new apartment buildings and restaurants that would probably not exist had the trail not been developed. Bikers and joggers and skaters of all description streamed by us on the trail. What was once a forbidding strip of derelict wasteland that separated neighborhoods from one another is becoming a means of joining people together. “It’s kind of beautiful,” Gravel said—and he meant the renaissance more than the trail itself. The question is whether the BeltLine can bring transit and connection and that kind of renaissance to the poorer neighborhoods of Atlanta that need it most, on the west and south sides of the city.

Gravel has moved beyond the BeltLine and done a plan for the whole city. Called Aspiring to the Beloved Community, it’s not a detailed design, but a vision of how the city, as its population continues to surge in the coming decades, might start to heal all its old wounds—racial, social, ecological. Atlanta has adopted it as a guide. When Dunham-Jones first saw it, she cried.