Introduction

Anthropogenic land-use change has resulted in the loss of natural habitat which is a major threat to global biodiversity (Martinuzzi et al. 2015; Prakash and Verma 2022). Approximately 39% of terrestrial land has been converted to cropland, urban settlements, and other human land-uses, while a further 37% has been altered and fragmented by human activities (Ellis et al. 2010; Williams et al. 2020). Together these changes have led to a 50% reduction in species richness within local sites and a 38% decline in total species abundance in urbanised areas compared to natural landscape (Newbold et al. 2015). Furthermore, it is predicted that by 2050, the world’s human population will surpass 9 billion people, with 68% of them living in ever-expanding urban areas (Almihat et al. 2022). Consequently, by 2100, urban infrastructure are expected to replace about 11–33 million hectares of natural grasslands and forests, reducing available wildlife habitat even further (Li et al. 2022).

The adverse effects of urbanisation have been observed primarily at global scales through functional homogenisation (McKinney 2006; Kondratyeva et al. 2020), declining phylogenetic diversity (Ibáñez-Álamo et al. 2017), as well as limiting the scope of current functional traits (Williams et al. 2015). Negative impacts can be offset by the positive effects of increasing connectivity between remaining patches of natural habitat and actively restoring plant and animal diversity in cities (Pautasso et al. 2011; Garrard et al. 2018). Many urban areas established in regions of high biodiversity and remnant patches of natural habitat can still harbour a significant number of unique floral and faunal species (Prendergast et al. 2022), thus contributing to global biodiversity conservation (Soanes and Lentini 2019). However, challenges arise as certain species such as Cape mountain zebra (Equus zebra zebra) and African wild dog (Lycaon pictus) struggle to adapt to urban encroachment, leading to local extirpations (Wilson and Primack 2019; Kock et al. 2023). Conversely, exotic species like the grey squirrel (Sciurus carolinensis) and sambar deer (Rusa unicolor) thrive in urban environments, often outcompeting native counterparts (Picker and Griffiths 2011; Measey et al. 2020). These successful invasions disrupt native ecosystems, affecting resource availability and potentially displacing native species (van Rensburg et al. 2011; Van Wilgen et al. 2022). Despite such shifts, some native mammals, like the chacma baboon (Papio ursinus), caracal (Caracal caracal) demonstrate surprising resilience and adaptive behaviours in urban settings (Leighton et al. 2022; Ross 2022).In contemporary ecological research, understanding patterns of species occurrence is pivotal for effective conservation and management strategies, particularly in the context of conserving biodiversity in rapidly changing environments (Kéry et al. 2013).

Researchers have increasingly turned to multi-species occupancy modelling as a robust analytical framework for such research (Devarajan et al. 2020). This approach extends beyond traditional single-species modelling, enabling ecologists to explore the complex interplay of ecological communities while accounting for imperfect detection probabilities (Guillera-Arroita 2017). By simultaneously estimating the occurrence of multiple species in an area while considering the influence of various environmental factors, multi-species occupancy modelling offers a comprehensive and nuanced perspective for researchers seeking to understand the ecological intricacies of diverse biological communities across different land uses. The City of Cape Town (CoCT) falls within South Africa’s Cape Floristic Region (CFR), a recognised global biodiversity hotspot (Myers et al. 2000; Holmes et al. 2008). Consistent with the development of cities worldwide, the transformation of land for agricultural and urban uses rapidly excluded most large mammals and, in particular large predators that pose a risk to livestock and humans (Crooks and Soulé 1999; Roth and Lima 2003; Koprowski 2005).

Currently, only medium and small sized mammals occupy natural habitat adjacent to the CoCT (Colyn et al. 2018; Schnetler et al. 2021) but no study has attempted to investigate wildlife living within the urban matrix in semi-urban and urban areas. To address this gap, we compared species richness and occupancy of medium and small mammals in natural, suburban and urban areas within the CoCT using the Urban Wildlife Information Network (UWIN) research design using a transect camera trap setup along an urban-rural gradient. This approach integrated a high-resolution land-use cover raster dataset with camera trap data. We hypothesised that species occupancy probability would decline with increasing intensity of human impact (i.e., impervious surface, human footprint index, and human population density) and increase with more refugia (i.e., increased tree cover). This research is important for understanding the ecological consequences of urbanisation in large cities and to understand which animals persist in human-modified landscapes (Salsbury et al. 2004; Lowry et al. 2013; Bracken et al. 2021).

Methods

Study area

The CoCT and its immediate natural surroundings are home to nearly 9,000 floral species, comprising 44% of the subcontinent’s flora on only 4% of its land mass (Mucina and Rutherford 2006). The region’s floral biodiversity has drastically declined over the past 350 years because of urbanisation (Anderson and O’Farrell 2012). The city consists of four distinct landscapes, with the Cape Flats Sand Fynbos in the centre, surrounded by the dune-dominated strandveld on the western and southern coasts’ edge lands (Rebelo et al. 2011). Low shale and granite hills located inland on the plains have historically been used for farming, primarily wheat in the dry lower parts and vineyards on the wetter slopes. Historically, the city’s boundaries were Table Bay and what is now known as the City Bowl on the northern side of Table Mountain (Rebelo et al. 2011).

The city experiences a wide range of precipitation, from over 1,000 mm on the eastern portion of Table Mountain to as low as 350 mm on the western borders. The average monthly temperature ranges from 25 °C in January to 17 °C in July (Mucina and Rutherford 2006). The city’s land area of 2,460 km2 has undergone various types of development, ranging from formal and informal residences in extremely congested settlements on the low-lying Cape Flats to formal housing on large expanses of land near Table Mountain (Rebelo et al. 2011; Goodness and Anderson 2013).

Historic accounts reveal that the CFR has lost many of its indigenous medium-to-large sized (> 2 kg) mammalian species (Kerley et al. 2003; Skead 1980). Blue antelope (Hippotragus leucophaeus), Quagga (Equus quagga quagga), Cape warthog (Phacocheorus aethiopicus aethiopicus) and Cape lion (Panthera leo melanochaitus), once abundant in the region, are now extinct. The remaining mammals in the CFR have experienced significant declines in distribution and population size (Boshoff and Kerley 2001).

Site selection

We adopted UWIN’s research design to allow for comparisons with other urban wildlife surveys worldwide (Magle et al. 2019). UWIN’s design requires establishing linear transects along spatial gradients. We designed our transects extending from the urban core of the city through suburban and natural areas using QGIS 3.26.3 (QGIS Development Team 2022). To this effect, we established four 13 km long transects that originated from urban core areas and terminated in either natural/protected or rural land-use after traversing suburban areas. This length was sufficiently long to capture the urbanisation gradients of the CoCT (Magle et al. 2019). All four transects originated on the Atlantic Ocean coastline and followed one of four drainage lines, namely the Sandvlei/Keyser River, Hout Bay River, Swartrivier/Liesbeek River and Diep River (Fig. 1). The four transects included a total of 48 sites (i.e., 12 sites per transect) that incorporated a variety of urban green spaces which have proven important for supporting urban wildlife (e.g., nature reserves, public parks, and golf courses) (Magle et al. 2014; Table 1). However, 17 camera traps were stolen, reducing our total number of sites. Six of these stolen camera traps were replaced, resulting in a final count of 37 effective sites. Sites were spaced 1 km apart to reduce the probability of detecting the same individuals at neighbouring sites (Gehrt et al. 2010). We established a 500 m buffer area around each sampling site, within which we estimated the dominant land-use. To do so, we used the South African National Land Cover (SANLC) 2018 raster dataset, which classifies land-use into 73 different land cover classes. The raster was clipped to the study area and imported into QGIS to determine the number of pixels of each of the 73 land cover classes within each buffer area. We summed the values for all land classes that included impervious surfaces (Rose et al. 2017) to determine the proportion of land classified as ‘urban’ for each site. The proportion of urban land per site was then categorised into three non-overlapping groups to denote natural (5–24%), suburban (25–50%), and urban land (> 50%) (Marzluff et al. 2001).

Fig. 1
figure 1

A map of the four 13 km long study transects (T1, T2, T3, and T4) within the City of Cape Town and the major land-uses. Camera traps on the transect were spaced approximately 1 km apart, and are denoted by square, triangle or circle symbols. Gaps along each transect represent sites at which cameras were stolen. Insert shows the study area in relation to South Africa

Table 1 Details of the four transects (T1-T4) established along the urban-rural gradient in the City of Cape Town

Camera trapping

We deployed Bushnell Trophy CAM HD (Bushnell Outdoor Products, Overland Park, Kansas, USA) camera traps between the 31 January and 31 May 2022 at all 48 sites along the four 13 km long transects within the CoCT (Fig. 1). At each site, we attached a single camera trap in the upright position to either a fence post or tree at a height between 40 and 50 cm, facing a path or trail to improve the detection of passing animals (Welbourne 2013; Meek et al. 2014). We positioned the camera traps facing southward to avoid excessive exposure to direct sunlight, which causes false triggers and poor image quality (Glen et al. 2014). At some sites, we placed camera traps at an angle of 45° to the trail, rather than perpendicularly, which allowed the camera a better view of a longer section of the trail (Wearn and Glover- Kapfer 2017). We ensured that the camera traps were active in the field for a minimum of four weeks to provide sufficient data on species present within the site (Mackenzie and Royle 2005; Guillera-Arroita et al. 2010). We visited each site every two to three weeks following deployment to replace batteries, download the data from the 16 gigabyte SD memory cards and replace stolen cameras. We identified all mammal species present in each photograph and considered species-specific photographs as independent if they were separated by > 30 min (O’Brien et al. 2003; Jenks et al. 2011). After manually identifying the species and number of individuals present in each photograph, we used exiftools-12.42 to extract the photographs metadata, such as time and date (Niedballa et al. 2016).

Covariates

We hypothesised that the spatial distribution of species would be influenced by five covariates, namely land class, impervious surface, tree cover, human population density and human footprint. Each covariate was extracted as a mean across each site’s 500 m radius buffer. To calculate the percentage of impervious surface present at each site, we used the global impervious surface area dataset (GISA 2.0) from Landsat at 30 m resolution. This dataset consists of global estimates of fractional impervious surface observed by the Landsat satellite from 1972 to 2019 (Huang et al. 2022), in which each pixel is assigned a percentage impervious surface. To determine the average human population density present at each site, we averaged values derived from the 2020 South African estimated population density (at a resolution of approximately 1 km; www.worldpop.org). To estimate the proportion of tree cover, we used the global forest cover (GFC) version 1.9 at a resolution of 30 m (Hansen et al. 2013). With QGIS, we calculated human pressure using the Human Footprint Index within each site’s 500 m circular buffer (Venter et al. 2016a, b). This Human Footprint Index used integrated data on built-up environments, population density, electric power infrastructure, crop lands, pasture lands, roads, railways, and navigable waterways into an index with values from 0 (no footprint) to 50 (maximum footprint) measured at a 1 km resolution.

We further hypothesised that both survey effort and human presence influenced the probability of species’ being photographed. Effort was calculated as the number of days a camera trap site was active for each sampling occasion (Kéry and Royle 2016). We quantified the effect of human presence and both animals (e.g., domestic dogs) and machines (e.g., vehicles) associated with humans using Relative Abundance Indices (RAI) to estimate site-specific human disturbance (HD). RAI was calculated by summing the total number of independent ‘HD’ detections per diel period (i.e., day and night) for each sampling occasion, then dividing this by the number of sampling days the site was active, and multiplying by 100.

We standardised all continuous covariates prior to analysis by subtracting the mean and dividing them by the standard deviation of all the sites. This ensure that all covariates are on the same scale, thereby allowing for meaningful comparisons and interpretations of their effects in statistical analyses (Schielzeth 2010). After that we tested for collinearity in both occupancy and detection covariates using Pearson product-moment correlation coefficients (Graham 2003); no covariates were highly correlated (i.e., |r| < 0.7) (Dormann et al. 2013; Fig. S1).

Single-season multi-species occupancy model

As our 4-month sampling period occurred during the region’s dry months (Table 1), we assumed the closure of the target mammal community. For each species in our data, we created binary matrix detection histories, with rows indicating each site and columns for each occasion (Otis et al. 1978). Consequently, at each site \(\:j\) for each occasion k species i was coded as “1” if it was detected, or “0” if not, and “NA” when data was unavailable due to camera theft or hardware/software failure. For occupancy models to converge on accurate estimates, there must be a minimum number of detections (O’Connell et al. 2006). Therefore, to improve model fit, camera trapping studies often combine multiple trap days (24-hour periods) to form single sample occasions. As our data were zero inflated, we initially tested occasions consisting of 5 and 10-day period, but our multi-species occupancy models (MSOM) failed to converge on reliable estimates. Ultimately, we used a 15-day occasion length, resulting in 8 occasions per site. We used the package camtrapR version 2.2.0 (Niedballa et al. 2016) in the statistical program R version 4.2.2 (R Core Team 2020) to organise and build a record database from all sites.

We used a hierarchical MSOM (Dorazio and Royle 2005) that uses detection data to estimate species occupancy and detection probability for the community, as well as for each individual species across urban-rural land-use gradient within the City of Cape Town (MacKenzie et al. 2002; see Appendix S1 for model code). An advantage of the hierarchical modelling framework is that it accounts for both species-level effects and aggregated effects on the community as a whole (Kéry and Royle 2008; Kéry et al. 2009). This approach increases precision in species-specific detection and occupancy estimates, especially for those infrequently observed. We defined occupancy (Zij), as a binary variable, in which \(\:{Z}_{ij}\:\)= 1 if species i occupied site j, and 0 otherwise. Zij, was assumed to be the outcome of a Bernoulli random variable:

$$\:z_{ij}\sim Bernoulli\left({\psi\:}_{ij}\right)$$

where ψij was the probability that species i occurred at site j. Since the state variable Zij cannot be observed perfectly, we defined the detection probability for species i at site j during occasion k as:

$$\:{x}_{ijk}\sim Bernoulli\left({P}_{\dot{l}jk}*{Z}_{ij}\right)$$

where xijk was the observed detection data, Pijk was the detection probability of species i for the occasion k at site j, given that species i was truly present at site\(\:j\) (i.e., Zij = 1, MacKenzie et al. 2002). We thereafter used generalised linear mixed modelling to include site-level covariates (COV) that affect species-specific occupancy and detection probabilities (Dorazio and Royle 2005; Russell et al. 2009). The occupancy probability for species i at site j was therefore specified as:

$$\:logit\left({\psi\:}_{ij}\right)={\beta\:}_{0i}+\sum\limits_x^{n=4}{\beta\:}_{x_i}COV_{xj}$$

where x is the index of all possible covariates, β0i is the species-specific intercept for occupancy and βxi are species-specific coefficients representing the effects of individual covariates on occupancy. Both the occupancy and detection were modelled on the logit scale to constrain the values between 0 and 1. Similarly, the detection probability is specified as:

$$\:{logit}\left({p}_{ijk}\right)={\alpha\:}_{0i}+{\alpha\:}_{1i}Ef{fort}_{jk}+{\alpha\:}_{2i}{Human\:Disturbance}_{jk}$$

where α0i is the species-specific intercept for \(\:p\) and α1i …, α2i are species-specific coefficients representing the effects of individual covariates on detection probability.

Following Zipkin et al. (2010), we linked species-specific models using a mixed modelling approach. we assumed species-specific parameters were random effects derived from normally distributed, community-level hyper-parameters (Zipkin et al. 2010). Hyper-parameters specify the mean response and variation among species within the community to a covariate (Kéry and Royle 2008; Rich et al. 2016). Specifically, for our community model, 𝛽 coefficients were modelled as:

$$\:{\beta\:}_{1i}\sim{Normal}\left({\mu\:}_{\beta\:1},{\sigma\:}^{2}\beta\:1\right)$$

where\(\:{\:\mu\:}_{\beta\:1}\) is the community-level mean and \(\:{\sigma\:}^{2}\beta\:1\) is the variance (Rich et al. 2016).

We fitted two models that reflected different hypotheses on drivers of species occurrence. Both models incorporated two continuous environmental covariates on species-specific detection probabilities (namely effort and human disturbance). The first model (‘Site’) included four continuous environmental covariates (human footprint index, impervious surface, human population density and tree cover). The second model (‘Land-use’) included single habitat covariates (with three levels, natural, suburban, and urban areas) to model occupancy. We selected the most parsimonious model using the Watanabe-Akaike information criterion (WAIC; Watanabe 2010). We adopted the model with the lowest WAIC values as the top model and considered a model with a delta WAIC of less than 2.0 as being competitive.

Parameter posterior distributions were estimated using Markov Chain Monte Carlo (MCMC) simulation in a Bayesian framework through NIMBLE version 0.13.1 and nimbleEcology version 0.4.1 (de Valpine et al. 2017; Goldstein et al. 2020) in R. Given the lack of prior knowledge of a parameter’s true value, parameters and hyper-parameters were implemented with non-informative priors. We specified normal distributions (0, 0.05) for the hyperparameter mean and gamma distribution (0.1, 0.1) for the variance. Finally, we generated three chains of 350,000 iterations, after a burn-in of 200,000 iterations, with a thinning rate of 5, to obtain posterior distributions. We report results as posterior mean, standard deviation, and the 95% and 75% Bayesian credible intervals. We consider a coefficient to have strong support if the 95% BCI did not overlap zero and moderate support if the posterior 75% BCI did not overlap zero (Coomber et al. 2021; Tilker et al. 2019). To assess model convergence, we used the Gelman-Ruben statistic (where values < 1.1 indicated convergence across all three chains for each estimated parameter, Gelman et al. 2014) and visual examination of the chains through trace plots (Fig. S2; Conn et al. 2018; Kass et al. 2020). We tested model fit by calculating the Bayesian p-value (Gelman et al. 1996). Bayesian p-values between 0.1 and 0.9 indicate an adequate model fit (Hobbs and Hooten 2015).

Results

We obtained a total of 34,924 images with 18,909 false detections across 2,434.5 trap nights (i.e., independent 24-hr periods; mean = 66 trap-nights/site). A total of 3,045 independent photographs (1,126 in urban; 496 in suburban; 1,423 in natural area) were obtained. Of the independent photographs, 549 were of terrestrial mammal species with the highest number recorded in natural area (364) followed by urban (117) and suburban areas (68). Only 12 terrestrial mammal species were detected, nine of which were wild terrestrial mammals (Fig. 2) and three were domestic animals including cats (Felis catus), dogs (Canis lupus familiaris) and cattle (Bos taurus).

Fig. 2
figure 2

Caterpillar plots showing posterior means (blue circles) of both detection and occupancy (Ψ) probabilities for the nine wildlife species detected in the study. Red error bars represent 95% Bayesian credible intervals

Single-season multi-species occupancy model

Of the two models considered in our study, the Site model, which included the covariates impervious surface, human population density, tree cover and human footprint index, was the most parsimonious model (WAIC = 662.02, ∆WAIC = 0.00; Table 2). Both the Site and Land-use models had adequate fit, with Bayesian P-value of 0.861 and 0.723, respectively (Table 2). Similarly, Gelman-Rubin statistics indicated convergence for all parameters, with ȓ < 1.1 (ȓ =1.00, Table 2).

Table 2 Candidate models for occupancy and detection probability for wild terrestrial mammal species

Species-specific mean detection probability estimates varied widely among all nine species. The species with the highest estimated detection probability was sambar deer; Rusa unicolor, (Mean = 0.69, 95% BCI = [0.43, 0.90]), while the species with the lowest estimated detection probability was caracal; Caracal caracal, (Mean = 0.10, 95% BCI = [0.03, 0.23]; Fig. 2). Grey squirrel (Sciurus carolinensis) had the highest estimated occupancy probability (Mean = 0.69, 95% BCI = [0.25, 0.99]), while klipspringer (Oreotragus oreotragus) had the lowest (Mean = 0.02, 95% BCI = [0.00, 0.08]; Fig. 2).

Species-specific occupancy responses to all four Site model covariates varied in direction and strength (Fig. 3; full model results are provided in Table S1). However, only tree cover had a significant (positive) impact on community-level occupancy (Table 3). Four species had a strong positive association with tree cover, namely Cape genet; Genetta tigrina (4.38, 95% BCI = [0.76, 12.61]), Cape porcupine; Hystrix africaeaustralis (2.81, 95% BCI = [0.87, 6.35]), grey squirrel (4.47, 95% BCI = [0.57, 11.82]) and sambar deer (1.44, 95% BCI = [0.08, 3.21]) while three species (caracal, chacma baboon; Papio ursinus and water mongoose; Atilax paludinosus) exhibited moderate positive relationship to tree cover. Cape grysbok (Raphicerus melanotis) was the only species that exhibited a strong positive association with the impervious surface, but Cape genet, grey squirrel and Cape porcupine had moderate negative relationships with impervious surface (Fig. 3). Neither the human footprint index nor the human population density index had a clear effect on either species or community-level occupancy probability of occupancy. The exception was caracal, which had a moderate negative association with human footprint index (Fig. 3).

Fig. 3
figure 3

Model coefficients (mean and Bayesian credible intervals, BCI) for the effects of Human Footprint Index, Human Population Density, Impervious Surface, and Tree Cover on the occupancy probabilities of nine medium-to-large-sized terrestrial wildlife species, estimated using a community occupancy model fit to camera-trap data from three land-use type in the City of Cape Town. Thin error bars represent the 95% BCI and thick error bars represent the 75% BCI. Red dots/bars indicate strong associations between a covariate and occupancy (95% BCI not overlapping zero), black dots/bars represent moderate associations (75% BCI not overlapping zero), and grey represents weak association

Community-level responses to the two detection covariates were similar (Table 3), with both effort and human disturbance being largely uninformative. However, the detection probability at the species-level differed greatly (full model results are provided in Table S1), with for example, Cape porcupine having a strong positive association with human disturbance (1.71, 95% BCI = [0.24, 4.35]) while Cape genet had a negative association (-1.59, 95% BCI = [-4.66, -0.02]). A moderate negative association was recorded between camera-trap effort and chacma baboon (Fig. 4).

Table 3 Mean and associated 75% credible intervals of community-level hyper-parameters hypothesised to influence (on the logit scale) the probability of occupancy and detection of nine mammal species in the City of Cape Town
Fig. 4
figure 4

Model coefficients (mean and Bayesian credible intervals, BCI) for the effects of camera trap effort and human disturbance on the detection probabilities of nine medium-to-large-sized terrestrial wildlife species, estimated using a community occupancy model fit to camera-trap data from three land-use type in the City of Cape Town. Thin error bars represent the 95% BCI and thick error bars represent the 75% BCI. Red dots/bars indicate strong associations between a covariate and occupancy (95% BCI not overlapping zero), black dots/bars represent moderate associations (75% BCI not overlapping zero), and grey represents weak association

Discussion

In this study, we revealed that only a small number (n = 9) of medium and large-sized mammal species persist within and adjacent to the City of Cape Town in South Africa. Most independent photographs of the target taxon were recorded in natural areas, followed by urban and suburban areas. These findings are consistent with research that forms part of a global effort coordinated by UWIN to understand ‘urban wildlife’, and contribute to conservation and urban planning. UWIN projects have consistently shown a pattern of small numbers of medium-to-large-sized mammals dominating the urban-rural matrix (Gallo et al. 2017). According to a recent UWIN study (Haight et al. 2023), there is a noticeable trend wherein a limited number of species thrive in urban environments, while rural areas exhibit greater species diversity.

In exploring the drivers of occupancy patterns, both UWIN research and our study highlight the significance of habitat features and human-wildlife interactions. UWIN’s work, particularly that of Magle et al. (2016), Gallo et al. (2017) and Fidino et al. (2021), underlines the role of habitat complexity and green spaces in influencing mammalian occupancy in urban areas. Likewise, our research emphasises the importance of habitat features, with specific consideration given to human footprint index, tree cover, human population density, and impervious surfaces. These shared trends suggest commonality in the factors modelling mammalian communities in urban and rural areas globally, offering valuable insights into the broader dynamics of human-wildlife coexistence.

Our multi-species single-season occupancy modelling revealed a significant positive association between tree cover and 78% (n = 7) of the species surveyed. This result is consistent with similar studies worldwide (Ahumada et al. 2011; Bogoni et al. 2016; Boron et al. 2019), which have shown that tree cover played a crucial role in shaping the distribution and abundance of the wildlife species in urban corridors. Large exotic trees are often planted in public spaces within the urban matrix to provide shade and improve the aesthetics of these public amenities (Pandit et al. 2013). In a similar study, Salom-Pérez et al. (2021) discovered that tree cover was the primary determinant of mammal occupancy, although its effects varied at the species level. Tree cover was identified as a significant factor influencing the occupancy of mammals in protected areas of China (Feng et al. 2021) and suburban areas of South Africa (Zungu et al. 2020), with the strength of the response varying among species.

Unsurprisingly, the species with the strongest positive association with tree cover in our study was the exotic grey squirrel, which use trees for food, shelter and refuge (Jessen et al. 2018). Another exotic species with a high positive association with forest cover was sambar deer (Rusa unicolor), which is well established as being of a shy disposition and preferring dense forests (Haleem and Ilyas 2022; Kushwaha et al. 2004). Sambar deer are actively persecuted in Table Mountain National Park and are vulnerable to poaching in their natural range (Widodo et al. 2022), and thus choose areas with more tree cover as a refuge (Gallego-Zamorano et al. 2020).

Cape genet also had a strong positive relationship with tree cover, a finding consistent with habitat preferences for this species throughout its distribution (Ramesh and Downs 2014; Ehlers Smith et al. 2017; Zungu et al. 2020). Trees provide shelter for resting during the day (Skinner and Chimimba 2005), and foraging while minimising the risk of predation by domestic dogs (Ehlers Smith et al. 2017; Ramesh and Downs 2014). Widdows et al. (2015) found that vegetation cover in KwaZulu-Natal negatively influenced the occupancy of Cape genets which they attributed to genets exploiting anthropogenic resources (e.g., food and shelter), in suburban areas and so reducing their reliance on dense vegetation cover (Widdows and Downs 2015; Widdows et al. 2015).

The ability for water mongoose, caracal, and Cape genet to persist in and adjacent to transformed habitats is similar to findings from other regions showing that mesocarnivores are less affected by human-induced habitat disturbances compared to larger carnivores. This is mostly because of their smaller spatial needs, generalist diets and adaptable behaviour (Kertson et al. 2011; Gerber et al. 2012; Streicher et al. 2022). The relatively smaller size of mesocarnivores may contribute to their ability to navigate human-dominated environments without drawing much attention or posing direct threats to humans. For example, caracals, known for their stealthy nature, typically avoid humans but hunt domestic cats (Nattrass and O’Riain 2020) and birds close to the urban edge (Leighton et al. 2020).

Cape porcupine occupancy was also positively associated with tree cover. Cape porcupines depend on remnant forest patches to provide suitable daytime roosting sites, such as burrows, crevices, or caves. These types of habitats are unlikely to be found in heavily developed areas where roads and buildings have replaced forested areas (Zungu et al. 2020). Other porcupine species depend on cover when foraging (Sonnino 1998) and for survival (Mabille and Berteaux 2014). Ngcobo et al. (2019a, b) further support this, highlighting that Cape porcupines prefer diverse habitats with shelter and foraging opportunities. In Cape Town, Cape porcupines are often observed to take refuge in stormwater drains during the day (O’Riain pers. obs.) and foraging in green belts and parks at night, sometimes in densely populated areas. This combination of nocturnal activity, the use of a widely available human structure (stormwater drain) for commuting and as a refuge and the absence of natural predators in suburban and urban areas may explain the success of Cape porcupine in Cape Town, which had the highest mean occupancy of all indigenous species, in this study.

The negative association between the extent of the impervious surface and mammal community occupancy supported our prediction with impervious surfaces serving as a proxy for the level of urbanisation. Surprisingly, Cape grysbok increased with the level of impervious surface, reflecting this species’ ability to persist within small urban parks surrounded by roads and other urban infrastructure. Cape grysboks are present in other small urban parks with intact natural habitat, where they are primarily freed from natural predators and have access to sufficient food and cover (Schnetler et al. 2021). They are even thriving in the Kenilworth racecourse, which comprises a patch of high-quality natural vegetation surrounded by a dense road network and residential areas (Schnetler et al. 2021).

The weak to no effect of human disturbance on community-level and (most) species-specific detection probability in the CoCT urban-rural gradient could result from pooling trap days into larger sampling occasions. The fine-scale variations in human activity, which may have had a greater impact on wildlife, were thus not adequately captured in the pooled data. Human disturbance was, however, positively associated with the detection probability of Cape porcupines. This finding aligns with Ngcobo et al. (2019a, b), who observed that Cape porcupines are not only present in suburban and peri-urban areas but also demonstrate adaptability to human-modified landscapes. This adaptability likely results in increased detections in areas with human activity. Cape porcupines may benefit from certain aspects of human-altered environments, such as greater availability of food resources or reduced predation pressure, allowing them to thrive despite human disturbance. This observation is further supported by the species’ nocturnal nature and ability to take refuge in urban infrastructure close to human habitation.

Sampling effort had weak to no influence on the community-level detection probability. It is likely that other, unmeasured factors, such as species-specific behaviours or environmental variables, might predominantly influence detection rates in our study area. The positive effect of effort on chacma baboon detection probability is likely due to the variability in their movement patterns across their large ranges- where rangers actively deter them from urban areas.

The identification of species-specific responses to environmental covariates in this study underscores the difficulty of devising interventions to improve general biodiversity within urban areas. Some species exhibited positive associations with specific covariates, while others displayed negative associations. Only tree cover positively impacted the occupancy of multiple species, suggesting that increasing woody vegetation in existing green belts may improve native wildlife presence in urban and suburban areas by providing greater structural variability and an arboreal refuge, specifically for species such as chacma baboon and Cape genet. Cape porcupine emerged as a native species that has best adapted to suburban and urban areas, and they likely can move through the below-ground network of stormwater drains in these areas have allowed them to persist in areas of high human density. Many species have shown the ability to change their behaviour and foraging patterns when subjected to high levels of anthropogenic activities (Salsbury et al. 2004; Lowry et al. 2013; Bracken et al. 2021). Both caracal and chacma baboons, the other two medium-sized mammals still abundant in the peri-urban spaces of CoCT, are both vulnerable to vehicle collisions when entering urban areas (Beamish and O’Riain 2014; Leighton et al. 2022). By contrast, porcupines can navigate urban areas with dense road networks by moving below ground through the stormwater infrastructure, providing them with a unique opportunity to avoid vehicles and emerge and forage in suburban gardens and urban parks far from their natural habitat.

Our study is consistent with theory demonstrating that human-modified landscapes generally have lower species diversity than natural habitat and that exotic and domestic species dominate suburban and urban areas. The identification of species-specific responses to environmental covariates in this study underscores the difficulty of devising interventions to improve general biodiversity within urban area. Some species exhibited positive associations with certain covariates, while others displayed negative associations. Only the percentage of tree cover had a positive impact on the occupancy of multiple species suggesting that planting trees in existing green belts may improve wildlife presence in urban and suburban areas.

Limitation and recommendation

Camera theft remains a largely insurmountable challenge associated with camera trapping in urban areas of South Africa. In this study a total of 17 cameras were stolen, mostly from suburban sites. The loss of camera traps is consistent with previous research that has shown that suburban (peri-urban) areas are more likely to experience theft of camera traps than other areas (Kelly and Holub 2008; Meek et al. 2019). The theft of camera traps not only results in data loss but limits the financial viability of surveying wildlife in urban areas. We took some precautionary measures including using camouflage to hide cameras, placing cameras off-trail and below eye-level. In addition, we attached small signs to the camera briefly describing the purpose of the study and providing relevant contact information to signal ownership of the cameras and to allay fears that they could be functioning as crime detection devices. However, future surveys would almost certainly require further interventions including placing camera traps in metal cases and chaining them to immovable objects or even using GPS/VHF tracking systems to locate them if stolen (Sparkes et al. 2016; Meek et al. 2019), both of which would increase the costs of such surveys.

Another limitation in our study is the pooling of data from a 24-hour period into 15-day periods to address the issue of zero inflation and improve model fit (White et al. 1982). This can lead to the potential loss of fine-scale detection probability information. By aggregating the data over a longer time frame, finer temporal patterns and variations in detection probability within the 24-hour period might be obscured. This could result in a loss of sensitivity to detect changes in species occupancy at a more detailed scale, potentially biasing the model outputs (Hwang et al. 2002). The ability to capture species-specific behavioural patterns or responses to environmental factors that operate on shorter time scales may be compromised. Additionally, pooling data over a longer period could also mask potential transient or intermittent occurrences of certain species, further affecting the accuracy and precision of the occupancy estimates. Hence, future studies should consider incorporating methods that allow for fine-scale detection probability estimation to overcome these limitations and provide a more nuanced understanding of species dynamics.