City dwellers are growing their own food on a much greater scale than previously thought, farming an area the size of the European Union, according to the first comprehensive study on the global scale of urban agriculture.

Most of the land - which totals some 456 million hectares - lies just outside of cities, although 67 million hectares of it is being farmed in urban centres, the study published in the November issue of the journal Environmental Research Letters found.

"It is surprising to see how much the farm is definitely getting closer to the table," Pay Drechsel, a co-author of the study and a scientist at the International Water Management Institute, said in a press release.

Urban farms typically grow relatively expensive foods, like fresh vegetables, compared with the wheat or rice which are usually produced on large rural holdings.

In sub-Saharan Africa urban farmers supply up to 90 percent of the leafy salad greens consumed in the region's fast-growing cities.

In Ghana, some 2,000 urban vegetable farmers are supplying greens to 800,000 people every day, Drechsel said.

In Accra, Ghana's capital, urban farms recycle more waste water than local treatment plants, re-using about 10 percent of household wastewater and helping to keep the city a little cleaner.

The study's findings are good news for food security as the planet's population becomes increasingly urbanised.

The world's urban population increased from 2.86 billion in 2000 to 3.88 billion in 2014, according to the World Health Organization.

Today, 54 percent of the world's population live in urban areas, and that number is predicted to increase to 66 percent by 2050, with much of the growth in developing countries, according to U.N. figures.

Urban farming, however, still has a perception problem, especially in developing countries where it is most necessary.

"We see this dichotomy where urban farming in wealthy countries is praised for reducing emissions and enhancing a green economy, while in developing countries, it can be regarded as an inconvenient vestige of rural life that stands in the way of modernisation," Drechsel said.

"That's an attitude that needs to change."