The new San Francisco legislation could create more cooperative farms like Alemany Farm. (Photo by Brett Emerson.)

Bay Area locavores and caterpillars rejoice: An edible urban jungle is poised to sprout in San Francisco.

City supervisors approved legislation Tuesday that will help grassroots farming groups replace barren concrete and forests of weeds on vacant land and rooftops with veggie gardens, chicken coops, and honeybee hives. And the move cements San Francisco’s role as a national leader in urban food production.