Next Article in Journal
Initial Insights into Spruce Wood Fatigue Behaviour Using Dynamic Mechanical Properties in Low-Cycle Fatigue
Previous Article in Journal
Edge Effects in the Amazon Rainforest in Brazil’s Roraima State
Previous Article in Special Issue
Ecological Stoichiometry Characteristics and Influencing Factors of Soil Carbon, Nitrogen, and Phosphorus in Green Spaces Along the Urban-to-Rural Gradient of Nanchang, China
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Exploring Spatial Differences in Habitat Quality and Their Response to Urban Spatial Form, Using Shanghai as an Example

College of Landscape Architecture and Art, Fujian Agriculture and Forestry University, Fuzhou 350108, China
*
Authors to whom correspondence should be addressed.
These authors contributed equally to this work.
Forests 2025, 16(8), 1323; https://doi.org/10.3390/f16081323
Submission received: 15 July 2025 / Revised: 6 August 2025 / Accepted: 11 August 2025 / Published: 14 August 2025
(This article belongs to the Special Issue Forest and Urban Green Space Ecosystem Services and Management)

Abstract

Rapid urbanisation has exacerbated habitat fragmentation and degradation, necessitating urgent improvements to urban habitat quality. However, most current studies lack an analysis of spatial differences in local ecological quality, particularly a systematic exploration of how different urban spatial characteristics drive such differences. Based on this, we use Shanghai as an example, employing the InVEST model to assess habitat quality, and utilise CatBoost machine learning models and the SHAP model to reveal the specific spatial distribution characteristics of the habitat quality spatial differences from a morphological perspective, as well as its response to changes in urban spatial form factors. The results indicate that (1) urban habitat quality exhibits significant spatial differences, with quality differences persisting even within regions of the same habitat grade, demonstrating complex spatial characteristics; (2) density-related indicators such as building density and population density have a significant negative impact on the habitat quality spatial difference value, while configuration-related indicators such as the water ratio and Normalised Difference Vegetation Index have a significant positive effect, with Population Density contributing the most among all variables (20.74%); and (3) the variables exhibit significant nonlinearity and threshold effects. For example, when building density exceeds 0.05, the positive impact becomes a negative impact. The interactions between variables further reveal the multi-dimensional coupling mechanisms underlying habitat quality performance. This study contributes to a deeper understanding of the spatial differences of urban habitat quality, providing scientific support for urban ecological zoning management, the optimised allocation of green space resources, and differentiated spatial governance while offering methodological and decision-making references for the construction of high-quality ecological cities.

1. Introduction

With the acceleration of global urbanisation, the health and sustainable development of urban ecosystems have become a focus of international attention, and rapid urbanisation has not only brought about rapid economic prosperity but also ecological issues such as habitat fragmentation [1], land degradation [2], the heat island effect [3], and river pollution [4]. Many major international cities, such as New York [5], London [6], and Seoul [7], face similar environmental challenges. Ecological construction, as an indispensable component of urban development [8], is not only crucial for the construction of sustainable cities [9] but also significantly impacts ecosystem services and residents’ well-being [10,11]. Currently, research on the relationship between urbanisation and ecological issues primarily focuses on the construction of urban ecological networks [12], the identification of ecologically sensitive areas [13], the assessment and optimisation of ecological risks and ecological security patterns [14,15,16], and ecological issues caused by urban pollution [17]. Among these, identifying threat sources, ecological sources, and spatial patches [18,19], as well as constructing ecological corridors and ecological networks to enhance habitat quality, are common approaches [20,21]. Although there have been regional-scale studies on urban habitat quality [22], when the focus is narrowed to within cities, research has primarily examined the spatial connectivity of different habitat quality zones within cities, aiming to enhance habitat quality by constructing ecological networks. However, habitat quality is known to decline with increasing distance due to various influencing factors [23]. Even though there may be potential quality differences and ecological functional imbalances between habitat units within the same spatial unit, existing studies have primarily focused on connecting high-quality habitat units [24], with limited analysis of habitat quality differences within spatial units. This ‘point-to-point’ connection strategy for high-quality ecological endpoints, while beneficial for macro-scale optimisation, struggles to accurately identify quality differences within spatial units, thereby limiting the overall functionality of ecological networks. Therefore, we must transcend the perspective of individual patches or connectivity pathways to comprehensively understand the spatial differences within urban ecological environments. By systematically quantifying the local quality differences and interactions between habitat units, we can develop precise and efficient ecological space governance and quality improvement strategies, laying a scientific foundation for the construction of truly sustainable ecological cities [25].
As landscape ecology continues to delve into spatial form analysis [26,27], the spatial differences in habitat quality have gradually become an important topic in urban ecological research [28,29,30]. Numerous studies have shown that habitat quality has a significant impact on urban wildlife [31,32], and its changes reflect the interaction between urban nature and human activities. Habitat quality, influenced by natural geographical background and the intensity of human activities [33,34,35], exhibits significant local differences and structural complexity in its spatial pattern within cities [36]. Even at the macro-scale, regions classified under the same ecological functional category may exhibit significant deviations in habitat conditions across different grids or plots [37]. This spatial difference reflects both the heterogeneous responses of ecosystems to disturbances within urban environments [38,39] and the spatial unevenness in the provision of ecological services [40,41,42], offering valuable insights into the resilience and restoration potential of urban ecosystems. Although previous studies have made some progress in the overall assessment and gradient analysis of habitat quality [43,44,45], there remains a lack of the systematic characterisation of local quality differences, spatial interactive relationships, and their underlying mechanisms among habitat units within cities, limiting a comprehensive understanding of spatial differences in habitat quality. Therefore, it is necessary to adopt a finer spatial scale to systematically analyse the driving mechanisms of urban spatial form factors on habitat heterogeneity patterns, filling the theoretical and empirical gaps in the analysis of micro-scale spatial differences in urban ecosystem research and providing a scientific basis for precise and differentiated urban ecological space governance.
Currently, the academic community has produced numerous research findings on the description of urban spatial form [46,47,48,49,50]. Wang et al. characterised urban form from aspects, such as green space patterns, built environment, human activity intensity, and topographical conditions, and revealed the nonlinear impact of urbanisation on land surface temperature (LST) [51]. In addition, Bansal et al. studied the impact of urban morphology on the urban heat island effect, describing the spatial morphology of cities in terms of building height, altitude, vegetation, and other factors as independent variables [52]. Building on previous research, this study constructs an urban spatial form indicator system encompassing both two-dimensional and three-dimensional features to systematically quantify the impact of urban development patterns on the spatial differences in habitat quality. Additionally, we selected Shanghai as a case study due to its multifaceted typicality and advantages. On the one hand, Shanghai is located in the core area of the Yangtze River Delta on the east coast of China and has a permanent population of over 24 million, making it one of the most representative megacities in China and globally [53]. Shanghai has a high level of urbanisation and a typical development pattern, compared with other cities in the surrounding area (such as Suzhou and Wuxi), and Shanghai exhibits a higher intensity of built environment and more complex spatial utilisation, providing a model for studying the response mechanisms of urban ecosystems [54]. On the other hand, Shanghai has relatively complete remote sensing data, urban development data, and urban construction data [55], providing a solid foundation of data support for this study. Furthermore, Shanghai has a high level of urban construction, diverse urban spatial forms, and a prominent contradiction between ecological protection and urban expansion [56,57], making it both practically urgent and theoretically representative for conducting research on habitat quality spatial differences. Therefore, this study selects Shanghai as the research object, integrates previous research, constructs a multi-dimensional urban form indicator system, and systematically assesses the influence mechanisms of urban spatial form on habitat quality spatial differences, providing practical evidence and methodological references for global megacities to achieve ecological resilience enhancement and sustainable spatial optimisation.
In this study, accurately identifying the spatial differences of urban spatial forms that affect habitat quality is a critical step. Currently, quantitative assessments of habitat quality primarily utilise the habitat quality calculation model of the InVEST model [58,59], which calculates habitat quality based on land use data and threat source data [60,61], accurately reflecting urban habitat quality. With the rapid development of remote sensing technology, researchers can now access higher-resolution and larger-scale land use data [62], enabling more precise reflections of urban habitat quality. However, traditional methods have limitations in analysing the complex nonlinear relationships between urban spatial patterns and habitats. Nonlinear models do not rely on data distribution like traditional methods do but increase in complexity as the data change, making them particularly effective for addressing the research questions in this study. Examples include Random Forest [63], XGBoost [64], GBRT [65], LightGBM [66], SVM [67], etc. Although these models are highly effective in studying the nonlinear effects of urban spatial form on habitat spatial differences, they are black-box models, making it difficult to interpret their results intuitively. Explainable machine learning offers a new approach to addressing this issue, with the SHAP model providing intuitive explanations for both global and local model results, revealing the complex interactions between variables [68].
In summary, our study focuses on the following two research questions: (1) What are the spatial distribution characteristics of habitat quality differences in high-density urban areas? (2) How does urban spatial form influence these spatial differences in habitat quality? The research significance of our study is primarily reflected in the following aspects: (1) Breaking away from the traditional research paradigm that focuses solely on the overall level of habitat quality, this study systematically characterises the local differences and spatial imbalances in habitat quality within cities. (2) By employing interpretable machine learning methods, it provides a more in-depth and comprehensive understanding of the complex relationship between urban spatial form and habitat spatial differences. (3) Based on the research findings, it offers scientific recommendations for urban planning and management in rapidly urbanising cities, identifying habitats that require improvement in the future and providing guidance for alleviating urban ecological pressures.

2. Materials and Methods

2.1. Shanghai’s Geographical Location

Shanghai is located at the mouth of the Yangtze River in eastern China, with geographical coordinates of 120°52′–122°12′ east longitude and 30°40′–31°53′ north latitude, covering a total area of approximately 6,340.5 square kilometres. As of 2023, the permanent population exceeded 24.8 million, making it one of China’s most densely populated and highly urbanised megacities. The central urban area of Shanghai is characterised by an extremely high population density, building density, and land development intensity, with its spatial form exhibiting significant trends toward high density, mixed-use development, and verticalisation [69]. Therefore, this study selects Shanghai as a typical research area, which is highly representative, facilitating an in-depth exploration of the mechanisms by which urban spatial form influences the spatial differences in habitat quality (Figure 1).

2.2. Research Data Sources

The land use data used in this study were obtained from a 1-metre resolution land use map created by Li et al. using deep learning [70], based on open access data from 2021, which can be accessed from the Zenodo website (https://zenodo.org/records/8214467 accessed on 1 July 2025), providing a high accuracy level for spatial differences studies. The building vector data are derived from Google Earth imagery and street view images with a resolution of 0.3–1 metre from 2022 to 2024, based on research by Zhang et al. Combined with other data, machine learning and large multimodal models were used to generate attributes for each building, including the roof, height, structure, function, style, age and quality, with accuracy leading international counterparts [71]. The dataset can be downloaded from the Figshare website (https://figshare.com/articles/dataset/CMAB-The_World_s_First_National-Scale_Multi-Attribute_Building_Dataset/27992417 accessed on 1 July 2025). The road data are sourced from OpenStreetMap (https://www.openstreetmap.org/) 2023 urban road data. The population data are sourced from the 2023 1KM global population distribution data provided by the Oak Ridge National Laboratory in the United States, available on the LandScan website (https://landscan.ornl.gov/). The DEM elevation data are derived from the 30-metre FathomDEM data created by Uhe et al. [72], which use 2023 LiDAR as the target data; integrate COPDEM data, forest height data, and other datasets; and were generated using a machine learning model. Compared to the industry-standard COPDEM data, this dataset addresses issues such as vegetation and building obstructions, achieving extremely high accuracy. The units are centimetres, and the data can be obtained from the Zenodo website (https://zenodo.org/records/14511570 accessed on 1 July 2025). Normalised Difference Vegetation Index (NDVI) data were generated by Gao et al. [73] based on the Aqua/Terra—MODIS satellite sensor MOD13Q1 and land use data. It was created through a series of processes, including initial reconstruction of similar feature noise pixels, S-G filtering of long sequence images, maintaining high quality, monthly synthesis, and stitching, to form the 2023 NDVI data for China. The data can be obtained from the National Qinghai-Tibet Plateau Science Data Centre (http://data.tpdc.ac.cn).

2.3. Urban Spatial Form Variables and Spatial Differences in Habitat Quality

Urban spatial form refers to the structural and three-dimensional characteristics of a city in geographical space, reflecting the level of built environment and degree of urbanisation [74]. It is a concentrated manifestation of the spatial coupling and interaction between the natural environment, socio-cultural factors, and urban functions. This paper builds upon existing research foundations, adopting a two-dimensional and three-dimensional perspective [75], to establish an urban spatial form indicator system encompassing multiple dimensions such as density, shape, configuration, landscape, and topography, thereby comprehensively quantifying urban spatial form characteristics. Table 1 shows the statistical information of the independent variables and dependent variables, and Figure 2 shows the spatial distribution patterns of all the independent variables.

2.3.1. Density Type

Density type indicators reflect the degree of spatial aggregation, including the building density, road density, and population density. Their development and aggregation not only affect urban functions, residents’ quality of life, and economic activities but also have a certain impact on the ecological environment. Research indicates that the aggregation of buildings can disrupt the continuity of habitats [76], road connectivity can affect the integrity of habitats [77], and human activities can impact the coordination of habitats [78]. Therefore, selecting these three typical indicators to reflect the spatial aggregation patterns of urban development can help us gain a more comprehensive understanding of the morphological characteristics of cities in a two-dimensional plane. Building density is calculated as the ratio of the building area to the area of the assessment unit, road density is calculated based on road length, and population density is obtained by proportionally weighting the population density data and converting them to the assessment unit grid.

2.3.2. Shape Type

In addition to traditional two-dimensional analysis, it is also necessary to conduct an in-depth analysis of the spatial characteristics of urban construction from a three-dimensional perspective. In three dimensions, building height is one of the most representative indicators [79,80], reflecting the intensity of vertical development in urban areas [81], and its elevation changes affect habitat quality [82]. The number of building patches indicates the density of buildings within a given spatial unit; the higher the number, the stronger is the vertical sense of oppression in the space. By combining the average building height with the building density, one can comprehensively assess the intensity of building development and spatial crowding at the unit scale. Additionally, building boundary complexity measures the degree of deviation from a standard circular shape, indirectly influencing surrounding ecological spaces [83]. These three-dimensional indicators provide a more comprehensive revelation of the structural characteristics of the built environment in vertical space. The average height and patch number are calculated based on the actual height and distribution density of buildings, respectively, better reflecting the actual disturbance patterns of urban three-dimensional forms on ecosystems. The building boundary complexity index is calculated as follows:
C = P 2 π A
In the formula, C is the building boundary complexity index, P is the perimeter of the building, and A is the area of the building.

2.3.3. Configuration Type

The configuration type primarily reflects a city’s blue-green spaces and land use patterns. Blue-green spaces serve as a crucial foundational element for enhancing habitat quality, functioning not only as an integral component of urban space but also playing a significant role in residents’ ecological well-being. Scientific planning and the configuration of blue-green infrastructure can mitigate the negative impacts of urbanisation on habitat quality [84]. Land use intensity, which reflects the intensity of land use in urban spaces, can negatively impact habitat quality when it becomes too high, as it may accommodate excessive urban functions [85]. Therefore, this study selects land use intensity, water ratio, and NDVI data as the basic configuration characteristics of urban spaces. Land use intensity is based on land use type data at the unit spatial level, while blue-green spaces are reflected through the water ratio and NDVI data.

2.3.4. Landscape Type

The landscape pattern index is an important indicator reflecting the spatial structure and form of urban green space types. It can identify habitat patches and corridors in urban spaces, etc. [86]. The fragstats software is commonly used for calculation [87]. However, due to the high precision and large volume of data in this study, the landscapemetrics 2.2.1 in R language was selected for calculating the landscape pattern index [88]. Considering the structural correlation among indicators in landscape patterns, to avoid data redundancy, this study employs LPI, SI, SHEI, NP, and AI to reveal the distribution and functions of green spaces within the urban spatial environment (Table 2).

2.3.5. Terrain Type

Terrain is a fundamental indicator of urban spatial form, directly influencing the development of urban form, transportation planning, and more. Different terrains have different habitat conditions, significantly affecting habitat quality. Elevation and slope are two key characteristics of terrain. Therefore, this study selected the average elevation and average slope to reflect terrain features. Average elevation describes the elevation variation of spatial units, while average slope indicates the average degree of terrain undulation within spatial units. We extracted and calculated these values using DEM data via the ArcGIS 10.8.1 platform.

2.4. Habitat Quality and Spatial Differences Value

2.4.1. Habitat Quality Calculation

This study utilised the InVEST model to calculate habitat quality, which is currently the most commonly used method among scholars for analysing habitat quality [89,90]. By analysing land use and land cover maps (LULC) and assessing threats to species habitats, InVEST models habitat quality and rarity as proxies for biodiversity, ultimately estimating the extent and degradation status of habitat and vegetation types across the entire landscape. We established a threat source table and a sensitivity table based on literature data and expert opinions [91,92,93,94,95] and conducted sensitivity tests using different max-dist and weight values (Table 3). The results of the sensitivity analysis showed that when the influence distance and weight of threat factors were increased, the average habitat quality decreased from 0.225 to 0.210 (a decrease of approximately 6.88%), and the spatial variance also decreased from 0.0211 to 0.0151. This trend indicates that the model exhibits moderate sensitivity to parameter settings, with logical and reasonable output results and no spatial anomalies, thereby validating the robustness of the model settings. Subsequently, we selected parameters commonly used in academic research for calculation, as shown in the table below. Finally, in conjunction with relevant research papers [96,97], Group 2 was selected as the research parameter settings (see Table 4 and Table 5 for details).

2.4.2. Calculation of Spatial Differences in Habitat Quality Values

Spatial differences in habitat quality is an important indicator for measuring the structural differences within urban ecological spaces. It not only reveals the disruptive effects of spatial structure on the transmission pathways and intensity of ecological processes during urban expansion but also highlights the potential nonlinear impacts of urban form on habitat quality differences and the formation of ‘ecological fragmentation zones.’ To precisely characterise these spatial differences, we utilise spatial residuals to analyse the spatial differences. By accurately identifying habitat spatial differences, we can effectively locate ‘ecological hotspots’—areas with significantly higher habitat quality than surrounding units—as key nodes for biodiversity conservation and ecological function maintenance; conversely, ‘ecological coldspots’ indicate priority areas for restoration and serve as focal points for urban ecological governance interventions. Methodologically, we first use ArcGIS10.8.1’s ‘Focal Statistics’ tool to extract the average habitat quality of each cell’s neighbourhood; this includes both sides of the domain relationship, mainly adding the adjacent units surrounding the perimeter of the unit, for a total of 8 units, i.e., all units within a radius of 300 m from the centre of the unit grid. Then, we calculate the difference between this value and the target cell’s value, defining it as the cell’s spatial differences value. The specific calculation formula is as follows:
H i = Q i Q N ( i ) ¯
In the formula, H i represents the spatial difference value of cell i , Q i represents the habitat quality value of cell i , and Q N ( i ) ¯ represents the average habitat quality value of all neighbouring cells within domain N ( i ) .

2.5. Model Construction

2.5.1. Pearson Heat Map Correlation Analysis

Pearson heatmap correlation analysis is used to quantify the degree of linear correlation between multiple variables. Its core is to measure the strength of correlation through the Pearson correlation coefficient (range [−1,1]): positive values indicate positive correlations, negative values indicate negative correlations, and the closer the absolute value is to 1, the stronger the correlation. The implementation steps of this method are as follows: first, pairwise correlation coefficients are calculated for all variables involved in this study, and a symmetric correlation coefficient matrix is constructed; subsequently, this matrix is visualised in the form of a heatmap, with colour gradients (e.g., red indicating strong positive correlation and blue indicating strong negative correlation) to intuitively present the distribution characteristics of the correlation strength between variables. In this study, this method was used to test the degree of multicollinearity among various indicators of urban spatial form (such as building density, NDVI, etc.), providing a basis for subsequent model variable selection and avoiding the interference of multicollinearity on model stability. The calculation formula is as follows:
r = i = 1 n X i X ¯ Y i Y ¯ i = 1 n X i X ¯ 2 i = 1 n Y i Y ¯ 2
In the formula, X ¯ and Y ¯ are the means of variables X and Y , respectively, and n is the sample size.

2.5.2. Global Moran’s I

Global Moran’s I is a commonly used spatial autocorrelation index that quantifies the degree of spatial clustering of a variable in spatial data. Its value range is typically between −1 and 1. When the Moran’s I index is significantly greater than zero, it indicates positive spatial autocorrelation, meaning that values in spatially adjacent areas tend to be similar. Conversely, if the Moran’s I index is significantly less than zero, it indicates negative spatial autocorrelation, meaning that values in spatially adjacent areas exhibit a dispersed pattern. When applied to model residual analysis, the Moran’s I index can reveal whether residuals exhibit significant spatial structure, thereby assessing whether the model adequately captures spatial dependencies. If residuals exhibit significant spatial autocorrelation, it suggests that the model has overlooked spatial effects, indicating the need to incorporate spatial regression models or consider spatial neighbourhood variables to enhance the model’s explanatory power and predictive accuracy.
I = n W × i = 1 n j = 1 n w i j x i x ¯ x j x ¯ i = 1 n x i x ¯ 2
In the formula, n is the number of samples, x i and x j are the observed values of the i -th and j -th samples, respectively, x ¯ is the average of the observed values, w i j is the weight in the spatial weight matrix (reflecting the spatial relationship between i and j , such as adjacency or inverse distance), and W = i = 1 n j = 1 n w i j is the sum of all spatial weights.

2.5.3. CatBoost Model

Machine learning has significant advantages in researching urban system-related issues, enhancing the scientific depth and practical breadth of research. Therefore, this paper introduces the Categorical Boosting Machine (CatBoost) model, which can automatically capture high-order nonlinear relationships and complex interaction effects between variables. It demonstrates higher modelling accuracy and interpretability when handling large-scale feature data and spatial difference issues [98].
When selecting models, we pre-compared the performance of seven common regression models in prediction tasks. The code was set up with 5-fold cross-validation and test R2 mean. The models included Categorical Boosting( CatBoost), eXtreme Gradient Boosting(XGBoost), Random Forest(RF), Light Gradient Boosting Machine(LightGBM), Support Vector Regressor(SVR), Multiple Linear Regression(MLR), and Decision Tree Regressor(DTR). Based on the test set results (Table 6), the CatBoost model performed the best, achieving the highest coefficient of determination (R2 = 0.4615), while its root mean square error (RMSE = 0.0376) and mean absolute error (MAE = 0.0269) were also the smallest, demonstrating excellent fitting accuracy and prediction stability. XGBoost and RF followed closely behind, with R2 values of 0.4450 and 0.4448, respectively, showing similar performance. LightGBM performed slightly worse but still maintained a high predictive capability (R2 = 0.4396). In contrast, SVR and MLR performed relatively poorly, with R2 values of 0.2226 and 0.1374, respectively, reflecting their limitations in capturing complex nonlinear relationships. The DTR has a negative R2 value, indicating poor predictive performance and potential issues with overfitting or underfitting. Based on the cross-validation results, the generalisation capabilities of each model align with their performance on the test set, further validating the superiority of CatBoost. Therefore, CatBoost is selected as the primary model for subsequent analysis and prediction in this study to achieve more precise habitat quality assessment results.
To improve the predictive performance and generalisation ability of the CatBoost regression model, this study constructed a systematic model training and optimisation framework, effectively avoiding overfitting risks through strict data partitioning and multi-level regularisation strategies. Specifically, the dataset was divided into a training set (80%) and a validation set (20%) in an 8:2 ratio to ensure the reliability of model evaluation on independent data. During the hyperparameter optimisation phase, a multi-dimensional parameter search space was designed, encompassing the iteration count (iterations: 200, 500), learning rate (learning_rate: 0.01, 0.03), tree depth (depth: 4, 6), and L2 regularisation coefficient (l2_leaf_reg: 3, 5, 7). The GridSearchCV method with 5-fold cross-validation was used to comprehensively evaluate all parameter combinations, and the parameter configuration with the optimal R2 score on the training set was selected as the base model parameters.
To further enhance the model’s generalisation capability, several strategies were adopted to prevent overfitting: cross-validation was used to ensure the model’s stable performance across different data subsets; L2 regularisation was applied to limit model complexity and prevent excessive weight values; the maximum tree depth was reasonably controlled to avoid overfitting to training noise; a smaller learning rate was used to make the training process smoother and improve generalisation performance; a reasonable number of iterations was set to avoid overtraining; and in the final training stage, an early stopping mechanism was enabled using the validation set (early_stopping_rounds = 50), automatically terminating training when no performance improvement was observed for 50 consecutive rounds, further preventing overfitting. Additionally, a fixed random seed was used to ensure the reproducibility of experiments and the stability of results.
In summary, the trained CatBoost model significantly improves the generalisation capability while maintaining a high prediction accuracy, ensuring the reliability and scientific validity of the model results and providing a solid technical foundation for subsequent habitat quality predictions.

2.5.4. SHAP Model

SHAP is a model interpretation tool based on game theory. Its core idea is to treat each prediction result as an output under a ‘feature cooperation game’ and calculate the marginal contribution value (Shapley value) of each variable in the current model structure to achieve transparent interpretation of the CatBoost model. This paper calculates the average absolute SHAP values for each metric to reflect their global importance ranking; simultaneously, SHAP distribution plots and dependence plots are plotted to explore the nonlinear response patterns of variables and their interaction effects, quantifying the direction and intensity of the influence of urban form factors on the spatial differences of habitat quality from both global and local perspectives.

2.6. Research Framework

The research framework is shown in Figure 3. First, the boundary data of Shanghai were imported into ArcGIS 10.8.1 and divided into 81,619 equal fishing net units. Subsequently, the multi-source urban data obtained were classified and integrated according to five major indicator systems and summarised at the spatial unit level. During the data preprocessing stage, due to the lack of coverage of land use data and imagery data in the wetland islands of the northeastern estuary region (as shown in Figure 4), it was impossible to calculate complete independent and dependent variable values, resulting in missing values (NA). If these were set to 0, it would affect the calculations. Therefore, after excluding these units, 79,995 valid units were retained. Since these NA value areas are small and primarily uninhabited wetland islands, their ecological processes and urban development patterns differ significantly from the main study area. We therefore conclude that their exclusion will not significantly affect the estimation of spatial difference values.
We then ran InVEST 3.15.1 on Windows 10 to calculate habitat quality (running time: approximately 5 h) and ran Python 3.12.7 and R Language 4.5.0 on Jupyter Notebook 4.2.5 to perform the main code calculations and data analysis. First, the landscapemetrics 2.2.1 in R Language was used to calculate various landscape pattern indicators, which were then imported into the InVEST 3.15.1 model to calculate habitat quality. The results were further aggregated to spatial units, and we imported the neighbourhood table and habitat quality data into Python platform in Jupyter Notebook, calculated the habitat quality difference values for each unit, and then, to ensure the scientific validity and reasonableness of the data, we preliminarily validated the relationships between variables using VIF calculations and Pearson correlation heatmaps within the Python platform.. Finally, after comparing the performance of seven models, the CatBoost 1.2.8 model was selected. Combined with the SHAP explainability analysis method (version: 0.47.0), the analysis results were obtained after running for 1.5 h. This study systematically explored the linear and nonlinear influence mechanisms of urban spatial form factors on spatial differences in habitat quality, as well as the interactive effects between variables. The overall research framework aims to provide more refined and differentiated theoretical support and practical references for urban ecological space construction, sustainable urban planning, and habitat quality improvement.

3. Results

3.1. Indicator Test Results

Before constructing the model, this paper first conducted a variance inflation factor (VIF) test on all independent variables to assess the multicollinearity among variables. The test results show that (Table 7), except for SHEI (VIF = 5.985479542) and AI (VIF = 5.867533959), which were slightly higher than the empirical threshold of 5, the VIF values of the remaining variables were relatively low, indicating that there were no serious multicollinearity issues overall, and the data met the requirements for subsequent modelling.
Subsequently, we further analysed the correlations between the respective variables using a Pearson correlation coefficient heat map. The results show that (Figure 5), except for a strong negative correlation between SHEI and LPI (r = −0.88), and NP and AI (r = −0.86), the absolute values of the correlation coefficients between the remaining variables were all less than or equal to 0.7, indicating that, except for a few variables, there was no significant multicollinearity problem among the independent variables as a whole, and there was a good foundation for variable independence.

3.2. Analysis of Spatial Differences in Habitat Quality

3.2.1. Habitat Quality Analysis Results

Figure 6a shows the spatial distribution of habitat quality calculated using the InVEST model. The analysis indicates that habitat quality in the urban core area is generally low, while high-quality areas are primarily concentrated in the southern and northern parts of the city. These high-value areas exhibit a certain degree of fragmentation, while the core area is dominated by continuous low-quality patches, though it also contains several localised high-quality ecological patches. To further conduct spatial differences analysis, we imported the results into the ArcGIS platform, calculated the average habitat quality of neighbouring grid cells, and excluded NA regions caused by the calculation of independent variables. The final spatial distribution map is shown in Figure 6b. This map maintains a high degree of consistency with the spatial pattern output by the InVEST model.

3.2.2. Habitat Quality Spatial Difference Values and Global Moran’s I Analysis

Figure 7 shows the spatial distribution characteristics of habitat quality spatial difference values in the study area. Overall, the distribution does not exhibit significant concentration or differentiation structures, with a relatively dispersed spatial pattern characterised by a certain degree of randomness and local variability. In terms of spatial structure, areas with higher habitat quality have a higher proportion of positive residual units, indicating that local habitat quality is significantly superior to the average value of its neighbouring areas, reflecting a strong ecological self-stabilisation capacity and positive ecological spillover effects. Conversely, in urban core areas or high-intensity development zones, negative residual values are relatively concentrated, indicating that the local ecological quality in these areas is significantly inferior to that of surrounding areas, potentially influenced by factors such as surface hardening, excessive building density, and ecological fragmentation [99]. Notably, even within core urban areas, there are a certain number of positive residual patches, primarily distributed around blue-green infrastructure, forming a spatial structure of ‘low-value background-high-value patches’ nested and mixed. This feature indicates that even in highly urbanised areas, habitat quality exhibits significant differences at the micro-scale, and local ecological advantage zones may play a key role in mitigating overall ecological degradation trends [100]. Overall, the spatial distribution pattern of habitat quality difference values reveals the non-equilibrium nature of urban ecosystems at the local scale, reflecting the complex and nonlinear mechanisms driven by multiple factors of urban spatial form. This provides an important spatial basis and theoretical support for subsequent spatial modelling and mechanism analysis.
We then conducted a spatial autocorrelation analysis of the spatial difference values in habitat quality based on the global Moran’s I statistic. The results revealed a significant positive spatial autocorrelation (Moran I = 0.033399), indicating that grid cells with similar habitat quality spatial difference values tend to cluster spatially. The high z-score (13.300281) and p-value less than 0.001 strongly rejected the null hypothesis of spatial random distribution, confirming that this distribution pattern is statistically significant. This study indicates that, at the scale of this research, habitat quality in the Shanghai region is not randomly distributed across the landscape but exhibits a statistically significant clustering distribution pattern.

3.3. Nonlinear Mechanisms and Explanations

3.3.1. Relative Importance of Urban Spatial Form Variables

We used the CatBoost model to conduct global and local analyses of each variable, explaining the nonlinear characteristics of urban spatial form on habitat quality spatial difference values. The figure below (Figure 8) shows the importance of SHAP global features, with the X-axis of both figures representing the SHAP values and the Y-axis representing each indicator feature. The left figure calculates the absolute average SHAP value for each variable and sorts them from highest to lowest, indicating the contribution of each feature to the habitat quality spatial difference value. The right figure shows the local importance, plotting the SHAP values for each feature as points to display the distribution of SHAP values, with positive values on the right and lower values on the left. The colours indicate the magnitude of the feature values, with red representing high values and blue representing low values.
Feature importance analysis based on SHAP values shows (Figure 8) that spatial differences in habitat quality are influenced by multiple indicators working together. In the global feature importance plot on the left, PD emerges as the core influencing indicator with the highest average absolute SHAP value (20.74%), followed by BD (13.58%), SHEI (12.13%), WR (9.99%), and LPI (8.45%) etc.,. The SHAP value distribution scatter plot on the right further reveals the direction of indicator effects: when the BD feature values are high, the SHAP values are mostly negative, indicating that building densities suppress habitat quality; when the SHEI and WR feature values are high, the SHAP values are mostly positive, indicating that high landscape uniformity and large water area proportions have a positive promotional effect on habitat quality. Overall, the influence of indicators across dimensions on spatial differences in habitat quality exhibits significant dimensional differences. Density type has the most prominent impact on spatial differences in habitat quality, with all variables ranking in the top six, indicating that urban development intensity and human activity density significantly disrupt the spatial distribution of habitat quality [101], highlighting the decisive role of human disturbances such as population, buildings, and roads; landscape type contributes 24.14% to regulating habitat structural integrity; and configuration type(WR, NDVI, LUM) accounts for 16.27% and ranks third, serving as the natural configuration foundation for habitat quality. In contrast, shape type indicators have a relatively weak impact on spatial differences, with all variables at only 11.32%, indicating that building morphology has a relatively limited influence on spatial differences in local habitat quality. Similarly, terrain type indicators also have an overall insignificant impact, but the scatter plot shows a certain nonlinear relationship between ME and MS, which may reflect the complexity and regional differences in habitat quality performance under different terrain conditions.

3.3.2. Marginal Effects of Urban Spatial Form Variables

After identifying the significant nonlinear impact of urban spatial form on habitat quality spatial difference values, this paper further introduces the SHAP method to characterise the marginal effects of key indicators and deepen our understanding of the mechanisms of variable effects. The marginal effect refers to the corresponding change in the dependent variable when the independent variable undergoes a small change. It not only reveals the direction of the relationship between variables (positive or negative) but also quantifies the degree of influence. It is a key tool for analysing nonlinear relationships and threshold effects, Figure 9 illustrates the marginal contribution relationships of each variable to habitat quality spatial difference values, where the horizontal axis represents the indicator values and the vertical axis represents the corresponding SHAP values, which measure the extent of the impact of variable changes on the target variable. We focus on analysing the first five indicator factors.
The results show that, as PD increases within the range of 0–1000, the moderate human activities it triggers can maintain or improve habitat quality locally, indirectly supporting habitat expression and diversity; however, once the threshold is exceeded, the marginal effects of habitat disturbance caused by an excessive population concentration weaken. BD also exhibits a significant negative correlation with the spatial difference values in habitat quality. When BD exceeds 0.05, the positive impact becomes a negative impact, indicating that an excessive building density significantly compresses the ecological space, disrupting the stability and spatial balance of local habitat quality. SHEI exhibits a strong threshold response; when its value exceeds 0.8, spatial difference values shows a sharp decline, indicating that excessive uniformity may disrupt the structural distribution of ecological functions, leading to spatial system imbalance. WR exhibits a clear linear positive effect in the 0–0.4 range, indicating that increasing the proportion of water bodies within this range helps reduce the spatial difference values and enhance ecological connectivity. Between 0.4 and 0.6, the marginal effect flattens out, with further increases in regulatory effects weakening, followed by a strong negative effect and increased dispersion, as the underlying mechanisms become more complex. LPI exhibits a positive effect on the spatial difference values within the 0–60 range, indicating that moderately sized core habitat patches can strengthen habitat integrity and stability, benefiting habitat quality improvement; however, beyond this threshold, the SHAP value rapidly declines, indicating that the ecological benefits of core habitat patch size have an upper limit, and overly expanded single patches may actually weaken habitat quality. RD exhibits an overall negative correlation effect, with high clustering in the 0–0.02 range, indicating that road densification significantly exacerbates local ecological disturbances, widening the gap in habitat quality between neighbouring areas and increasing the spatial difference values. As the density further increases, its impact gradually exhibits a trend toward dispersion. In summary, SHAP analysis reveals the nonlinear mechanism and marginal effect differences of urban spatial form factors on the habitat quality spatial difference value, providing important evidence and decision support for urban ecological planning and spatial optimisation strategies.

3.3.3. Interactive Responses of Indicators

To further clarify the impact of interactive effects between different variables on the habitat quality spatial difference value and provide more detailed differentiated guidance for urban development, this study further mapped the interactive effect diagrams of indicators (Figure 10). We selected indicators with significant interactive significance for analysis, including BD and PD, BD and RD, WR and BD, WR and NDVI, BD and NDVI, and NDVI and SHEI. These features represent the interactions between urban spatial construction density, between urban construction and blue-green spaces, and between blue-green spaces and their morphological characteristics. The Y-axis in the figure represents the SHAP values.
As shown in Figure 10, the interaction effects of the three sets of indicator characteristics—BD and PD, BD and RD, and BD and NDVI—exhibit the same trend. When BD is in the lower range of 0–0.1, and PD < 1000, RD is low, or NDVI is between 0.5and 1.0, the habitat quality spatial difference value shows a significant positive improvement, indicating that under low construction density conditions, moderate spatial patch density or higher vegetation cover can synergistically promote the optimisation of local ecological performance. However, when BD exceeds this threshold, the interactive gain effect significantly weakens or even turns negative, indicating that excessive construction intensity can suppress the positive effects of other ecological factors. The remaining three indicators show different patterns: when the WR values are between 0 and 0.6 and the BD values are between 0 and 0.1, when the NDVI values are between 0.5 and 1.25 and the WR values are between 0.2 and0.6, and when the NDVI values are between 0.75 and 1.0 or the SHEI values are between 0 and 0.8, the positive improvement in habitat quality is higher.

4. Discussion

4.1. The Distribution Relationship Between Urban Habitat Quality and Spatial Differences

Urban habitat quality serves as a crucial indicator for assessing the health and functional state of urban ecosystems. Its spatial distribution is not only constrained by natural conditions but is also directly influenced by the complex interplay of urban spatial forms [102,103]. As Jasper van Vliet’s research has found, urban expansion affects the displacement of farmland, and this displacement directly damages forest habitats [104]. Based on the simulation results from the InVEST model in this study, habitat quality in the core urban areas of Shanghai is generally low, while peripheral green patches exhibit a higher ecological value. This result is generally consistent with the findings of Xie et al. [105]. This pattern aligns closely with the typical spatial logic linking urbanisation gradients and ecological degradation [106,107]. However, after further introducing habitat quality spatial difference value indicators, a more structurally complex ecological spatial pattern was observed: significant positive and negative deviations exist between local habitat quality and neighbourhood averages, and the spatial difference value distribution does not fully follow the absolute gradient of habitat quality but instead exhibits a localised mismatch characterised by alternating ‘hotspots’ and ‘coldspots.’ For example, although the overall habitat quality in the core urban area is relatively low, certain green spaces and ecological corridors exhibit positive residuals, indicating strong ecological self-stabilisation capacity and recovery potential [108].
In planning terms, efforts should prioritise promoting ecological connectivity and functional radiation around these areas. In contrast, in urban fringe areas, despite abundant natural resources, some patches exhibit negative residuals, indicating constraints from fragmented structures or local disturbances, preventing the effective release of ecological advantages and thereby damaging the value of its own ecosystem services. Scholars such as Biswas have pointed out that the degree of landscape fragmentation has a significant negative correlation with ecosystem services [109]. This inconsistency between ‘habitat quality and spatial differences’ essentially reveals a spatial regulatory lag mechanism in the transmission of urban ecological functions: even if a region possesses superior natural endowments, if its spatial structure is fragmented, connectivity is insufficient, or it is subject to strong human disturbance, its ecological performance may still fall below the average of neighbouring areas. The research findings of de Lima and other scholars confirm the significant impact of habitat fragmentation on habitat quality and biodiversity patterns [110]. Conversely, regions with relatively weak ecological foundations can achieve ecological improvement if their spatial layout is reasonable and their composite functions are appropriately configured [111]. Therefore, spatial differences, as a relative ecological evaluation indicator, not only compensate for the shortcomings of static habitat quality assessments but also emphasise spatial processes and neighbourhood interactions. They hold significant practical significance for identifying ecological potential zones, sensitive zones, and optimisation zones.

4.2. The Impact of Urban Spatial Form on Spatial Differences in Habitat Quality

This study conducted an in-depth analysis of the impact of urban spatial form on spatial differences in habitat quality, revealing a significant threshold relationship and multidimensional synergistic effects.
From the perspective of the marginal effects of key indicators, different indicators exhibit distinct trends. PD can promote local habitat expression and diversity within a certain range, but its marginal effect weakens beyond the threshold, indicating that moderate human activity is beneficial for ecological connectivity between habitats, while excessive activity has negative effects. This aligns with the findings of Yang et al. [112]. Therefore, in urban planning, it is essential to reasonably control regional development intensity to avoid excessive human activities that disrupt the ecological balance. BD is negatively correlated with spatial difference values; excessively high BD values compress ecological space and disrupt the stability and balance of habitat quality. During urban construction, building density must be strictly controlled and sufficient ecological land reserved to maintain good habitat conditions [113]. SHEI exhibits a threshold response, where excessive uniformity disrupts the distribution of ecological functions, leading to spatial system imbalance. This implies that while pursuing landscape diversity, attention must be paid to the reasonable allocation of ecological functions to avoid harming ecosystem health due to the excessive pursuit of uniformity. WR has different effects on spatial difference values across different intervals. Within a certain range, increasing the proportion of water bodies can enhance ecological connectivity, but excessive proportions have negative effects. This indicates that urban water system planning must comprehensively consider the proportion of water bodies. For example, Gupta and De assessed the importance of water bodies in mitigating the urban heat island effect, determining their optimal planning size and key layout positions to maximise ecological benefits [114]. LPI reinforces habitat integrity at moderate scales but weakens habitat quality when overly expanded, reflecting that core habitat patches are not necessarily better the larger they are; appropriate scales must be maintained. RD shows an overall negative correlation, with road densification exacerbating ecological disturbance; planning should optimise the road layout to reduce damage to the ecological environment [115].
From the perspective of the synergistic effects of multi-dimensional indicators, there are significant differences in the extent and direction of influence on the spatial differences in habitat quality across different dimensions. Indicators in the density type dimension have the most prominent impact, revealing that urban development intensity and human activities are key factors influencing the spatial distribution of habitat quality [116]. This indicates that during urban development, the impacts of population, building, and road layout on the ecological environment should be fully considered, and effective measures should be taken to reduce human disturbance. The landscape type dimension plays a supplementary role in regulating habitat structural integrity, emphasising the importance of landscape pattern optimisation in ecological conservation [117,118]. The configuration type dimension serves as the natural configuration foundation for habitat quality, and by adjusting the proportions and layout of natural elements [119], it can enhance habitat quality. In contrast, the impacts of the shape type and terrain type dimensions are relatively weaker. The building form indicators of the shape type dimension have a limited influence on spatial differences in local habitat quality, but they may still affect micro-ecological environments in specific regions or projects and should not be completely ignored [120]. The terrain indicators of the terrain type dimension have an overall insignificant impact, but both ME and MS show a non-linear relationship., reflecting the complexity and regional differences in habitat quality under different terrain conditions. This aligns with the research findings of Mi et al. [121], indicating that terrain factors should be considered on a case-by-case basis in ecological planning.

4.3. Impact on Urban Planning and Management

As urbanisation continues to advance, the disruptive effects of urban spatial forms on ecosystem structure and function have become increasingly evident. This study found that density type indicators exhibit significant effects on the spatial differences in habitat quality, particularly in core areas where negative residuals are highly concentrated, indicating that the existing urban built environment has weakened local ecological functions in certain regions [122]. Therefore, in urban master planning, priority should be given to strengthening ecological space protection mechanisms. For example, in areas along urban edges where ecological connectivity is good and spatial differences exhibit positive values, it is recommended to designate these areas as ecological red lines or green buffer zones to restrict development intensity, prevent ecological fragmentation, and maximise their ecological spillover effects. For urban core and high-intensity development areas, regions with negative residuals should be prioritised for ecological restoration. Measures such as green space enhancement projects and green building renovations (e.g., rooftop gardens, vertical greening) should be implemented to enhance ecological carrying capacity [123]. Additionally, an ecological ventilation corridor network aligned with prevailing wind directions should be established, with green space nodes integrated into the urban road system to facilitate the spatial transmission of ecological flux. Furthermore, it is recommended to incorporate the results of habitat quality spatial difference value analysis into the urban ecological performance monitoring system. By establishing a monitoring platform, the precision and dynamic regulatory capabilities of ecological management can be enhanced. Ecological performance threshold standards (e.g., using spatial residuals per land parcel as the basis for construction intensity) should be introduced into land use approval and construction control processes to promote the quantification of ecological planning objectives and the precision of spatial interventions.

4.4. Limitations of This Study and Future Research Directions

(1)
Limitations
This study uses Shanghai as a case study. Although Shanghai is a typical plain-type city and has a certain degree of representativeness in urban ecological research, it does not cover the characteristic differences in urban spatial morphology and ecological processes under complex terrain conditions such as plateaus, hills, and mountains, which limits the spatial generalisability of the research conclusions. In addition, this study relies on the integrated analysis of multi-source data. Although time coordination has been carried out as much as possible, some data still have time inconsistencies, which may introduce potential biases. Furthermore, the current analysis has not fully considered the potential time lag effects and dynamic feedback processes between urban form evolution and ecological responses, nor has it incorporated seasonal ecological fluctuations and the dynamic characteristics of human disturbances, thereby limiting the model’s explanatory power in the temporal dimension. In terms of spatial scale setting, although this study adopted a 300 m × 300 m grid and a 300 m radius neighbourhood scale to focus on urban micro-spatial heterogeneity, there are still certain scale limitations. On the one hand, the 300 m grid may struggle to capture the role of smaller-scale ecological elements, such as street-level green spaces and small water bodies, in enhancing local habitat quality. On the other hand, the setting of the neighbourhood scale is sensitive to spatial difference values in calculations; using a smaller or larger neighbourhood radius could significantly affect the estimated neighbourhood average values, thereby impacting the identification of spatial difference in habitat quality.
(2)
Future research directions
Future research could be further expanded to different urban types and topographical types (such as mountainous, plateau, or coastal cities) through cross-regional comparative analysis to enhance the generalisability and applicability of the research conclusions. Additionally, it is recommended to incorporate multi-temporal remote sensing and land use data to explore the dynamic associations and lag effects between urban spatial form evolution and ecosystem responses, thereby enhancing the model’s ability to explain temporal processes.

5. Conclusions

This study helps us understand the spatial differences in habitat quality conditions, including internal spatial differentiation (spatial residuals) and the influence of urban spatial form on such differentiation. We constructed urban spatial form as an independent variable from five aspects—densitytype, shape type, configuration type, landscape type, and terrain type—and used the InVEST model to calculate habitat quality and its spatial difference value. We then studied the spatial distribution of this local spatial difference and used it as the dependent variable. We employed the CatBoost model and the SHAP explainable machine learning model to investigate the linear and nonlinear effects of urban spatial form on the spatial differences of habitat quality. The study conclusions are as follows:
(1)
The overall spatial distribution exhibits the typical urbanisation gradient characteristic of ‘low core, high periphery,’ but the spatial difference value reveals local spatial differences in habitat quality. The study results reveal that different habitat quality regions exhibit significant spatial differences in internal quality residuals. Although the core urban area has overall low quality, the local blue-green infrastructure significantly improves the ecological performance of this region, forming a positive residual, while some peripheral areas rich in natural resources exhibit negative residuals, indicating that spatial fragmentation or human disturbance has weakened ecological advantages. This result underscores the necessity and sensitivity of incorporating spatial difference value indicators into urban ecological assessments.
(2)
Urban spatial form variables exert a significant nonlinear influence on the habitat quality spatial difference value. Among these, density type (BD, PD, RD) and landscape type (SHEI, LPI, AI, NP, SI) are the most important variables, collectively explaining over 66% of the variance. In particular, BD and PD exhibit the strongest effects on the spatial difference value, demonstrating that urban construction activities and human activities interfere with habitats, which is even more pronounced in local areas. Additionally, the marginal effects between the habitat quality spatial difference value and spatial form variables generally exhibit threshold characteristics and nonlinear fluctuations. For example, when PD exceeds 1000, marginal ecological gains tend to flatten out; however, when BD (building density) exceeds 0.05, it exerts a significant inhibitory effect on ecology. This nonlinear response reveals the complex adaptive mechanisms of urban ecosystems under different development intensities.
(3)
The interactions between variables further reveal the multi-dimensional coupling mechanisms underlying habitat quality performance. Interaction effect analysis found that construction intensity BD exhibits significant synergistic effects with multiple variables: when BD is at a low level (0–0.05), it synergistically enhances habitat quality when combined with a low population density (0-1000), low road density(0-0.02), or high NDVI (0.5-1.0), indicating a synergistic beneficial effect of ‘low development + high green space’. Combinations such as WR with BD, WR with NDVI, and NDVI with SHEI reflect the complex ecological feedback relationship between the blue-green space configuration and landscape diversity, emphasising the important regulatory role of the ecosystem-wide configuration in urban micro-scale ecological performance.
(4)
As a ‘relative indicator’ of urban ecosystem performance, the habitat quality spatial difference value effectively addresses the lack of analysis of local differences in traditional habitat quality evaluations, expands the spatial identification dimensions of ecological planning, and aids in identifying priority protection areas, ecological sensitive zones, and restoration priority areas, providing theoretical support and a decision-making basis for ecologically oriented differentiated urban spatial optimisation strategies.
In summary, this study not only reveals the spatial differences characteristics of urban habitats at the micro-scale but also clarifies the nonlinear, multi-dimensional driving mechanisms of urban spatial form on habitat quality, aiding in a deeper understanding of the impact mechanisms of urban spatial form on ecosystems. The relevant results provide an important quantitative basis and theoretical support for ecologically oriented urban spatial optimisation and differentiated planning. Future research could further expand to multi-city comparisons, dynamic evolutionary modelling, and empirical validation of ecological processes to enhance the model’s applicability and ecological explanatory power, thereby promoting the refined management and sustainable development of urban ecosystems.

Author Contributions

Conceptualization, R.C., M.X., K.C. and S.C.; methodology, R.C., K.C., and Z.C.; software, R.C. and M.X.; validation, Z.C., K.C. and S.C.; formal analysis, R.C. and Z.C.; investigation, R.C., K.C. and Z.C.; resources, R.C., M.X., X.L. and R.S.; data curation, R.C., X.L. and R.S.; writing—original draft preparation, R.C., Z.C., M.X. and K.C.; writing—review and editing, R.C., K.C. and S.C.; visualization, R.C. and M.X.; supervision, K.C. and S.C.; project administration, S.C.; funding acquisition, Z.C. and M.X. All authors have read and agreed to the published version of the manuscript.

Funding

This research was supported by the General Project of Humanities and Social Sciences Research, Ministry of Education of China (Grant No. 23YJA760016); the Youth Project of the Social Science Foundation of Fujian Province (Grant No. FJ2024C162); and the Educational Science Planning Project of Fujian Agriculture and Forestry University (Grant No. 111423025).

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

This research was generously supported by national and provincial funding programs, including the Ministry of Education of China and Fujian Agriculture and Forestry University.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

References

  1. Hong, W.Y.; Liang, M.D.; Guo, R.Z.; Ma, T.; Li, Y.L.; Wang, W.X. Diagnosis of the fragmentation of urban ecological network structure and its social-ecological responses. Ecol. Appl. 2024, 34, e3041. [Google Scholar] [CrossRef]
  2. Liu, T.; Liu, H.; Qi, Y.J. Construction land expansion and cultivated land protection in urbanizing China: Insights from national land surveys, 1996–2006. Habitat Int. 2015, 46, 13–22. [Google Scholar] [CrossRef]
  3. Arshad, S.; Ahmad, S.R.; Abbas, S.; Asharf, A.; Siddiqui, N.A.; ul Islam, Z. Quantifying the contribution of diminishing green spaces and urban sprawl to urban heat island effect in a rapidly urbanizing metropolitan city of Pakistan. Land Policy 2022, 113, 105874. [Google Scholar] [CrossRef]
  4. Liu, W.; Chen, W.P.; Feng, Q.; Deo, R.C. Situations, challenges and strategies of urban water management in Beijing under rapid urbanization effect. Water Supply 2019, 19, 115–127. [Google Scholar] [CrossRef]
  5. Nath, B.; Ni-Meister, W.; Özdogan, M. Fine-Scale Urban Heat Patterns in New York City Measured by ASTER Satellite-The Role of Complex Spatial Structures. Remote Sens. 2021, 13, 3797. [Google Scholar] [CrossRef]
  6. Simpson, C.H.; Brousse, O.; Heaviside, C. Estimated mortality attributable to the urban heat island during the record-breaking 2022 heatwave in London. Environ. Res. Lett. 2024, 19, 094047. [Google Scholar] [CrossRef] [PubMed]
  7. Park, S.H.; Ko, D.W. Investigating the Effects of the Built Environment on PM2.5 and PM10: A Case Study of Seoul Metropolitan City, South Korea. Sustainability 2018, 10, 4552. [Google Scholar] [CrossRef]
  8. Kopij, G. The Importance of Urban Greening Spaces for Avian Communities in an Urbanized Landscape. Land 2025, 14, 400. [Google Scholar] [CrossRef]
  9. Lovello, E.M.; Valente, D.; Petrosillo, I. Mitigating Land Degradation Through Sustainable Urban Landscapes Planning. Sustainability 2025, 17, 967. [Google Scholar] [CrossRef]
  10. Duarte, G.T.; Santos, P.M.; Cornelissen, T.G.; Ribeiro, M.C.; Paglia, A.P. The effects of landscape patterns on ecosystem services: Meta-analyses of landscape services. Landsc. Ecol. 2018, 33, 1247–1257. [Google Scholar] [CrossRef]
  11. Odhengo, P.; Lutta, A.I.; Osano, P.; Opiyo, R. Urban green spaces in rapidly urbanizing cities: A socio-economic valuation of Nairobi City, Kenya. Cities 2024, 155, 105430. [Google Scholar] [CrossRef]
  12. Kurt, G.; Külahlioglu, M.; Berberoglu, S. Optimized Ecological Network Approach of Highly Urbanized Cities: The Case of Adana City. In Proceedings of the 39th International Symposium on Remote Sensing of Environment, Antalya, Türkiye, 24–28 April 2023; Volume 48-M-1, pp. 553–558. [Google Scholar] [CrossRef]
  13. Chen, J.Y.; Xue, J.F.; Gu, K.; Wang, Y.W. Balancing urban expansion with ecological integrity: An ESP framework for rapidly urbanizing small and medium-sized cities, with insights from Suizhou, China. Ecol. Inform. 2024, 80, 102508. [Google Scholar] [CrossRef]
  14. Hong, W.Y.; Guo, R.Z.; Su, M.; Tang, H.; Chen, L.X.; Hu, W. Sensitivity evaluation and land-use control of urban ecological corridors: A case study of Shenzhen, China. Land Use Policy 2017, 62, 316–325. [Google Scholar] [CrossRef]
  15. Das, M.; Das, A. Indicator based assessment of urban ecological security pattern in Kolkata metropolitan area, India. Geocarto Int. 2022, 37, 16996–17017. [Google Scholar] [CrossRef]
  16. Keshtkar, M.; Mobarghaee, N.; Sayahnia, R.; Asadolahi, Z. Landscape ecological security response to urban growth in Southern Zagros biome, Iran. Ecol. Indic. 2023, 154, 110577. [Google Scholar] [CrossRef]
  17. Hack, J.; Molewijk, D.; Beissler, M.R. A Conceptual Approach to Modeling the Geospatial Impact of Typical Urban Threats on the Habitat Quality of River Corridors. Remote Sens. 2020, 12, 1345. [Google Scholar] [CrossRef]
  18. Chen, J.; Wang, S.S.; Zou, Y.T. Construction of an ecological security pattern based on ecosystem sensitivity and the importance of ecological services: A case study of the Guanzhong Plain urban agglomeration, China. Ecol. Inform. 2022, 136, 108688. [Google Scholar] [CrossRef]
  19. Cook, E.A. Landscape structure indices for assessing urban ecological networks. Landsc. Urban Plan. 2002, 58, 269–280. [Google Scholar] [CrossRef]
  20. Ye, H.; Yang, Z.P.; Xu, X.L. Ecological Corridors Analysis Based on MSPA and MCR Model—A Case Study of the Tomur World Natural Heritage Region. Sustainability 2020, 12, 959. [Google Scholar] [CrossRef]
  21. Liu, M.L.; Peng, J.; Dong, J.Q.; Jiang, H.; Xu, D.M.; Meersmans, J. Trade-offs of landscape connectivity between regional and interregional ecological security patterns in a junction area of Beijing-Tianjin-Hebei region. Appl. Geogr. 2024, 167, 103272. [Google Scholar] [CrossRef]
  22. Arnaiz-Schmitz, C.; Díaz, P.; Ruiz-Labourdette, D.; Herrero-Jáuregui, C.; Molina, M.; Montes, C.; Pineda, F.D.; Schmitz, M.F. Modelling of socio-ecological connectivity. The rural-urban network in the surroundings of Madrid (Central Spain). Urban Ecosyst. 2018, 21, 1199–1212. [Google Scholar] [CrossRef]
  23. Santrucková, M.; Dostálek, J.; Bendíková, L.; Frantík, T.; Demková, K. Natural habitats in manor landscape gardens: Their distribution and quality. Urban Ecosyst. 2023, 26, 651–664. [Google Scholar] [CrossRef]
  24. Zhang, Y.Z.; Jiang, Z.Y.; Li, Y.Y.; Yang, Z.G.; Wang, X.H.; Li, X.B. Construction and Optimization of an Urban Ecological Security Pattern Based on Habitat Quality Assessment and the Minimum Cumulative Resistance Model in Shenzhen City, China. Forest 2021, 12, 847. [Google Scholar] [CrossRef]
  25. Kindvall, O.; Pont, M.B.; Stavroulaki, I.; Lanemo, E.; Wigren, L.; Levan, M. Predicting habitat functionality using habitat network models in urban planning. Environ. Plan. B Urban Anal. City Sci. 2024, 52, 1482–1497. [Google Scholar] [CrossRef]
  26. Dupras, J.; Marull, J.; Parcerisas, L.; Coll, F.; Gonzalez, A.; Girard, M.; Tello, E. The impacts of urban sprawl on ecological connectivity in the Montreal Metropolitan Region. Environ. Sci. Policy 2016, 58, 61–73. [Google Scholar] [CrossRef]
  27. Lemoine-Rodríguez, R.; García-Arroyo, M.; Gómez-Martínez, M.A.; Back, M.; Lindeman, T.; MacGregor-Fors, I. Unveiling urban ecological integrity: Spatially explicit assessment in contrasting environments. Urban Ecosyst. 2024, 27, 1167–1174. [Google Scholar] [CrossRef]
  28. Ye, X.P.; Wang, T.J.; Skidmore, A.K. Spatial pattern of habitat quality modulates population persistence in fragmented landscapes. Ecol. Res. 2013, 28, 949–958. [Google Scholar] [CrossRef]
  29. He, J.H.; Huang, J.L.; Li, C. The evaluation for the impact of land use change on habitat quality: A joint contribution of cellular automata scenario simulation and habitat quality assessment model. Ecol. Model. 2017, 336, 58–67. [Google Scholar] [CrossRef]
  30. Pickett, S.T.A.; Cadenasso, M.L.; Rosi-Marshall, E.J.; Belt, K.T.; Groffman, P.M.; Grove, J.M.; Irwin, E.G.; Kaushal, S.S.; LaDeau, S.L.; Nilon, C.H.; et al. Dynamic heterogeneity: A framework to promote ecological integration and hypothesis generation in urban systems. Urban Ecosyst. 2017, 20, 1–14. [Google Scholar] [CrossRef]
  31. Mayer, M.; Sunde, P. Colonization and habitat selection of a declining farmland species in urban areas. Urban Ecosyst. 2020, 23, 543–554. [Google Scholar] [CrossRef]
  32. Wilkins, P.M.; Cao, Y.; Heske, E.J.; Levengood, J.M. Influence of a forest preserve on aquatic macroinvertebrates, habitat quality, and water quality in an urban stream. Urban Ecosyst. 2015, 18, 989–1006. [Google Scholar] [CrossRef]
  33. Wei, J.Q.; Zhang, Y.; Liu, Y.; Li, C.; Tian, Y.S.; Qian, J.; Gao, Y.; Hong, Y.S.; Liu, Y.F. The impact of different road grades on ecological networks in a mega-city Wuhan City, China. Ecol. Indic. 2022, 137, 108784. [Google Scholar] [CrossRef]
  34. Hohl, D.; Stoycheva, T.; Kilgour, R.J.; Anderson, E.C.; LaMontagne, J.M. Changes over time in tree cavity availability across urban habitats. Urban For. Urban Green. 2023, 84, 127926. [Google Scholar] [CrossRef]
  35. Nedeau, E.J.; Merritt, R.W.; Kaufman, M.G. The effect of an industrial effluent on an urban stream benthic community: Water quality vs. habitat quality. Environ. Pollut. 2003, 123, 1–13. [Google Scholar] [CrossRef]
  36. Ramos, I.; González, C.G.; Urrutia, A.L.; Van Cauwelaert, E.M.; Benítez, M. Combined effect of matrix quality and spatial heterogeneity on biodiversity decline. Ecol. Complex. 2019, 36, 261–267. [Google Scholar] [CrossRef]
  37. Qi, Y.X.; Hu, Y.D. Spatiotemporal Variation and Driving Factors Analysis of Habitat Quality: A Case Study in Harbin, China. Land 2024, 13, 67. [Google Scholar] [CrossRef]
  38. Bai, L.M.; Xiu, C.L.; Feng, X.H.; Liu, D.Q. Influence of urbanization on regional habitat quality: A case study of Changchun City. Habitat Int. 2019, 93, 102042. [Google Scholar] [CrossRef]
  39. Soga, M.; Koike, S. Relative importance of quantity, quality and isolation of patches for butterfly diversity in fragmented urban forests. Ecol. Res. 2012, 27, 265–271. [Google Scholar] [CrossRef]
  40. Zhang, Z.R.; Wan, H.W.; Peng, S.L.; Huang, L. Differentiated factors drive the spatial heterogeneity of ecosystem services in Xinjiang Autonomous Region, China. Front. Ecol. Evol. 2023, 11, 1168313. [Google Scholar] [CrossRef]
  41. Liang, F.C.; Zhu, R.M.; Lin, S.H. Exploring spatial relationship between landscape configuration and ecosystem services: A case study of Xiamen-Zhangzhou-Quanzhou in China. Ecol. Model. 2023, 486, 110527. [Google Scholar] [CrossRef]
  42. Fröhlich, A.; Ciach, M. Nocturnal noise and habitat homogeneity limit species richness of owls in an urban environment. Environ. Sci. Pollut. Res. 2019, 26, 17284–17291. [Google Scholar] [CrossRef] [PubMed]
  43. Xu, J.L.; Ling, Y.; Sun, Y.Y.; Jiang, Y.H.; Shen, R.; Wang, Y. How do different processes of habitat fragmentation affect habitat quality?-Evidence from China. Ecol. Indic. 2024, 160, 111880. [Google Scholar] [CrossRef]
  44. Wang, N.; Wang, G.S.; Gun, W.L.; Liu, M. Spatio-Temporal Changes in Habitat Quality and Linkage with Landscape Characteristics Using InVEST-Habitat Quality Model: A Case Study at Changdang Lake National Wetland, Changzhou, China. Pol. J. Environ. Stud. 2022, 31, 5269–5284. [Google Scholar] [CrossRef]
  45. Hu, B.B.; Zhou, S.Y.; Luo, P.J.; Chen, H. Assessment of Habitat Services and Gradient Zoning Optimization in Coal Mining Subsidence Areas from a Social-Ecological Coupling Perspective. Sustainability 2025, 17, 17. [Google Scholar] [CrossRef]
  46. Wang, Z.; Zhou, R.; Yu, Y. The impact of urban morphology on land surface temperature under seasonal and diurnal variations: Marginal and interaction effects. Build. Environ. 2025, 272, 112673. [Google Scholar] [CrossRef]
  47. Li, L.; Sun, S.J.; Zhong, L.Y.; Han, J.; Qian, X.P. Novel spatiotemporal nonlinear regression approach for unveiling the impact of urban spatial morphology on carbon emissions. Sustain. Cities Soc. 2025, 125, 106381. [Google Scholar] [CrossRef]
  48. Zou, J.; Ma, J.H.; Lin, T.; Dong, J.; Lin, M.X.; Lou, J.C. Quantitative valuation of green roofs’ cooling effects under different urban spatial forms in high-density urban areas. Build. Environ. 2022, 222, 109367. [Google Scholar] [CrossRef]
  49. Vanderhaegen, S.; Canters, F. Mapping urban form and function at city block level using spatial metrics. Landsc. Urban Plan. 2017, 167, 399–409. [Google Scholar] [CrossRef]
  50. Wentz, E.A.; York, A.M.; Alberti, M.; Conrow, L.; Fischer, H.; Inostroza, L.; Jantz, C.; Pickett, S.T.A.; Seto, K.C.; Taubenböck, H. Six fundamental aspects for conceptualizing multidimensional urban form: A spatial mapping perspective. Landsc. Urban Plan. 2018, 179, 55–62. [Google Scholar] [CrossRef]
  51. Wang, Z.; Zhou, R.; Rui, J.; Yu, Y. Revealing the impact of urban spatial morphology on land surface temperature in plain and plateau cities using explainable machine learning. Sustain. Cities Soc. 2025, 118, 106045. [Google Scholar] [CrossRef]
  52. Bansal, P.; Quan, S.J. Examining temporally varying nonlinear effects of urban form on urban heat island using explainable machine learning: A case of Seoul. Build. Environ. 2024, 247, 110957. [Google Scholar] [CrossRef]
  53. Li, S.Q.; Yang, H.L. ‘Open’, ‘connected’, ‘distinctive’, ‘pioneering’, and ‘committed’: Semioscaping Shanghai as a global city. Int. J. Multiling. 2021, 20, 250–269. [Google Scholar] [CrossRef]
  54. Shi, Y.S.; Liu, D.X. Excessive Urbanization and Rejuvenation in the Metropolitan City Center in Shanghai, China. J. Urban Plan. Dev. 2018, 144, 05018020. [Google Scholar] [CrossRef]
  55. Cao, X.Y.; Shi, Y.S.; Zhou, L.L. Research on Urban Carrying Capacity Based on Multisource Data Fusion—A Case Study of Shanghai. Remote Sens. 2021, 13, 2695. [Google Scholar] [CrossRef]
  56. Shen, G.R.; Abdoul, N.I.; Zhu, Y.; Wang, Z.J.; Gong, J.H. Remote sensing of urban growth and landscape pattern changes in response to the expansion of Chongming Island in Shanghai, China. Geocarto Int. 2017, 32, 488–502. [Google Scholar] [CrossRef]
  57. Xiao, R.; Lin, M.; Fei, X.F.; Li, Y.S.; Zhang, Z.H.; Meng, Q.X. Exploring the interactive coercing relationship between urbanization and ecosystem service value in the Shanghai-Hangzhou Bay Metropolitan Region. J. Clean. Prod. 2020, 253, 119803. [Google Scholar] [CrossRef]
  58. Nematollahi, S.; Fakheran, S.; Kienast, F.; Jafari, A. Application of InVEST habitat quality module in spatially vulnerability assessment of natural habitats (case study: Chaharmahal and Bakhtiari province, Iran). Environ. Monit. Assess. 2020, 192, 487. [Google Scholar] [CrossRef]
  59. Mengist, W.; Soromessa, T.; Feyisa, G.L. Landscape change effects on habitat quality in a forest biosphere reserve: Implications for the conservation of native habitats. J. Clean. Prod. 2021, 329, 129778. [Google Scholar] [CrossRef]
  60. Wang, B.X.; Cheng, W.M. Effects of Land Use/Cover on Regional Habitat Quality under Different Geomorphic Types Based on InVEST Model. Remote Sens. 2022, 14, 1279. [Google Scholar] [CrossRef]
  61. Aneseyee, A.B.; Noszczyk, T.; Soromessa, T.; Elias, E. The InVEST Habitat Quality Model Associated with Land Use/Cover Changes: A Qualitative Case Study of the Winike Watershed in the Omo-Gibe Basin, Southwest Ethiopia. Remote Sens. 2020, 12, 1103. [Google Scholar] [CrossRef]
  62. Li, M.M.; Stein, A. Mapping Land Use from High Resolution Satellite Images by Exploiting the Spatial Arrangement of Land Cover Objects. Remote Sens. 2020, 12, 4158. [Google Scholar] [CrossRef]
  63. Pal, S.; Talukdar, S.; Ghosh, R. Damming effect on habitat quality of riparian corridor. Ecol. Indic. 2020, 114, 106300. [Google Scholar] [CrossRef]
  64. Du, P.Y.; Huai, H.J.; Wu, X.Y.; Wang, H.J.; Liu, W.; Tang, X.M. Using XGBoost-SHAP for understanding the ecosystem services trade-off effects and driving mechanisms in ecologically fragile areas. Front. Plant Sci. 2023, 16, 1552818. [Google Scholar] [CrossRef] [PubMed]
  65. Jia, Y.F.; Chen, Z.F.; Lu, X.H.; Sheng, S.; Huang, J.D.; Wang, Y.C. The degradation and marginal effects of green space under the stress of urban sprawl in the metropolitan area. Urban For. Urban Green. 2024, 95, 128318. [Google Scholar] [CrossRef]
  66. Wu, Y.T.; Luo, M.Y.; Ding, S.G.; Han, Q.Y. Using a Light Gradient-Boosting Machine-Shapley Additive Explanations Model to Evaluate the Correlation Between Urban Blue-Green Space Landscape Spatial Patterns and Carbon Sequestration. Land 2024, 13, 1965. [Google Scholar] [CrossRef]
  67. Zhou, X.C.; Zou, X.F.; Xiong, W.Z.X. Optimization of urban green space in Wuhan based on machine learning algorithm from the perspective of healthy city. Front. Public Health 2025, 13, 1490857. [Google Scholar] [CrossRef]
  68. Kim, Y.; Kim, Y.C. Explainable heat-related mortality with random forest and SHapley Additive exPlanations (SHAP) models. Sustain. Cities Soc. 2022, 79, 103677. [Google Scholar] [CrossRef]
  69. Liu, S.; Zhang, X.S.; Feng, Y.J.; Xie, H.; Jiang, L.; Lei, Z.K. Spatiotemporal Dynamics of Urban Green Space Influenced by Rapid Urbanization and Land Use Policies in Shanghai. Forests 2021, 12, 476. [Google Scholar] [CrossRef]
  70. Li, Z.H.; He, W.; Cheng, M.F.; Hu, J.X.; Yang, G.G.; Zhang, H.Y. SinoLC-1: The first 1 m resolution national-scale land-cover map of China created with a deep learning framework and open-access data. Earth Syst. Sci. Data 2023, 15, 4749–4780. [Google Scholar] [CrossRef]
  71. Zhang, Y.C.; Zhao, H.M.; Long, Y. CMAB: A Multi-Attribute Building Dataset of China. Sci. Data 2025, 12, 430. [Google Scholar] [CrossRef]
  72. Uhe, P.; Lucas, C.; Hawker, L.; Brine, M.; Wilkinson, H.; Cooper, A.; Saoulis, A.A.; Savage, J.; Sampson, C. FathomDEM: An improved global terrain map using a hybrid vision transformer model. Environ. Res. Lett. 2025, 20, 034002. [Google Scholar] [CrossRef]
  73. Gao, Z.X.; Shi, Y.L.; Zhang, H.W.; Chen, X.H.; Zhang, W.G.; Shen, W.M.; Xiao, T.; Zhang, Y.H. China Regional 250m Normalized Difference Vegetation Index Data Set (2000–2023); National Tibetan Plateau/Third Pole Environment Data Center: Beijing, China, 2023; Available online: https://cstr.cn/18406.11.Terre.tpdc.300328 (accessed on 1 July 2025).
  74. Wu, B.; Huang, H.L.; Wang, Y. Quantifying spatial patterns of urban building morphology in the China’s Guangdong-Hong Kong-Marco greater bay area. Int. J. Digit. Earth 2024, 17, 2392832. [Google Scholar] [CrossRef]
  75. Cao, Q.; Luan, Q.Z.; Liu, Y.P.; Wang, R.Q. The effects of 2D and 3D building morphology on urban environments: A multi-scale analysis in the Beijing metropolitan region. Build. Environ. 2021, 192, 107635. [Google Scholar] [CrossRef]
  76. Yang, D.; Zhang, P.; Jiang, L.; Zhang, Y.; Liu, Z.; Rong, T. Spatial change and scale dependence of built-up land expansion and landscape pattern evolution-Case study of affected area of the lower Yellow River. Ecol. Indic. 2022, 141, 109123. [Google Scholar] [CrossRef]
  77. Cai, X.J.; Wu, Z.F.; Cheng, J. Using kernel density estimation to assess the spatial pattern of road density and its impact on landscape fragmentation. Int. J. Geogr. Inf. Sci. 2013, 27, 222–230. [Google Scholar] [CrossRef]
  78. Wu, T.; Zha, P.P.; Yu, M.J.; Jiang, G.J.; Zhang, J.Z.; You, Q.L.; Xie, X.F. Landscape Pattern Evolution and Its Response to Human Disturbance in a Newly Metropolitan Area: A Case Study in Jin-Yi Metropolitan Area. Land 2021, 10, 767. [Google Scholar] [CrossRef]
  79. Chen, Y.Q.; Shan, B.Y.; Yu, X.W.; Zhang, Q.; Ren, Q.X. Comprehensive effect of the three-dimensional spatial distribution pattern of buildings on the urban thermal environment. Urban Clim. 2022, 46, 101324. [Google Scholar] [CrossRef]
  80. Liu, R.X.; Yan, X.Y.Y.; Lin, X.L.; Sun, Y.C.; Zhang, T.; Xiao, J. Urban spontaneous plant richness in response to the 2D/3D building and green space patterns in a highly urbanized area. Ecol. Indic. 2023, 154, 110852. [Google Scholar] [CrossRef]
  81. Zhang, Z.; Tang, W.W. Mixed landform with high-rise buildings: A spatial analysis integrating horizon-vertical dimension in natural-human urban systems. Land Use Policy 2023, 132, 106806. [Google Scholar] [CrossRef]
  82. Zhou, R.; Xu, H.C.; Zhang, H.; Zhang, J.; Liu, M.; He, T.X.; Gao, J.; Li, C.L. Quantifying the Relationship between 2D/3D Building Patterns and Land Surface Temperature: Study on the Metropolitan Shanghai. Remote Sens. 2022, 14, 4098. [Google Scholar] [CrossRef]
  83. Wu, W.B.; Guo, F.X.; Elze, S.; Knopp, J.; Banzhaf, E. Deciphering the effects of 2D/3D urban morphology on diurnal cooling efficiency of urban green space. Build. Environ. 2024, 266, 112047. [Google Scholar] [CrossRef]
  84. Zhao, M.Q.; Tian, Y.; Dong, N.L.; Hu, Y.G.; Tian, G.H.; Lei, Y.K. Spatial and temporal dynamics of habitat quality in response to socioeconomic and landscape patterns in the context of urbanization: A case in Zhengzhou City, China. Nat. Conserv.-Bulg. 2022, 48, 185–212. [Google Scholar] [CrossRef]
  85. Gao, H.; Song, W. Assessing the Landscape Ecological Risks of Land-Use Change. Int. J. Environ. Res. Public Health 2022, 19, 13945. [Google Scholar] [CrossRef]
  86. Hu, C.Y.; Wu, W.; Zhou, X.X.; Wang, Z.J. Spatiotemporal changes in landscape patterns in karst mountainous regions based on the optimal landscape scale: A case study of Guiyang City in Guizhou Province, China. Ecol. Indic. 2023, 150, 110211. [Google Scholar] [CrossRef]
  87. Zhang, L.; Hou, G.L.; Li, F.P. Dynamics of landscape pattern and connectivity of wetlands in western Jilin Province, China. Environ. Dev. Sustain. 2020, 22, 2517–2528. [Google Scholar] [CrossRef]
  88. Hesselbarth, M.H.K.; Sciaini, M.; With, K.A.; Wiegand, K.; Nowosad, J. Landscapemetrics: An open-source R tool to calculate landscape metrics. Ecography 2019, 42, 1648–1657. [Google Scholar] [CrossRef]
  89. Gong, J.; Xie, Y.C.; Cao, E.J.; Huang, Q.Y.; Li, H.Y. Integration of InVEST-habitat quality model with landscape pattern indexes to assess mountain plant biodiversity change: A case study of Bailongjiang watershed in Gansu Province. J. Geogr. Sci. 2019, 29, 1193–1210. [Google Scholar] [CrossRef]
  90. Zheng, G.Q.; Li, C.X.; Li, R.J.; Luo, J.; Fan, C.X.; Zhu, H.L. Spatio-temporal evolution analysis of landscape pattern and habitat quality in the Qinghai Province section of the Yellow River Basin from 2000 to 2022 based on InVEST model. J. Arid Land 2024, 16, 1183–1196. [Google Scholar] [CrossRef]
  91. Li, S.N.; He, Y.Y.; Xu, H.L.; Zhu, C.M.; Dong, B.Y.; Lin, Y.; Si, B.; Deng, J.S.; Wang, K. Impacts of Urban Expansion Forms on Ecosystem Services in Urban Agglomerations: A Case Study of Shanghai-Hangzhou Bay Urban Agglomeration. Remote Sens. 2021, 13, 1908. [Google Scholar] [CrossRef]
  92. Zhu, X.Y.; Wang, Z.J.; Gu, T.C.; Zhang, Y.J. Multi-Scenario Prediction of Land Cover Changes and Habitat Quality Based on the FLUS-InVEST Model in Beijing. Land 2024, 13, 1163. [Google Scholar] [CrossRef]
  93. Wu, L.L.; Sun, C.G.; Fan, F.L. Estimating the Characteristic Spatiotemporal Variation in Habitat Quality Using the InVEST Model—A Case Study from Guangdong-Hong Kong-Macao Greater Bay Area. Remote Sens. 2021, 13, 1008. [Google Scholar] [CrossRef]
  94. Liu, T.W.; Yu, G.T.; Yan, S.J.; Xu, J.D.; Xue, L.M.; Song, G.H.; Wang, Q. Unraveling the impact of urban landscape pattern changes on habitat quality: A case study of Jinan City in the lower Yellow River Basin, China. Ecol. Indic. 2025, 177, 113735. [Google Scholar] [CrossRef]
  95. Hu, J.Y.; Zhang, J.X.; Li, Y.Q. Exploring the spatial and temporal driving mechanisms of landscape patterns on habitat quality in a city undergoing rapid urbanization based on GTWR and MGWR: The case of Nanjing, China. Ecol. Indic. 2022, 143, 109333. [Google Scholar] [CrossRef]
  96. Chen, S.L.; Liu, X.T. Spatio-temporal variations of habitat quality and its driving factors in the Yangtze River Delta region of China. Glob. Ecol. Conserv. 2024, 52, e02978. [Google Scholar] [CrossRef]
  97. Zhu, C.M.; Zhang, X.L.; Zhou, M.M.; He, S.; Gan, M.Y.; Yang, L.X.; Wang, K. Impacts of urbanization and landscape pattern on habitat quality using OLS and GWR models in Hangzhou, China. Ecol. Indic. 2020, 117, 106654. [Google Scholar] [CrossRef]
  98. Liu, Q.Q.; Hang, T.; Wu, Y.F. Unveiling differential impacts of multidimensional urban morphology on heat island effect across local climate zones: Interpretable CatBoost-SHAP machine learning model. Build. Environ. 2025, 270, 112574. [Google Scholar] [CrossRef]
  99. Cheng, G.Q.; Pan, C.T.; Zhou, Y. Urban-rural disparities in the ecological impact of built-up land expansion: A comprehensive assessment from China. Appl. Geogr. 2025, 179, 103618. [Google Scholar] [CrossRef]
  100. Li, G.X.; Wang, W.; Li, J.W.; An, R.D.; Bian, H.F.; Wang, Y. Enhancing urban ecological resilience through small wetlands: A nature-based solutions in Changchun City, China. J. Clean. Prod. 2025, 518, 145881. [Google Scholar] [CrossRef]
  101. Luan, Y.F.; Huang, G.H.; Zheng, G.H.; Wang, Y.E. Correlation between Spatio-Temporal Evolution of Habitat Quality and Human Activity Intensity in Typical Mountain Cities: A Case Study of Guiyang City, China. Int. J. Environ. Res. Public Health 2022, 19, 14294. [Google Scholar] [CrossRef]
  102. Hu, Y.G.; Xu, E.K.; Dong, N.L.; Tian, G.H.; Kim, G.W.; Song, P.H.; Ge, S.D.; Liu, S.D. Driving Mechanism of Habitat Quality at Different Grid-Scales in a Metropolitan City. Forests 2022, 13, 248. [Google Scholar] [CrossRef]
  103. Aznarez, C.; Svenning, J.C.; Taveira, G.; Baró, F.; Pascual, U. Wildness and habitat quality drive spatial patterns of urban biodiversity. Landsc. Urban Plan. 2022, 228, 104570. [Google Scholar] [CrossRef]
  104. Jasper, V.V. Direct and indirect loss of natural area from urban expansion. Nat. Sustain. 2019, 2, 755–763. [Google Scholar] [CrossRef]
  105. Xie, Z.X.; Zhang, B.; Shi, Y.T.; Zhang, X.Y.; Sun, Z.X. Changes and protections of urban habitat quality in Shanghai of China. Sci. Rep. 2023, 13, 10976. [Google Scholar] [CrossRef]
  106. Deng, G.Y.; Jiang, H.B.; Ma, S.; He, C.G.; Sheng, L.X.; Wen, Y. Revealing the impacts of different urban development on habitat quality: A case study of the Changchun-Jilin region of China. J. Clean. Prod. 2025, 511, 145661. [Google Scholar] [CrossRef]
  107. Robert, I.M.; Peter, K.; Richard, T.T.F. The implications of current and future urbanization for global protected areas and biodiversity conservation. Biol. Conserv. 2008, 141, 695–1703. [Google Scholar] [CrossRef]
  108. Kaushik, M.; Tiwari, S.; Manisha, K. Habitat patch size and tree species richness shape the bird community in urban green spaces of rapidly urbanizing Himalayan foothill region of India. Urban Ecosyst. 2021, 25, 423–436. [Google Scholar] [CrossRef]
  109. Biswas, G.; Sengupta, A.; Alfaisal, F.M.; Alam, S.; Alharbi, R.S.; Jeon, B.H. Evaluating the effects of landscape fragmentation on ecosystem services: A three-decade perspective. Ecol. Inform. 2023, 77, 102283. [Google Scholar] [CrossRef]
  110. De Lima, J.A.; Vieira, R.J.A.G.; de Souza, C.A.M.; Ferreira, F.F.; de Oliveira, V.M. Effects of habitat fragmentation on biodiversity patterns of ecosystems with resource competition. Phys. A Stat. Mech. Its Appl. 2020, 564, 125497. [Google Scholar] [CrossRef]
  111. Deng, G.Y.; Jiang, H.B.; Zhu, S.Y.; Wen, Y.; He, C.G.; Wang, X.; Sheng, L.X.; Guo, Y.; Cao, Y.Y. Projecting the response of ecological risk to land use/land cover change in ecologically fragile regions. Sci. Total Environ. 2024, 914, 169908. [Google Scholar] [CrossRef] [PubMed]
  112. Yang, L.Y.; Xu, H.; Pan, S.P.; Chen, W.X.; Zeng, J. Identifying the impact of global human activities expansion on natural habitats. J. Clean. Prod. 2023, 434, 140247. [Google Scholar] [CrossRef]
  113. Haaland, C.; van den Bosch, C.K. Challenges and strategies for urban green-space planning in cities undergoing densification: A review. Urban For. Urban Green. 2015, 14, 760–771. [Google Scholar] [CrossRef]
  114. Gupta, A.; De, B. Blue space resilient urban planning to enhance severely distressed thermal environment. Phys. Chem. Earth 2024, 137, 103804. [Google Scholar] [CrossRef]
  115. Zhang, H.; Zhang, C.; Hu, T.; Zhang, M.; Ren, X.W.; Hou, L. Exploration of roadway factors and habitat quality using InVEST. Transp. Res. Part D Transp. Environ. 2020, 87, 102551. [Google Scholar] [CrossRef]
  116. Surya, B.; Salim, A.; Hernita, H.; Suriani, S.; Menne, F.; Rasyidi, E.S. Land Use Change, Urban Agglomeration, and Urban Sprawl: A Sustainable Development Perspective of Makassar City, Indonesia. Land 2021, 10, 556. [Google Scholar] [CrossRef]
  117. Li, X.H.; Ai, Z.M.; Yang, Z.; Yao, Y.Y.; Ren, Z.Y.; Hou, M.J.; Li, J.Y.; Cao, X.S.; Li, P.; Zhang, D.H.; et al. Ecological risk assessment and restoration area identification of Pengyang County on the basis of the landscape pattern and function. Environ. Monit. Assess. 2023, 195, 998. [Google Scholar] [CrossRef]
  118. Yohannes, H.; Soromessa, T.; Argaw, M.; Dewan, A. Spatio-temporal changes in habitat quality and linkage with landscape characteristics in the Beressa watershed, Blue Nile basin of Ethiopian highlands. J. Clean. Prod. 2021, 281, 111885. [Google Scholar] [CrossRef]
  119. Bourgeois, M.; Boutreux, T.; Vuidel, G.; Savary, P.; Piot, P.; Bellec, A.; Kaufmann, B. Assessing the strategic role of urban green spaces for habitat connectivity in multi-family residential plots. Urban For. Urban Green. 2024, 99, 128471. [Google Scholar] [CrossRef]
  120. Varshney, K.; Zari, M.P.; Bakshi, N. Carbon Sequestration and Habitat Provisioning through Building-Integrated Vegetation: A Global Survey of Experts. Buildings 2022, 12, 1458. [Google Scholar] [CrossRef]
  121. Mi, Y.; Li, S.; Wang, Z.Y. Spatial distribution and topographic gradient effects of habitat quality in the Chang-Zhu-Tan Urban Agglomeration, China. Sci. Rep. 2024, 14, 22563. [Google Scholar] [CrossRef] [PubMed]
  122. Yang, J.Y.; Xing, Z.; Cheng, C.H. How Urban Fringe Expansion Affects Green Habitat Diversity? Analysis from Urban and Local Scale in Hilly City. J. Environ. Public Health 2022, 2022, 8566686. [Google Scholar] [CrossRef] [PubMed]
  123. Liu, G.; Li, X.H.; Tan, Y.T.; Zhang, G.M. Building green retrofit in China: Policies, barriers and recommendations. Energy Policy 2020, 139, 111356. [Google Scholar] [CrossRef]
Figure 1. Map of Shanghai’s location. The map depicts the geographical location of Shanghai at the mouth of the Yangtze River. It also shows Shanghai’s altitude and land use.
Figure 1. Map of Shanghai’s location. The map depicts the geographical location of Shanghai at the mouth of the Yangtze River. It also shows Shanghai’s altitude and land use.
Forests 16 01323 g001
Figure 2. Visualisation of all independent variables.
Figure 2. Visualisation of all independent variables.
Forests 16 01323 g002
Figure 3. Research framework diagram.
Figure 3. Research framework diagram.
Forests 16 01323 g003
Figure 4. Distribution of NA values region. The figure shows a 1 m urban land use map created by Li et al. [70] There are eight types of land use in Shanghai, and the red boxes indicate the spatial distribution of missing NA values.
Figure 4. Distribution of NA values region. The figure shows a 1 m urban land use map created by Li et al. [70] There are eight types of land use in Shanghai, and the red boxes indicate the spatial distribution of missing NA values.
Forests 16 01323 g004
Figure 5. Pearson analysis chart of variables.
Figure 5. Pearson analysis chart of variables.
Forests 16 01323 g005
Figure 6. Spatial distribution map of habitat quality in Shanghai. (a) Describes the spatial visualisation of habitat quality grid data output by InVEST; (b) Describes the use of ‘Zone Statistics as Table’ in ArcGIS 10.8.1 to calculate the average habitat quality value for each 300 m × 300 m cell.
Figure 6. Spatial distribution map of habitat quality in Shanghai. (a) Describes the spatial visualisation of habitat quality grid data output by InVEST; (b) Describes the use of ‘Zone Statistics as Table’ in ArcGIS 10.8.1 to calculate the average habitat quality value for each 300 m × 300 m cell.
Forests 16 01323 g006
Figure 7. Spatial difference distribution characteristics of habitat quality.
Figure 7. Spatial difference distribution characteristics of habitat quality.
Forests 16 01323 g007
Figure 8. Relative importance of urban spatial form variables for habitat quality spatial difference values.
Figure 8. Relative importance of urban spatial form variables for habitat quality spatial difference values.
Forests 16 01323 g008
Figure 9. SHAP dependence map of urban spatial form variables on habitat quality spatial difference values.
Figure 9. SHAP dependence map of urban spatial form variables on habitat quality spatial difference values.
Forests 16 01323 g009
Figure 10. Interaction scatter plot of urban spatial form variables and spatial differences in habitat quality.
Figure 10. Interaction scatter plot of urban spatial form variables and spatial differences in habitat quality.
Forests 16 01323 g010
Table 1. Description of urban spatial form indicators and spatial difference values of habitat quality. All data are rounded to four decimal places for readability, but calculations are still based on the original precision of the data.
Table 1. Description of urban spatial form indicators and spatial difference values of habitat quality. All data are rounded to four decimal places for readability, but calculations are still based on the original precision of the data.
VariableIndicator DimensionIndicator NameAbbreviationMaximum ValueMinimum ValueAverage Value
Urban spatial form indicators
(Independent variable)
Density typeBuilding DensityBD0.913000.054
Population DensityPD4619.520225.958
Road DensityRD0.329300.006
Shape typeBuilding Boundary Complexity IndexCI27.843400.674
Average Building HeightABH21.020300.058
Number of Building PatchesNBP17408.804
Configuration typeLand Use MixLUM815.627
Normalised Difference Vegetation IndexNDVI1.3666−0.43200.8247
Water RatioWR1.162700.0737
Landscape
type
Largest Patch IndexLPI10015.312473.5508
Shape IndexSI2.978311.2870
Shannon’s Evenness IndexSHEI100.6303
Number of PatchesNP14131142.1519
Aggregation IndexAI100097.4265
Terrain typeMean ElevationME4812.28−150215.4911
Mean SlopeMS87.8544020.5888
Spatial differences in habitat quality (Dependent variable)//HQ-SD0.2446−0.27600.0001
Table 2. Definition and description of landscape indicators.
Table 2. Definition and description of landscape indicators.
IndicatorDefinition
LPIRefers to the proportion of the largest single patch in the landscape.
SIAn index measuring the complexity of plaque shape, indicating the degree of deviation between a plaque and its minimum perimeter shape (usually circular or square).
SHEIUsed to measure the degree of balance in the spatial distribution of different landscape types.
NPRefers to the number of patches of a specific landscape type occurring within the study area.
AIAn indicator of the degree of aggregation among similar patches, reflecting whether a certain type of patch is concentrated or scattered in the landscape.
Table 3. Sensitivity test table.
Table 3. Sensitivity test table.
GroupMEANVarianceParameter Settings (Threat, Max-Dist, Weight)
10.2250166720.021078767Road, 1000, 0.6; Urban, 3000, 0.8; Farmland, 2000, 0.4
20.2095229280.015053269Road, 8000, 0.8; Urban, 10000, 1; Farmland, 4000, 0.5
Table 4. Threat source parameter settings.
Table 4. Threat source parameter settings.
ThreatMax-DistWeightDecay
Road80000.8Linear
Urban10,0000.1Exponential
Farmland40000.5Exponential
Table 5. Table of sensitivity data for each LULC to threat sources.
Table 5. Table of sensitivity data for each LULC to threat sources.
LULCUrbanRoadFarmlandLucodeHabitat Suitability
Road00010
Forest0.70.50.521
Grassland0.70.80.440.7
Farmland0.50.4050.5
Construction land00060
Sparse vegetation0.90.40.470.9
Water body0.80.50.590.9
Wetland0.90.90.7100.95
Table 6. Model comparison data table.
Table 6. Model comparison data table.
ModelR2RMSEMAECV-R2 (5-Fold)
Categorical Boosting (CatBoost)0.46150.03760.02690.4455
eXtreme Gradient Boosting (XGBoost)0.44500.03820.02750.4198
Random Forest(RF)0.44480.03820.02720.4301
Light Gradient Boosting Machine (LightGBM)0.43960.03840.02760.4257
Support Vector Regressor(SVR)0.22260.04520.03540.2007
Multiple Linear Regression(MLR)0.13740.04760.03570.1303
Decision Tree Regressor(DTR)−0.14910.05490.0390−0.1711
Table 7. Variance inflation factor detection table.
Table 7. Variance inflation factor detection table.
VariableVIF
BD3.391429834
PD1.801751939
RD1.257903238
CI1.294755144
ABH1.623958565
NBP2.659406701
WR1.786228027
LUM1.690283673
NDVI1.458976383
LPI4.882892746
SI1.333606803
SHEI5.985479542
NP4.57149095
AI5.867533959
ME1.41588827
MS1.269321021
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Chen, R.; Chen, Z.; Xie, M.; Shi, R.; Lin, X.; Chen, K.; Chen, S. Exploring Spatial Differences in Habitat Quality and Their Response to Urban Spatial Form, Using Shanghai as an Example. Forests 2025, 16, 1323. https://doi.org/10.3390/f16081323

AMA Style

Chen R, Chen Z, Xie M, Shi R, Lin X, Chen K, Chen S. Exploring Spatial Differences in Habitat Quality and Their Response to Urban Spatial Form, Using Shanghai as an Example. Forests. 2025; 16(8):1323. https://doi.org/10.3390/f16081323

Chicago/Turabian Style

Chen, Rongxiang, Zhiyuan Chen, Mingjing Xie, Rongrong Shi, Xin Lin, Kaida Chen, and Shunhe Chen. 2025. "Exploring Spatial Differences in Habitat Quality and Their Response to Urban Spatial Form, Using Shanghai as an Example" Forests 16, no. 8: 1323. https://doi.org/10.3390/f16081323

APA Style

Chen, R., Chen, Z., Xie, M., Shi, R., Lin, X., Chen, K., & Chen, S. (2025). Exploring Spatial Differences in Habitat Quality and Their Response to Urban Spatial Form, Using Shanghai as an Example. Forests, 16(8), 1323. https://doi.org/10.3390/f16081323

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop