New York has 14,000 acres of unused rooftop space, according to Laurie Schoeman, director of New York Sun Works, a nonprofit group that promotes the use of rooftop greenhouses. Rooftop gardens abound in New York, but without an enclosed greenhouse, the growing season is limited. Ms. Schoeman said that if all of these unshaded rooftops installed greenhouses, the resulting produce could feed as many as 20 million people in the New York metropolitan area.

It is tempting to wonder why it took so long for rooftop farming to emerge. Part of the problem in Montreal was that there was no zoning for agricultural buildings, which meant that getting the permits required for Lufa Farms took time and intense negotiation with the city. Finding a suitable rooftop also took time. Plus, cultural biases had to be overcome.

In agribusiness, food production has been about mass production. Perishable items like vegetables traditionally got short shrift, and consumers accepted bland produce. Low gas prices and relatively inexpensive transportation helped maintain that status quo. But the rise of the locavore movement in the past decade began to change attitudes and desires. Rising gas prices sent transportation costs soaring, and consumers became less willing to buy mediocre fare.

In 2006, BrightFarms opened as a consulting business for rooftop growers. It advised Gotham Greens, a New York-based company that recently built a 15,000-square-foot greenhouse on a Brooklyn rooftop with the intention of producing more than 30 tons of vegetables, fruit and culinary herbs a year for sale through local grocery stores, farmers markets and restaurants. Gotham Greens expects to begin producing crops this year.

More ambitiously, BrightFarms recently created a business model and started building its own rooftop farms. Instead of embracing the co-op model or selling to restaurants, it decided to specialize in making exclusive deals with supermarkets to build and operate farms.

Paul Lightfoot, chief executive of BrightFarms, said it could build a one-acre or 43,560-square-foot rooftop farm for about $2 million. BrightFarms has signed up eight supermarket chains around the country, including three of the largest 30 national chains, he said. Four of the farms are under construction, but BrightFarm’s partners declined to announce the deals before the markets are ready to sell produce, he said.

Mr. Lightfoot predicted each farm would generate $1 million to $1.5 million in annual revenue, and that he would sell produce for similar or even lower prices than traditional farms. He says he expects his gross margins to be extremely attractive because the company’s business model eliminates farming’s biggest expense, shipping.