Like many a farmer, Ben Flanner rises with the sun. Like most crops, his need water and weeding -- bright tomatoes and fragrant basil, delicate nasturtiums, melons and eggplants, mustard greens, puntarelle, peas, beets, beans, kale -- about 30 fruits and vegetables in all, and then there are the herbs. But his farm is not like most farms. His farm is three stories off the ground. Beyond it is a sweeping view of the Manhattan skyline. Below it is a TV and film soundstage. Flanner's 6,000-square-foot farm is on a rooftop in the industrial Greenpoint section of Brooklyn. He hopes it can become a model for others who want to grow food but lack space. The problem in cities such as New York is always land. It's expensive and valuable, and it never makes more sense to plant than build apartments. But from a bird's-eye view, much of the city is rooftops. Most roofs are flat. They get direct sunlight, a rare commodity in a densely built place. In recent years, enthusiasm has grown for green roofs, hailed for harnessing rainwater that can overwhelm urban sewage systems, and keeping buildings warmer in winter and cooler in summer, lowering electricity use. But amid increasing interest in fresh, local food, this season seems to herald the era of the rooftop farm. It's as though somewhere someone decreed, 'Roofs shall not lie fallow.' And a colony of entrepreneurs, residents, schoolteachers and restaurateurs set to work. Flanner, 28, considered going to the country to farm -- only to realize he didn't want to leave the city, he just wanted to be a farmer. He quit his job at E-Trade and partnered with Annie Novak, 26, who had farming experience. The green-roof design firm Goode Green agreed to do the installation for free and the production company Broadway Stages agreed to pay for it, as an experiment on the roof of its Greenpoint building. It took two days for cranes to haul 200,000 pounds of soil made of lightweight expanded shale, like crushed brick, onto the roof. It cost $10 per square foot, or $60,000. Now it is up to Flanner and Novak to make a profitable farm. Flanner harvests in the mornings, barters vegetables for lunch at local eateries, and in the afternoons bikes dozens of pounds of produce to restaurants that have commissioned them. He and Novak run a Sunday farm stand. Across the country, a handful of commercial-scale rooftop farm start-ups have fashioned a rough formula for profit: It involves the distance vegetables must travel from farm to table, their consequent price and quality, and a city's food culture and population density. New York City seems to calculate high on the benefits, and hundreds of other rooftop gardens are in the works, some even large-scale. In Queens, the start-up Gotham Greens just signed a lease to build a 10,000-square-foot greenhouse on a roof and grow 30 tons of greens and herbs for sale. The company has a $1.4 million budget and will grow hydroponically, using recirculated water and dissolved nutrients to produce enormous yield without soil. 'We see it as a compelling business opportunity,' says co-founder Viraj Puri, who hopes to expand to larger rooftops and farm an acre or two at a time. In the South Bronx, an affordable-housing developer is designing a 10,000-square-foot rooftop greenhouse for an eight-story building to be run by a local food co-op. On the Upper West Side, the Manhattan School for Children is building a 2,000-square-foot greenhouse both for food production and environmental education. And this spring on the Lower East Side, Amber Kusmenko, 27, an animator, and her boyfriend hauled 4,000 pounds of soil to the roof of their co-op to build a 200-square-foot farm. 'It feels like a big accomplishment,' says Kusmenko of the cucumbers and bush beans she has been harvesting. The biggest obstacle is cost. A structural engineer must assess the roof's ability to bear weight. A base layer of heavy-duty plastic may be laid on the roof, and it may be retrofitted for drainage or even outfitted with a greenhouse -- though plenty of food can grow cheaply in a plastic kiddie pool or a basic wood box. Other aspects can be difficult, too, such as providing the amount of water plants need under direct sunlight, dealing with high winds, and hauling soil and other materials upstairs. The benefits are the sun, the ability to custom-engineer the soil for each type of plant, and the lack of pests -- snails, insects and rats, on ground level in the city. 'Our biggest pests were the squirrels and the landlady,' says Kerry Trueman, 49, who kept an edible garden on the roof of her West Village apartment until her landlady shut it down. Certain cities have led the way to the roof. In San Francisco, Mayor Gavin Newsom has required all departments to audit their land, seeking places suitable for urban agriculture. Chicago, where the mayor's office has a green roof, also has the country's first organic-certified rooftop farm, 2,500 square feet over a restaurant. Toronto just passed a law requiring green roofs on new buildings above a certain size, and many could include food. Sky Vegetables envisions building commercial-scale 10,000- to 40,000-square-foot rooftop farms in cities across the country and selling the produce to grocery stores and restaurants. The company is negotiating for test sites in San Francisco, Boston and Washington. The dream: after a year, 20 farms; after two years, 100. 'In the Northeast, half the year fruits are coming from California and elsewhere, and it's picked prematurely to survive the thousands of miles to get there,' chief executive Robert Fireman says. 'We have the competitive edge from savings in transportation costs.' In New York, there used to be more room on the ground. In the 1990s, there were several thousand community gardens, but as the city boomed, they were sold for development, and now the number is about 600. Willie Morgan, 71, has kept a vegetable garden in Harlem for 40 years, moving to a smaller plot when his previous garden was developed. Now buildings are being constructed on three sides of him. 'It's blocking my sunlight,' Morgan says. Green Roofs for Healthy Cities, which represents companies that create green roofs, says the number of projects its members constructed in the United States grew by 35 percent last year, though no one tracks how many involved vegetables and fruits. 'Everyone has in their mind that you have to start small, but we decided to just start big,' says Greenpoint's Novak. 'People we work with say, `Let's start with basil in planter boxes.' I say, `Let's cover your whole roof in dirt and start a farm.' ' 'It's different from the farm movement in the '70s, when people just wanted to get away,' she says. 'I want to change people's minds about food, and I can do that in the city. And also I love opera. When I'm off in a remote farm, I think, `Wow, I can't go to the Met.' ' 