When David Michaels moved to Chicago this year, he chose the Emme apartment building in part because of the third-floor green roof, which has a lawn, an area for grilling, fire pits and a 3,000-square-foot vegetable garden.

“The green space was a huge factor in choosing this apartment,” Mr. Michaels said. “My wife and I are out there every other night, grilling or relaxing. And we like that they host classes out there.”

The Emme actually has two rooftop gardens — the one visible to residents on a deck on the third floor and a 5,000-square-foot garden on the roof of the 14-story building. Both are run by the Roof Crop, an urban farm that grows food for restaurants on a handful of roofs in Chicago. Residents at the Emme can also subscribe to regular bundles of rooftop-grown fruits and vegetables.

As concerns about climate change and dwindling natural resources grow, green roofs have become increasingly popular. The Toronto-based organization Green Roofs for Healthy Cities estimates an increase of about 15 percent in the number of green roofs in North America since 2013.