One of the world's largest open-air landfills, a vast, seaside mountain of trash where thousands of people have made a living sorting through the debris by hand, will close this weekend after 34 years in malodorous service.

Long a symbol of ill-conceived urban planning and environmental negligence, Rio de Janeiro's Jardim Gramacho dump is being transformed into a vast facility that will harness the greenhouse gases generated by the rotting rubbish and turn them into fuel capable of heating homes and powering cars.

Environmentalists had blamed Gramacho for the high levels of pollution in Rio's once-pristine Guanabara Bay, into which tons of run-off from the garbage had leaked.

Less clear is what will happen to the more than 1,700 people who work at the site, scaling hills of vulture-covered trash to pluck recyclable plastic, paper and metal from detritus.

These catadores will receive a lump-sum payout from the city, but there's no place for them at Gramacho's replacement, the hi-tech Seropedica dump, where most of the Marvellous City's garbage is already being sent.

"When you first get here, you're like, 'Ick, I don't know if I can do this,' but then you get used to it and you make friends and you find it's good work," said Lorival Francisco dos Santos, a 46-year-old from Brazil's impoverished north-east who spent 13 years at the landfill.

Gramacho's closure has been postponed several times over the years, and will finally take place just weeks before the UN's Rio+20 megaconference on sustainable development at the end of this month. It also comes as the city gears up to host the 2014 World Cup and the 2016 Olympics. "We've been telling the catadores about it for years, but they never believed it would really happen," said Gramacho's director, Lucio Alves Vianna.

Gramacho sprang up on unstable, ecologically sensitive marshland in 1978 and, for 20 years, functioned with little or no oversight. There was no floor lining to prevent toxic leaks, and the fetid juices produced by rotting organic material drained directly into the bay, making much of it unsafe.

In 1996, Rio authorities stepped in, ending child labour at the site, registering the catadores and restricting the kinds of rubbish the dump took to just household waste from Rio and four outlying cities.

Bulldozers began covering the picked-over trash with layers of earth. Now, with 12 layers each about 15ft high, the 321-acre facility has grown into a literal garbage mountain.

Contamination concerns spurred plans to close the dump and tap into the energy created by the decomposition of its estimated 60 million tons of trash. More than 200 wells will capture the carbon dioxide and methane that emanate from the decomposing rubbish and pipe them to a facility run by Brazil's state-controlled energy company, Petrobras.

Sales of carbon credits and biogas are expected to generate about $232m over 15 years, a percentage of which will go to payments to the catadores.

Rotting garbage currently accounts for 20 per cent of the region's total carbon dioxide emissions, and the move from Gramacho is expected to reduce carbonic gas emissions by 1,400 tons a year.

The closure of Gramacho comes months after Mexico City shut down its massive Bordo Poniente landfill, which led to thousands of illegal dumping sites throughout the city. The authorities were criticised for failing to ensure a viable alternative was in place. With the Seropedica facility up and running, Rio appears better prepared. It has been kitted out with a triple-layer seal to prevent leakage as well as sensors to detect any abnormality in the soil. Any leak will be captured, treated and used as recycled water, the new facility's operators said.

Many of the trash-pickers say they still have no idea what they'll do next. They expect one-off payouts of about US$7,500 each, but most say they the money will fast run out. Although dumping at Gramacho has tapered off, with an estimated 300 trucks daily, compared with 900 in years past, the catadores say they'll be hard-pressed to find another job that pays as well. Mr dos Santos said he used to earn up to $1,500 a month – an enviable sum in a country where the monthly minimum wage is just over $300.