figure b


Increased physical activity is linked to reductions in risks of type 2 diabetes and obesity [1,2,3]. Neighbourhood features (e.g. parks, green spaces, physical activity facilities) are important determinants of physical activity [4], especially in more disadvantaged neighbourhoods [5, 6]. Population-level approaches targeting neighbourhood environment features may be promising strategies to address type 2 diabetes and obesity [7, 8], especially in light of existing type 2 diabetes [9] and obesity [10] social gradients. For example, social determinants of health are key drivers of type 2 diabetes and related outcomes [11].

Increased physical activity opportunities at the neighbourhood level are associated with lower obesity [12] and type 2 diabetes risk [13]; for example, higher availability of green and open spaces is associated with lower type 2 diabetes prevalence [14, 15] and incidence [16, 17]. However, few studies have investigated relationships between the availability of exercise facilities and obesity and type 2 diabetes [12, 18]. Exercise facility programmes tend to be structured and occur at moderate to vigorous intensity [19], eliciting health benefits [20]. Therefore, higher availability of exercise facilities potentially increases opportunities for structured exercise, which is associated with a lower prevalence of obesity [12] and greater reductions in HbA1c, compared with delivering physical activity advice alone [21].

We previously demonstrated a social gradient for exercise facility availability in Madrid [22] and for type 2 diabetes prevalence, incidence and control [9]. Previous research has shown that amenities conducive to physical activity, including parks and green spaces, can reduce health inequities [23]. Moreover, there has been limited research exploring exercise facility differences by sex, and the little available evidence shows that women are less likely to use exercise facilities than men [24]. Thus, examining relationships between exercise facilities and type 2 diabetes and obesity by area-level socioeconomic status (SES) and sex can help identify potential interventions to address these inequities by focusing on populations most in need.

The study aims were as follows: (1) to examine the association between availability of exercise facilities and the likelihood of obesity and type 2 diabetes in the adult (40–75 years old) population of Madrid; and (2) to examine interactions with area-level SES and sex.


Study design

A population-based retrospective cohort study using data from primary care electronic medical records (EMRs) in Madrid, Spain was conducted. This study was developed based on the REporting of studies Conducted using Observational Routinely-collected Data (RECORD) statement [25]. The study followed a multilevel design using variables at the individual (age, sex, obesity and diabetes) and neighbourhood level (population density, SES and exercise facility availability).


This study is part of the Heart Healthy Hoods (HHH) project, which broadly aims to study associations of the social and physical urban environment with cardiovascular health and inequity in Madrid, Spain [26]. This study was conducted across the municipality of Madrid. In 2017 Madrid had a population of 3.2 million residents and it is divided into 21 districts that are composed of 128 neighbourhoods. Within each neighbourhood there are small geographical administrative units of ~1500 people each, called census tracts (secciones censales) (N=2415) [27]. Further information about the demographic composition of the administrative units in Spain is shown in electronic supplementary material (ESM) Table 1.

Study population

The HHH cohort is based on real-world data from primary care, including information about 1,305,050 residents. The individuals in the HHH cohort represented 91% of the total population of the age group included in this study (40–75 years) living in Madrid [27]. The study population was selected according to the HHH project criteria [28] as individuals: (1) registered at one of the 128 primary healthcare centres in the municipality of Madrid; (2) who live in the municipality of Madrid; (3) aged 40–75 years; (4) registered in the EMRs of the Primary Health-care Service of Madrid (AP-MADRID) in 2017, with no missing data for obesity and/or diabetes.

Health outcomes

Diagnoses (recorded by primary care physicians during their usual clinical care) were extracted from EMRs for all individuals. These diagnoses were coded according to the International Classification of Primary Care (ICPC-2; Type 2 diabetes was defined using the T90 diagnosis code (‘diabetes non-insulin dependent’). Type 2 diabetes diagnoses in the Primary Health-care Service of Madrid dataset have been previously validated with a κ of 0.99, with a sensitivity of 99.5% and a specificity of 99.5% [29]. Obesity was defined as BMI ≥30 kg/m2 and was objectively measured.

Exercise facilities

Exercise facilities were defined as venues that offered exercise programmes, whether free, monthly subscription or pay per session (e.g. fitness clubs, sports centres, dance clubs, Pilates studios), and regardless of whether they were publicly or privately owned. Exercise facility information was collected by ‘MAS Servicios Integrales’, a fitness consultancy firm, between April and October of 2015. All exercise facilities meeting these criteria across Madrid were identified using Google Maps. Information about the programmes and services was sourced through telephone and face-to-face interviews with facility managers. More information about data collection can be found elsewhere [22]. The final exercise facility dataset comprised 595 facilities with information collected for five characteristics: (1) facility name; (2) facility physical address; (3) monthly price; (4) types of programmes and services offered; (5) ownership (public vs private) (see ESM Table 2).

Availability measures

We captured residential building entrances (hereafter called portals) in Madrid (Fig. 1). This was done by identifying all external access points to residences located in residential land use using the GEOPORTAL of the Madrid City Council [30]. Spatial measures were calculated using QGIS 3.10.5 software. Based on the definition by Penchansky and Thomas [31], exercise facility availability was calculated as the count of facilities within a 1000 m street network buffer from each portal. All portals in a census tract were aggregated and a mean count of exercise facilities for each census tract was calculated. The 1000 m buffer has been used in exercise facility research [12, 22, 32, 33] and is regarded as an appropriate walking distance for undertaking daily activities [34]. Also, a 1000 m street network distance from home to an exercise facility showed the highest correlation with moderate to vigorous physical activity [32]. Census tracts were stratified into tertiles of exercise facility availability. Sensitivity analyses using deciles of exercise facility availability were also conducted. Boundaries of the geographic information data were from 1 January 2017.

Fig. 1
figure 1

Diagram of the geographical analysis to calculate the availability of exercise facilities

Area-level SES

Area-level SES was obtained from a composite area-level SES index created using seven SES indicators: (1) low education; (2) high education; (3) part-time employment; (4) temporary employment; (5) manual occupational class; (6) average housing prices (per m2); and (7) unemployment rate. The SES index was calculated for each census tract across Madrid and was collapsed into tertiles (low, medium, high). The index has been used in previous studies [9, 22], and further details regarding index construction are described in ESM Table 3.

Statistical analysis

The analysis was undertaken in three steps. First, key demographic and clinical characteristics of the population were described. Second, Poisson regression models with robust standard errors clustered at the census tract level were applied to estimate the prevalence ratio (PR) for the association between the exposure (exercise facilities) and each outcome (type 2 diabetes, obesity). We initially created an unadjusted model (Model 0), then adjusted the model by age and sex (Model 1), together with population density (Model 2), and finally adjusted by area-level SES (Model 3). Third, to identify any potential effect modification from area-level SES with the availability of exercise facilities, we introduced an interaction term between area-level SES and availability of exercise facilities, using a Wald test to get a p value for each interaction. Results were presented for the whole sample and stratified by sex, using the highest tertile of exercise facilities available as the reference. All analyses were conducted using Stata/SE 14.1 for Mac (StataCorp, College Station, TX, USA).


This study was carried out under the umbrella of the HHH study and in accordance with the Declaration of Helsinki guidelines. The study received Institutional Review Board (IRB) approval from the Ethics Research Committee of the Madrid Health Care System on 12 May 2015.


After excluding those with missing data on residential location (n=34,538), our final sample included 1,270,512 individuals for the type 2 diabetes analysis and 213,719 adults for the obesity analysis. The distributions by area-level SES and availability of exercise facilities of participants between those with and without missing values of obesity were similar. Table 1 shows the final sample characteristics. A social gradient was evident for type 2 diabetes, whereby type 2 diabetes was more prevalent in low-SES areas (9.1%), compared with medium- (7.1%) and high-SES (5.0%) areas, and in men (8.6% compared with 5.8% in women). Obesity presented a similar distribution to type 2 diabetes. People living in lower-SES areas had a higher prevalence of obesity (43.7%) when compared with medium- (37.7%) and higher-SES areas (30.6%). Men had higher prevalence of obesity (39.4%) than women (37.5%). Availability of exercise facilities also showed a social gradient (low [median facilities = 5; IQR 3–8], medium [median = 7; IQR 4–12] and high SES [median = 12; IQR 4–18]).

Table 1 Characteristics of the study sample

We found a significant relationship of exercise facility availability with obesity and type 2 diabetes prevalence: people living in areas at the lowest tertile of exercise facility availability had a significantly higher prevalence of obesity (PRTertile 3 vs 1 = 1.22 [95% CI 1.20, 1.25]) and type 2 diabetes (PRTertile 3 vs 1 = 1.38 [95% CI 1.34, 1.43]). However, these associations were attenuated, but remained significant, after adjustment by area-level SES (Model 3; obesity, PRTertile 3 vs 1 = 1.03 [95% CI 1.01, 1.05]; type 2 diabetes, PRTertile 3 vs 1 = 1.03 [95% CI 1.00, 1.06]; see Table 2). Models 2 and 3 show the independent effects of exercise facility availability on the prevalence of obesity and type 2 diabetes. The independent effect for the third tertile (higher availability of exercise facilities) is 14% (PR 1.03 vs the total effect of PR 1.22) for obesity and 8% (PR 1.03 vs the total effect of PR 1.38) for type 2 diabetes.

Table 2 Association of exercise facility availability with prevalence of obesity and type 2 diabetes in Madrid

Effect modification of area-level SES and sex

Figure 2 shows a statistically significant effect modification of area-level SES on the relationship between exercise facility availability and obesity and type 2 diabetes (p value for interaction <0.001). For those living in the lowest area-level SES, a lower availability of exercise facilities was associated with a higher prevalence of obesity (PRTertile 3 vs 1 = 1.13 [95% CI 1.08, 1.18]) and type 2 diabetes (PRTertile 3 vs 1 = 1.17 [95% CI 1.11, 1.20]). We found no association between exercise facility availability and the prevalence of obesity or type 2 diabetes for people living in high-SES areas. When stratified by sex, we found a stronger association between exercise facility availability and type 2 diabetes for women (PRTertile 3 vs 1 = 1.24 [95% CI 1.16, 1.32]) compared with men (PRTertile 3 vs 1 = 1.10 [95% CI 1.04, 1.17]).

Fig. 2
figure 2

Association of exercise facility availability with (ac) type 2 diabetes and (df) obesity, adjusted by age and population density. Interactions by area-level SES are presented. Overall data are shown (a, d), as well as data stratified by sex: men (b, e); women (c, f). Dashed lines at PR 1.0 represent the reference group (highest availability of exercise facilities). There was a statistically significant effect modification of area-level SES on the relationship between exercise facility availability and obesity and type 2 diabetes (p value for interaction <0.001)

Sensitivity analysis

Analysis by deciles of exercise facility availability showed a linear and gradual association between facility availability and both health outcomes, with the exception of the highest decile (see ESM Table 4).


In this study of ~1.3 million adults in Madrid (Spain), we found that residents living in areas with lower availability of exercise facilities had higher levels of obesity and type 2 diabetes. These associations were strongest in lower-SES areas. To our knowledge, this is the first study exploring exercise facility availability and obesity and type 2 diabetes associations through area-level SES effect modification.

These results are consistent with previous studies that described higher prevalence of obesity [12] and type 2 diabetes [18] in residents living in areas with lower availability of exercise facilities. Importantly, we found that the association between exercise facility availability and the prevalence of obesity and type 2 diabetes was largely attenuated after adjusting for area-level SES. This has two important implications. First, it indicates that part of the social gradient in obesity and type 2 diabetes prevalence may be explained by the differential distribution of exercise facilities. A potential pathway of these associations may be through increased physical activity; previous studies in Madrid with older adults (50–74 years) showed that availability of exercise facilities was a mediator between neighbourhood economic context and physical inactivity [35]. Second, these patterns indicate that areas with the highest prevalence of obesity and type 2 diabetes are areas characterised by low SES and with a low availability of exercise facilities. These findings may have potential policy implications as they indicate that exercise facilities may be able to partially mitigate SES inequities.

In the stratified models, prevalence of obesity and type 2 diabetes was greater among people who lived in lower-SES areas and with a lower level of exercise facility availability. Taken together, a lack of exercise facilities may contribute to the social gradient among more deprived populations. Investigating the interaction of characteristics of the built environment and SES is crucial to understanding the extent of health inequities and designing potential interventions to prevent these inequities [36].

Sex inequities were also identified. The magnitude of obesity and type 2 diabetes PRs was higher among women from low-SES areas and with low availability of exercise facilities, when compared with the equivalent male population. When type 2 diabetes was considered, the PR for women living in low-SES areas with low availability of exercise facilities was double that for men living in areas with the same characteristics. Similar sex inequities have been reported in research examining adiposity and availability of exercise facilities [12], and green space availability and diabetes [37].

A strength of the study is including the entire adult population of a major European city (Madrid) where almost 1,400,000 adults live [28]. This large sample size minimised selection bias compared with surveys or regular cohort studies [38], and allowed us to capture geographic and demographic variation across a city. The diagnosis of type 2 diabetes in our EMRs was previously shown to have high validity [29] and obesity was classified objectively.

The current study also presents several limitations. First, cross-sectional studies of neighbourhood environment are prone to reverse causation, as individuals with lower BMI may choose to live in areas with more exercise facilities. Although self-selection bias is a concern in neighbourhood and health studies, its effect is not clear and should be confirmed in future studies [39, 40]. Second, the study did not consider the physical activity levels of participants, so we cannot confirm whether presence of exercise facilities is associated with exercise facility use. However, studies have found that greater availability of exercise facilities in neighbourhoods was associated with higher levels of overall physical activity [35, 41, 42]. Third, since our focus was on indoor exercise facilities, it is likely we missed other physical activity destinations, such as outdoor sports courts, parks and pavements/footpaths. Fourth, the measurement of our outcomes relied on EMR data, which may be subject to bias. However, a validation study conducted using these same datasets found type 2 diabetes diagnoses accurate (κ = 0.99). We have no information on the validity of the diagnosis of obesity. Finally, there were temporal differences across the datasets (2015, 2017 for EMRs; 2017 for area-level SES). Although the area-level SES has not changed significantly over the last few years, it is possible that variations in the exercise facilities have not been captured.

Research agenda

Study findings opened two lines of inquiry for improving our understanding of the associations between exercise facilities and health outcomes. Future studies should seek to confirm the results presented in this research using individual-level behavioural data captured through longitudinal studies to better understand how the presence of exercise facilities is associated with facility use and physical activity engagement, and related inequities. Integrating qualitative methods to evaluate the characteristics of exercise facilities would be helpful to gain a better understanding of barriers and enablers for using exercise facilities, and whether these differ by sex and SES.

Policy recommendations

Our study showed the highest prevalence of obesity and type 2 diabetes in low-SES areas with the lowest availability of exercise facilities. This finding suggests that obesity and type 2 diabetes prevention efforts should focus in these areas to reduce health inequities. Preventive efforts should also include mechanisms to reduce sex inequities in access to exercise facilities, as we found stronger associations with type 2 diabetes for women.


Our findings from ~1.3 million adult Madrid residents demonstrated that neighbourhoods with lower availability of exercise facilities had a higher prevalence of obesity and type 2 diabetes, and this was most evident for women and for people living in low-SES neighbourhoods. These findings provide knowledge that may help inform interventions to reduce health inequities.