A study published in Cities by researchers at ICTA-UAB, with collaboration from the CRM’s Knowledge Transfer Unit, estimates that 65 hectares of municipal rooftop could supply 31% of the tomatoes consumed in Barcelona each year.
Barcelona has 65 hectares of rooftop distributed across 437 public buildings that could host productive infrastructure with minimal modification to the buildings themselves. A study published in Cities estimates what those roofs could produce if they were covered with greenhouses and planted. In the most productive of the scenarios modelled, a single crop cycle of tomatoes yields 8,866 tonnes, equivalent to 31% of the 28,549 tonnes the city is estimated to consume annually. The rooftop area involved amounts to 0.64% of the 101.4 km² over which Barcelona extends.
The work is authored by Diego Maximiliano Macall, Xavier Gabarrell Durany and Sergio Villamayor-Tomas, of the Institut de Ciència i Tecnologia Ambientals (ICTA-UAB), together with David Romero i Sànchez, of the Knowledge Transfer Unit (KTU) at the Centre de Recerca Matemàtica.
Scope of the study
For Macall the question is about a food system’s architecture. The rooftops are where this particular version of it happens to situate its productive component. The agrifood systems through which cities are currently supplied are complex and increasingly exposed both to climate change and to geopolitical tension. “Bringing part of production closer to the point where it is consumed strengthens nutritional and food security,” he says. Barcelona’s roofs are a surface that already exists and goes largely unused.
He is careful about the size of the claim. Urban agriculture is not going to replace conventional agriculture, and the study does not argue that it should. What it can be is one component of a more diversified and more resilient agrifood system, provided public policy supports it.
The study addresses three crops: tomato, bell pepper and lettuce. Macall explains that the selection responded mainly to agronomic viability inside a greenhouse and to economic return per square metre for the grower. Tomato and bell pepper dominate the intensive greenhouse horticulture of Almería, where together they accounted for 63.2% of the 33,250 hectares under cover in the 2022-2023 season, and earlier trials in a building-integrated greenhouse near Barcelona had established that lettuce also performs well under these conditions. On the demand side, all three rank high among the twenty-one most consumed vegetables in Catalonia according to the Household Food Consumption Panel published by the Spanish Ministry of Agriculture, Fisheries and Food. “Spain has some of the best food consumption statistics I have ever seen,” says Macall, who has previously worked in Canada and the United States. “That made the work a great deal easier and gave us considerable confidence in the quality of the data.”
The question has a policy context. The Government of Catalonia has set a target of 50% food self-sufficiency by 2030, and is planning to expand the open-field area dedicated to vegetables, which would most likely come at the expense of land currently under cereals and on sites with unfavourable agronomic conditions for vegetable production.
Production scenarios
Tomato generates €9.82 of revenue per square metre harvested, against €3.47 for bell pepper and €0.28 for lettuce, so any allocation driven by revenue concentrates heavily on a single crop.
In the first scenario, the entire 650,000 square metres goes to tomato, producing 8,866 tonnes, the highest output of the three. The second applies a linear programming model that reserves 60% of the surface for tomato, reflecting its share of consumption relative to the other two crops, and assigns the remaining 260,000 square metres to the next most profitable crop. It yields 5,320 tonnes of tomato and 1,014 tonnes of bell pepper, with no space allocated to lettuce at all. The third distributes space in proportion to consumption, 60% to tomato and 20% to each of the others, and produces 5,878 tonnes of tomato, 507 tonnes of bell pepper and 78 tonnes of lettuce, a combined 6,463 tonnes.
A sensitivity analysis considers the more conservative case in which municipal authorities permit greenhouses on only a fraction of the available area. If a 90 m² greenhouse were installed on each of the 437 buildings available for their installation, using 6% of the total surface area available, production falls to 535 tonnes of tomato, 153 tonnes of bell pepper and 24 tonnes of lettuce. Six per cent of the surface produces roughly six per cent of what the full 65 hectares would yield, and under 2% of the city’s annual tomato consumption.
The mathematical approach
The allocation of a limited surface among competing crops is an optimisation problem, and the study formulates it as one. “Optimising is looking for the best way of doing something,” says Romero. “Obtaining the greatest benefit, spending less time, or making better use of the resources you have.” He points out that the operation is entirely familiar outside mathematics, from choosing a route across a city to splitting a household budget, and that at larger scales it governs the distribution of goods between warehouses and shops or the coordination of connected devices so that they consume less energy without overloading the network. None of those examples involves a greenhouse. The mathematics does not much care what is being divided up.
“It is like packing a suitcase. Not everything fits, and you have to decide what goes in to make the most of the space.”
David Romero i Sànchez, CRM Knowledge Transfer Unit
Romero describes the linear programming at the core of the study as a kind of mathematical puzzle. There’s a limited space, several crops, their yields and prices, and a set of rules that have to be respected. The model distributes the surface among the three crops subject to two constraints: the combined area cannot exceed the 650,000 square metres available, and in the second scenario 60% of it is fixed to tomato.
Projecting crop yields required a separate treatment, since no city has yet scaled rooftop greenhouse production to this level. Yields were derived from 960,400 Monte Carlo simulations, which as Romero puts it involve repeating the calculation many times over while changing the data within plausible values, in order to test many possible realities. The scenarios were then compared through the sensitivity analysis, “like moving the model’s controls one by one to find out which ones have the most influence.”
He is also explicit that an optimisation rarely delivers one clean answer. There may be several optima, and then something other than the model has to choose between them. The data carry uncertainty. And someone who knows the context can reasonably decide against what the model says, which happens.
Assessments of urban agricultural potential often just multiply the available surface by an average yield. Formulating the problem as an optimisation instead requires converting it into a formal model, “identifying what we can modify, what we want to achieve and what limitations have to be respected,” Romero says. “Optimisation doesn’t only give you a number. It finds the best possible allocation, and it lets you explain where that result comes from, which parameters influence it and what happens when they change.”
Assumptions and limitations
“Behind every optimisation there is usually a model,” Romero says, “a simplified version of reality that explains that reality well enough.” The authors are explicit about what this one leaves out. Yields are assumed to be uniform across all rooftops, and local differences in temperature and radiation are not incorporated, nor is the orientation of a given roof or how much of the day it spends in shade, although the roughly 380 metres of altitude separating the Raval from the Fabra Observatory correspond, as Romero notes, to appreciably different average temperatures.
Farm-gate prices are treated as fixed parameters. The authors acknowledge that a substantial increase in supply would exert downward pressure on prices, and that modelling this feedback would require a general equilibrium framework outside the scope of the study. The logistical challenges of operating a distributed production system across 437 buildings that were not designed to host greenhouses also remain unresolved, and the paper identifies them as a determinant of the system’s eventual profitability.
None of this is treated as a defect. “Adding more parameters doesn’t always provide more information, and it can complicate the problem unnecessarily,” Romero says. “What matters is that, despite the simplification, the model explains well enough the reality you want to photograph, and lets you understand what determines the results.” The relationships modelled here are linear, which is what makes the problem tractable. Future versions might allow yields to depend on the combination of crops, on available water or on the location of each roof, which would lead to non-linear optimisation problems, harder to handle and potentially closer to reality.
How an agronomist found a mathematician
The collaboration began at the first ICTA-CRM Joint Workshop, held at ICTA-UAB on 23 May 2022 on the initiative of Gabarrell, then director of ICTA. Around twenty researchers from the two María de Maeztu Units of Excellence on the UAB campus presented their work in two cycles of short talks, with the explicit purpose of identifying possible collaborations rather than holding a conference. The CRM works from mathematics, which Macall describes as “a universal language for all the sciences,” while ICTA’s focus is sustainability and the environment. The two units share a campus and, before that morning, not a great deal else.
Romero presented work on complex systems, using Barcelona’s transport system as a case study. Macall, who wanted to treat the city as a fragmented two-dimensional grid and use a linear programming model to assign the most profitable crop to a scarce resource, recognised the connection immediately. “I knew at that moment that I needed to talk to him,” he says.
“David understood exactly what I wanted to do from the first minute, and more importantly he knew which mathematical tools were the right ones for the problem.”
Diego Maximiliano Macall, ICTA-UAB
The study became the second article of his doctoral thesis. Macall is an agronomist whose earlier experience ranged from subsistence farming in Central America, where a bad season can send a grower north without papers to send remittances home, to the arable holdings of the Canadian prairie and the sugarcane that supplies Brazil’s ethanol industry. Set against that, the proposition took some getting used to.
“The first time somebody talked to me about urban agriculture, honestly, I laughed,” he says. “I found it hard to believe it could have any significant impact. But that’s precisely the beautiful thing about science. Science always has the ability to make us humble. In the end, the methodology is the methodology and the numbers are the numbers.”
He thinks the quantitative framing matters well beyond rooftops. “It pains me to say it, but in the environmental sciences we haven’t been as effective as we hoped in convincing governments and society,” he says, at a point when climate change has stopped being a future threat and governments are contending with low growth and geopolitical tension. “Our discourse was largely qualitative. We explained very well why the problem existed, but often we couldn’t translate those ideas into concrete figures that could be used in designing and comparing public policies.”
An optimisation model does not stop at the proposition that urban agriculture may be worthwhile: it establishes how much could be produced, which crops should be prioritised and how the available space should be distributed. Those results can then be weighed against alternative uses of the same rooftops, such as photovoltaic installation, rainwater collection or green space. The value, in Macall’s account, lies in “turning very complex questions into information that can be compared, evaluated and, in the end, used to make better decisions.”
He is candid, too, about how rarely this happens. “There are brilliant minds at the UAB,” he says, “but much of the time each of us works within our own discipline and ends up always talking to the same colleagues.” Nobody, he adds, can claim the world is going through an easy moment, and the problems that matter are the kind that need several disciplines applied at once.
This particular contact has outlasted the paper. Romero and Villamayor-Tomas are co-supervising a Master’s thesis on the modelling of depopulated rural areas, the phenomenon known in Spain as la España vaciada.
Romero situates the collaboration within the KTU’s remit of connecting the mathematics developed at the centre with specific problems posed by industry and public administration, alongside projects such as ENHANCE Europe, on solar collectors integrated into asphalt, and work on public transport demand prediction in Barcelona. Between proving a theorem and having that knowledge prove useful for a real problem, he notes, there’s a road that is often long. He cites optimal transport theory, which began with the problem of moving earth with minimum effort and now supplies tools used in logistics, cell biology, image analysis and artificial intelligence. “Being able to put mathematics at the service of these challenges makes us feel, modestly, a little more useful.”
The study closes with a recommendation that no model can address. Before 65 hectares of Barcelona’s rooftops are given over to greenhouses, the authors argue, the city’s residents should be consulted on the resulting alteration to a skyline currently dominated by the Sagrada Família.
Reference
Macall, D. M., Gabarrell Durany, X., Villamayor-Tomas, S., & Romero i Sànchez, D. (2026). A food system innovation: Vegetable production in rooftop greenhouses in Barcelona. Cities, 171, 106698.
Newsletter
Get the latest CRM news and activities delivered to your inbox
Subscribe now
Recent newsletters →
Boundary Conditions Day
Fixed-Point Day
La desfilada dels nombres: una ruta per Barcelona
CRM July Newsletter
CAVARET 2 brings together 83 researchers on curves and abelian varieties at the Universitat de Barcelona
The second edition of CAVARET, "Curves, Abelian VArieties and RElated Topics", took place at the Faculty of Mathematics and Computer Science of the Universitat de Barcelona from 13 to 17 July 2026. Sixteen invited lectures and ten posters brought together 83...
|
|
CRM CommPau Varela
|





