This story is part of National Geographic‘s special eight-month “ Future of Food” series.

For most urban dwellers, visiting a working farm requires a journey into the countryside. But in a growing number of world capitals, a farm is just a short elevator ride away—on the roof.

In Singapore, Amsterdam, Hong Kong, Tokyo, and Montreal as well as several U.S. cities, farms have been built atop multistory buildings.

"Five years ago, there were virtually no rooftop farms," Steven Peck, founder and president of Green Roofs for Healthy Cities, told National Geographic. "Now they are starting to appear across the globe."

Peck says that as fossil fuels become more expensive and the number of urban dwellers continues to rise, urban farming will help feed the population without increasing the cost and pollution of food transport.

Rooftop farming was born out of the green-roof movement, in which building owners partially or completely cover roofs with vegetation atop special waterproof membranes. Green roofs use plants and flowers to provide insulation, create a habitat for local wildlife, help control runoff, put more oxygen into the atmosphere—and provide a welcome, verdant break from urban drabness.

Rooftop farms take the green-roof concept a step further, with plots that provide fruits and vegetables for local residents and the chance for urban volunteers to become part-time farmers.

"There is nothing more rewarding than sitting down at the end of a good day of working with our hands, watching the sun set over a healthy, productive farm, and enjoying some freshly picked vegetables as a team," said Anastasia Cole Plakias, vice president and founding partner of Brooklyn Grange, the world's largest rooftop farm.

The grange covers 2.5 acres (one hectare) on two buildings in New York City. More than 50,000 pounds of organically cultivated produce are grown there annually, for sale to local restaurants and at the grange's own farm stand. Chicken coops and more than 30 beehives round out the urban farming experience.

Brooklyn Grange opened in 2010 after Ben Flanner, the grange's head farmer and president, spent a year developing a 6,000-square-foot (557-square-meter) pilot project. With the information from that experiment, he and his partners scaled up to 43,000 square feet (3,995 square meters).

"As we realized that we were able to grow quality food in this unique setting, we dove in and pursued the idea without hesitation," Flanner said. "Our hopes and expectations were to grow as much tasty produce as possible and figure out the scale necessary to make all of the production and finances work."

That spirit has helped the organization increase its employee base, product line, and revenue streams. Events are also held at the farm, and schoolchildren visit often.

Brooklyn Grange also provides a nice getaway for the residents of the buildings below. Each week the farm opens its doors for visits from the hundreds of tenants as well as employees. "Having a farm on a roof is not a normal thing, so the farms are definitely the topic of a lot of conversation, excitement, and questions amongst the neighbors," Flanner said.

Other cities are joining the rooftop-farm movement. Peck ranks Boston along with New York City as the nation's top locations for rooftop farming. Cole Plakias notes that Chicago has long been a leader in greening rooftops.

"Taking that green-roof model to the next level and growing food in deeper soil is a relatively new concept that we've largely pioneered," Cole Plakias said. "New York City has been incentivizing green roofs with grants and tax abatements, which is a very smart move for a city facing aging storm-water-management infrastructure."

Such legislation has been important to creating rooftop farms in other cities, Peck said, as well as to helping build another alternative agricultural movement: vertical farms. This relatively new concept centers on the idea of a many-storied greenhouse with different crops grown on different floors.

Vertical farms have already helped the U.S. government grow genetically modified plants in Texas to use in vaccines. They've also been used to help Japanese residents around Fukushima find ways to farm again, since much of their land was lost to farming after it was irradiated in the wake of the 2011 tsunami.

In Milwaukee, Will Allen, one of the nation's green-roof pioneers, has begun work on building a five-story vertical farm. Allen says it could serve as a model for farms that go as high as a hundred stories.

Joe Nasr, of the Centre for Studies in Food Security at Toronto's Ryerson University, who has been studying urban agriculture for decades, notes that the rise in rooftop farming isn't limited to commercial operations. "Rooftop farming and gardening has become extremely diverse, and in that sense a more 'normal' presence in cities," he said.

In Toronto, he added, rooftop gardens and farms now appear atop restaurants, hotels, supermarkets, senior housing, rental housing, condo towers, old industrial buildings, schools, university buildings, community centers, and office towers.

In Peck's view, rooftop farming "is still very much in its infancy. But it has a lot of promise to provide jobs and healthy food in cities."