Route selection strategy and comparative research of the Shu Road line
Jinniu Road and Baoxie Road are the core components of the ancient Shu Road transportation system, and are typical examples of studying the comprehensive dynamic adaptation of ancient transportation to physical geography, social economy, and military politics. In terms of physical geography, Jinniu Road, as the main line of the southern section of Shu Road, connects Hanzhong and Sichuan Basin, and becomes the main axis of the Sichuan-Shaanxi official road, reflecting the wisdom of using the river valley corridor to overcome the terrain on the edge of the basin. Relying on the Baoxie Twin River Valley to form a low mountain pass, the Baoxie Road has long assumed important transportation and military functions as an official post road. In terms of military and political dimensions, Jinniu Road was the strategic lifeblood of the central power to manage the southwest and control Bashu; The Baoxie Road connects the political core Guanzhong with the strategic Hanzhong, and has become a key military corridor for transmitting government orders and dispatching troops. In the socio-economic dimension, the two roads, as the main roads between Sichuan and Shaanxi with an earlier opening time and relatively short mileage, are the core economic arteries that maintain the circulation of materials between Guanzhong and Chengdu and promote the prosperity of commerce and trade33. It is the superposition of this multidimensional core function that has made the routes of Jinniu Road and Baoxie Road undergo frequent adjustments and expansions over thousands of years, and its change trajectory profoundly reflects how ancient road construction dynamically responds to strategic needs and changes in economic dynamics under complex geographical constraints. Therefore, these two roads are selected not only because of their long history and significant changes in routes, but also because their route selection and diversion process fully reflect the dynamic adaptation relationship between natural geographical conditions and the social needs of ancient road construction.
The drawing of the schematic diagram of the two routes of Shu Road (Fig. 3) comprehensively refers to historical documents, archeological discoveries, modern technical analysis, and other materials. By systematically combing through documents such as the “Yuanhe County Map” and “Reading History Fangyu Minutes”, combined with the site data of archeological excavations, the routes and points of the Shu Road are verified. According to different historical periods, the Baoxie Road can be divided into the Qin and Han Baoxie Roads (Han and Wei Baoxie Roads) and the Tang and Song Baoxie Roads. The Lianyun Plank Road, which was expanded during the Yuan, Ming and Qing dynasties, was developed on the basis of the Baoxike Road of the Tang and Song Dynasties, and in the hundreds of years from the Yuan Dynasty to the Republic of China, the traffic between Sichuan and Shaanxi almost completely relied on the Lianyun Plank Road and the Jinniu Road (as shown in the picture). The northern section of Jinniu Road has undergone three important realignments, which occurred in the Qin and Han dynasties, the Tang and Song dynasties, and the Ming and Qing dynasties. In the Ming Dynasty, the route of the southern section of Jinniu Road was adjusted from Guangyuan-Deyang-Chengdu to Guangyuan-Langzhong-Chengdu39.
a Qin and dynasties. b Tang and Song Dynasties. c Yuan, Ming, and Qing dynasties. d Ming and Qing dynasties.
Line selection and comparison of the northern section of Jinniu Road
In the study of the route selection strategy of the northern section of Jinniu Road, the line selection strategy adopted in the northern section of Jinniu Road in the Qin and Han dynasties, Tang and Song dynasties, as well as in the Ming and Qing dynasties, is summarized, as shown in Table 340. In subsequent model analysis, we will employ the Random Forest algorithm to compare the importance of key factors such as topography, water systems, and administrative nodes. Furthermore, we will utilize SHAP dependency plots to interpret threshold effects of factors like river area and elevation.
An in-depth analysis of the route selection strategies of the northern section of Jinniu Road in the Qin, Han, Tang, Song, Ming, and Qing dynasties can identify its commonalities and differences in natural terrain dependence and transportation (Table 4). These factors not only reflect the evolution of technological development in historical periods but also reveal the dynamic relationship between the geographical environment and human activities.
Selection and comparison of the southern section of Jinniu Road
The route of the southern section of Jinniu Road was significantly adjusted in the Ming Dynasty. The southern section of Jinniu Road during the Ming Dynasty was rerouted through Langzhong, which was not only the result of avoiding the terrain but also closely related to the administrative adjustments in northern Sichuan during the Ming period. The establishment of the Shouxun Dao (patrolling circuits) since the Ming Dynasty elevated the status of Langzhong, with the Northern Sichuan Circuit’s administration based in Baoning Prefecture. The Sichuan Gazetteer of the Zhengde period, Volume 3, Provincial Administration – Chronological Table of Successive Dynasties Part 2, states: Dividing Sichuan into East, West, South, and North circuits, with one rotation each year… and assigning governance to East, West, South, and North circuits each year, each circuit having left and right political advisors to assist. This elevation in administrative hierarchy directly resulted in adjustments to the official post roads to strengthen control and connectivity with Langzhong42. In order to strengthen the control and connection of this key node in Langzhong, the core route of the southern section of Jinniu Road was changed from the Yuan Dynasty and the former Guangyuan-Zitong-Chengdu line to the Guangyuan-Langzhong-Yanting-Santai-Chengdu line through Langzhong. Compared with the old road passing through Jianmen Pass, the overall traffic node from Guangyuan to Langzhong in the Ming Dynasty was smoother and more convenient than the route from Guangyuan to Liugou Town in the Qing Dynasty (as shown in Figs. 4 and 5). Although the detour to Langzhong and Yanting increased the total mileage by more than 300 miles, avoiding the extremely rugged terrain of Jianmen’s natural dangers greatly improved the safety and convenience of the road, which became an important technical optimization when implementing the political line. At the same time, the old road that originally passed through Jianmen remains, providing two optional routes for pedestrians. The route selection strategy for the southern section of the Golden Ox Road during the Qing Dynasty leveraged natural topographical advantages while integrating military defense requirements. The Jianmen County Continuation Annals records, in the fourth month of the twenty-ninth year of the Kangxi reign, Gar Tu, the Governor of Sichuan, repaired the ancient Jianmen Pass road spanning six hundred and twenty li. Taking advantage of the farming off-season, he cut timber, quarried stone, built bridges, and constructed boats to facilitate travel, thus transforming it into a smooth and level road. In areas with steep cliffs, such as the Jiange region, the construction of cliffside plank roads reduced the difficulty of traversing dangerous mountains, ensuring the safe passage of vehicles and horses. Furthermore, the establishment of passes like the Damushu Station not only guaranteed the safety and smooth flow of traffic but also enhanced military defense capabilities33.

Elevation map of Mingguangyuan Langzhong Transportation Node.

Elevation map of transportation nodes in Qingguangyuan Liugou Town.
In the line selection strategies of the Ming and Qing Dynasties along the Golden Ox Path, there are both commonalities and significant differences between the two (Table 5). The Ming Dynasty emphasized safety and smoothness in route selection, avoiding the steepness of Jianmen and opting for gentler routes. In contrast, the Qing Dynasty relied more on natural topography while also considering military defense.
Baoxie Road route selection and comparison
The Records of the Grand Historian: Treatise on Rivers and Canals states, now, by excavating the Baoxie Pass route, we reduce the steep slopes and shorten the distance to nearly four hundred li. Moreover, the Bao River connects to the Min River, and the Xie River connects to the Wei River, both of which can be navigated by boats for transport. During the Qin and Han dynasties, the Baoxie Road made full use of natural conditions to seek the most favorable road direction in the complex mountainous areas. Like the northern section of Jinniu Road, its main route is also located along rivers and streams, making use of the river and canyon areas for road engineering construction to reduce the workload. At the same time, try to avoid passing through overly steep ridges and dangerous cliff sections, and select relatively flat areas as much as possible for engineering construction to facilitate the construction process. When encountering mountain ranges blocking the way, the Baoxie Road adopts a circuitous approach, such as using low passes like Wuli Po as a watershed. During the construction of the Shimen Tunnel, the terrain was ingeniously utilized, and the tunnel site was placed in a relatively open position, thereby significantly reducing the traffic distance. In addition, for some extremely difficult areas, a wooden plank road structure with chisel stone and wood frames was adopted to ensure the safety and stability of travelers33. The Records of the Grand Historian further highlight the Baoxie Pass’s significance in the Western Han economy. Emperors Xiao and Zhao governed Xianyang, establishing it as the Han capital. Chang’an, with its imperial tombs… to the south lay Ba and Shu. Ba and Shu were also fertile lands, rich in jade, cinnabar, sandalwood, stone, copper, iron, bamboo, and timber….Yet surrounded by four natural barriers, with a thousand-mile-long mountain trail connecting all regions, only the Baoxie Pass serves as the gateway, exchanging abundance for scarcity44.
During the Tang and Song Dynasties, the Biaoxie Road considered terrain, military, and social factors when selecting its route, and new constructions were added to the existing road. The new route generally followed the terrain and made extensive use of old roads, especially focusing on the difficult section from Sanguan to Baocheng. The new route avoided the treacherous sections and complex water environments of the original Biaoxie Road, opting instead for relatively flat, stable, and safer areas to facilitate travel, resulting in a significantly smaller elevation difference between important transportation hubs from Baoji to Fengzhou during the Tang and Song Dynasties compared to the greater elevation difference between the stations from Meixian to Wuguan during the Qin and Han Dynasties (Figs. 6 and 7). Furthermore, by adopting a phased construction method and scheduling the work during military breaks, local production activities and residents’ lives were not disrupted. Additionally, different methods were employed to excavate giant rocks and break cliffs according to the terrain characteristics, ultimately ensuring the safety of the road. Moreover, this new route continued along the path of the Baogu River, significantly reducing the volume of earthwork and preserving its original historical continuity33 (Table 6).

Elevation map of transportation nodes from Baoji to Fengzhou during the Tang and Song dynasties.

Elevation Map of Transportation Nodes from Meixian County to Wuguanyi during the Qin and Han Dynasties.
The selection strategy for the Baoxie Road during the Qin-Han and Tang-Song periods not only made full use of the natural geographical features but also reflected the flexibility demonstrated by ancient people in responding to topographical challenges. The line selection in both periods took into account the need for transportation convenience. However, with the development of history and the evolution of technological levels, the selection strategies for this road have shown significant differences, as illustrated in Table 7, which highlights the changes in the selection strategy for the Baoxie Road during the Qin-Han and Tang-Song periods. It should be noted that since the Ming and Qing Lianyun plank roads were built along the old route of the Tang and Song Baoxie Road, this study divides the Baoxie Road into the Qin-Han and Tang-Song periods, and does not consider the Ming and Qing as a separate phase33.
Through a typical case analysis of the Jinniu Road and Baoxie Road, it is evident that the route selection of the Shu Roads is fundamentally adjusted dynamically around three dimensions: adaptation to natural terrain, military strategic needs, and socio-economic factors. The selection logic of these two routes not only encompasses the experience of adapting to the complex terrain of the Qinling and Daba Mountains but also reflects the collaborative mechanism of political, military, and economic factors, making them representative and typical. Case-based analysis not only provides empirical points for subsequent machine learning analysis of the entire Shu Road network but also clarifies the core hypotheses that need to be specifically tested, namely, whether the three factors—adaptation to natural terrain, military strategic needs, and socio-economic factors—exhibit nonlinear relationships and synergistic effects throughout the Shu Road network. The following will use machine learning models to conduct a quantitative analysis of the entire Shu Road network to further verify and reveal more macro-level driving mechanisms behind route selection.
Model performance comparison
In analyzing the mechanism by which indicators affect Shu Road route selection, we constructed four prediction models to evaluate their performance (Fig. 8). These models include RF, CatBoost, XGBoost, and LightGBM. Use AUC to quantify model performance. In the analysis of the prediction model built for the key impact indicators of the Shu Road route selection, we compare and evaluate the performance of four mainstream ensemble learning algorithms, namely Random Forest, CatBoost, XGBoost, and LightGBM. The comprehensive analysis shows that although CatBoost and XGBoost have slightly higher AUCs on the training set, their generalization ability (AUC) on the test set is slightly inferior to that of the random forest (about 0.0026 and 0.0023 lower, respectively), and the gap between the AUC of the random forest training set and the test set (0.0826) is relatively small, showing better stability and lower risk of overfitting. In particular, it is worth emphasizing that the random forest model has significant advantages in the analysis of indicators involving multiple sources and may contain complex nonlinear relationships and interactions, such as Shu Road route selection, and its inherent random feature subset selection mechanism effectively reduces the correlation between variables and improves the model’s ability to identify key independent influencing factors. At the same time, the tree group structure constructed by it naturally has the ability to capture complex nonlinear patterns and provide intuitive feature importance ranking, which is crucial for understanding how multidimensional factors such as topography, geology, military, politics, and economics affect route selection decisions. Therefore, we finally chose random forest as the model for the analysis of the influence index of the Shu Road route selection.

a AUC of random forests. b CatBoost AUC. c XGBoost AUC. d LightGBM AUC.
The relative importance of the Shu Road route selection variable
In order to analyze the nonlinear characteristics and relative weights of various influencing factors in the decision of Shu Road route selection, the random forest model and the SHAP method were used to evaluate the importance of features. The left figure of Fig. 9 shows the average absolute SHAP value (global importance) calculated based on the samples of all road sections, reflecting the overall influence of each influencing factor (such as topography, river, town, pass, etc.) on the final route selection decision. The figure on the right reveals the individual differences in the importance of each factor and its scope by plotting the distribution of Shapley values (local importance) of each influencing factor on each specific road section. In the figure, the Y axis represents the influencing factor, the X axis is the SHAP value (positive value means that the factor tends to promote the route to choose the path, negative value means tendency to avoid the path), each point corresponds to the SHAP value of a road section sample, and its color represents the original value of the influencing factor on the road section sample (blue is the low value; red is high).

a Mean(|SHAP value|)(average impact on model output magnitude). b SHAP value.
Figure 4 shows the results of the importance analysis of each variable affecting the selection of the Shu Road line. From the perspective of the model, the category of factors that shows the strongest spatial distribution correlation with the historical routes of the Shu Roads is socio-economic factors. Among these, the post-impact index is a key indicator. It is especially worth noting that this strong correlation may reveal a bidirectional feedback and co-evolutionary relationship between the Shu Road routes and the socio-economic activities along them. On one hand, existing settlements and population centers generate transportation demand, attracting road connections; on the other hand, the selection and opening of official roads greatly promote the establishment of post stations along the route, and the long-term stable operation of these post stations, in turn, stimulates new commercial settlements and population clusters. Therefore, the high correlation between socio-economic indicators and these routes captured by the model likely reflects the path-dependent characteristics of the Shu Roads as an official transportation artery during its long-term operation. Once the road system was established, it strongly shaped the human and economic geography along the route. In other words, at a static level, the model results uncover the close symbiotic relationship between the route and socio-economic nodes, and the formation of this relationship likely originates from deeper political-military demands and natural geographic constraints.
Natural environmental factors are the second biggest influencing factor. Among them, elevation is the single most important metric of all variables. High altitude means steep terrain, huge engineering difficulty, and poor traffic conditions, so the route selection tries to avoid the high altitude area, which is strongly negatively correlated. In contrast, the influence of geological structure, topography and rivers on route selection is relatively small, and their impact on route selection is complex, with both favorable and unfavorable sides, which may be because the stable geological structure can provide a solid foundation for road construction and reduce the risk of road collapse, but the complex geological structure will increase the difficulty of construction, which may lead to road instability, landslides and other geological disasters; Rivers can provide passages, and river valleys are often relatively flat, which is convenient for road construction. It may also bring problems such as flooding and sediment accumulation, increasing the difficulty of road construction and maintenance costs. In some cases, rugged terrain such as certain ridgelines can serve as natural watersheds; However, the landform increases the difficulty of construction due to the rugged terrain, which is negatively correlated with the route selection.
The model results reveal the dynamic characteristics of Shu Road formation. Driven by strategic control needs, passes were first established at key topographical points, while official roads were routed to connect or traverse these nodes to fulfill defensive functions. Similarly, the layout of higher-level administrative centers reflected the spatial distribution of state power, with official roads serving to link these centers. Thus, the correlations captured by the model indicate roads’ adaptation to and reinforcement of existing political-military structures. The relatively low correlation strength may stem from these macro-level factors defining the main framework of transportation corridors, thereby constraining micro-level route selection.
The marginal effect of the Shu Road route selection variable
The SHAP model can generate scatter plots, visually show the influence of a single variable on the model’s prediction results, and reveal complex nonlinear relationships and threshold effects. The horizontal axis represents the actual values of the sample data points, while the SHAP values on the vertical axis quantify the contribution of these data points to the model’s output. In order to more clearly reveal the influence of variables on the prediction results of the model, a reference line was drawn with the SHAP value equal to zero. In order to eliminate the influence of dimensions and improve the convergence of the model, this paper standardizes all area features, that is, converts them to dimensionless values by subtracting the mean and dividing by the standard deviation. In a SHAP dependency plot, the abscissa of a feature represents a normalized area value, and the larger the value, the larger the area of the type of terrain in the mesh, and vice versa.
Figure 10 reveals the influence mechanism of various geographical, military-political, and socio-economic factors in the decision-making of the Shu Road route selection. On the whole, except for topography, the influence of other factors shows a nonlinear trend. Among the natural environmental factors, the elevation between 500 and 1200 meters has a positive impact on the route selection policy, indicating that the geographical conditions within this elevation range are conducive to road construction and traffic. The complexity of geological structure has a positive effect between 0.3 and 0.8, but on the whole, the influence of geological structure on route selection is significantly complex. The influence of topography and landform on the Shu Road route selection policy is positive, reflecting the consideration of the actual terrain in the process of route selection. After the river area exceeds a certain threshold, its influence on route selection becomes positive, probably because large rivers facilitate the transportation of resources such as timber, thereby facilitating route selection decisions.

a Geologic structure. b Landform. c Elevation, d River, e Urban density, f Pass influence, g TAC Grade, h Post influence.
Among the socio-economic factors, the influence of the post-station influence index showed a positive effect between 0 and 1, but with the increase of the impact index, the influence on the Shu Road route selection policy gradually weakened, and then increased again, indicating that when the number of post stations reached a certain level, the influence tended to be saturated and there was a rebound effect. Although there are fluctuations in the process, the overall impact on the Shu Road route selection has gradually increased with the advancement of urbanization. Among the military and political factors, the influence of the pass showed more negative effects in the range of 2–5. In other intervals, the impact of the pass is positive. The influence of the administrative center is shown to be a nonlinear positive growth, indicating that with the establishment and development of the administrative center, its influence on the Shu Road route selection policy has gradually increased. On the whole, the influence of various factors presents the characteristics of a complex combination of linearity and nonlinearity, showing the multidimensional consideration and complexity of the Shu Road route selection decision.
Local interaction effects
By utilizing SHAP interaction values, pairs of variables with significant interactions can be identified. Figure 11 illustrates the local interaction effects between some variables. Each data point in the graph represents a sample, the horizontal axis represents the value of variable X1, and the color of the dots represents the value of variable X2. The SHAP interaction values displayed on the vertical axis show the contribution of the interaction between variables X1 and X2 to the model prediction results.

a Urban density and Pass influence. b Urban density and TAC Grade. c River and Urban density. d Elevation and River. e Elevation and TAC Grade. f Elevation and Pass influence. g Elevation and Post influence. h Elevation and Urban density. i River and Post influence. j Geologic structure and Elevation. k Pass influence and TAC Grade. l Pass influence and Post influence.
Among the socio-economic factors affecting the selection of Shu Road, when the urban impact index is between 0 and 1, regardless of the impact of the pass, the two have a negative effect on the route selection. However, with the increase of the influence of the town, the influence of the pass gradually increased, and the fluctuation range of its SHAP value also expanded, which began to have a certain positive effect on the selection of Shu Road. Especially in areas with high urban influence, the defense needs of the pass and the transportation demand are intertwined, and together they play a role in the decision of route selection. The combined effect of urban density and TAC grade on Shu Road alignment selection exhibits its highest interaction term at an urban density level of approximately 2.5–3.5, indicating moderate road accessibility within this range. As urban grades increase further and administrative center indices deepen, the interaction term declines instead, even approaching negative values. Higher-grade administrative centers may not exert equivalent route attraction, potentially due to terrain, defense considerations, or other factors offsetting their potential advantages. Among the physical geographical factors, the interaction effect between rivers and towns is significant, especially in areas with high urban influence, and with the increase of river factors, its interaction with high urban density has a positive impact on the selection of Shu Road routes. The interaction between elevation and river is manifested in the fact that when the altitude is at 500–1000 meters, the larger the river area, the more obvious the positive effect on the Shu Road route selection. The relationship between elevation and administrative center is that in the range of 0–1000 meters above sea level, the synergy effect between the two on the Shu Road route selection is mainly manifested. When the altitude exceeds 1000 meters, with the increase of altitude, the influence of the administrative center is low, and the two have a positive effect on route selection. The interaction between elevation and pass shows that with the increase of altitude, the higher the influence of the pass, the stronger the synergistic effect between the two on the selection of Shu Road routes. Similarly, the interaction between elevation and post-station is also manifested in the fact that with the increase of altitude, the higher the influence of the post-station, the more significant the synergistic effect between the two on the selection of Shu Road routes. However, the interaction between elevation and towns is different, and with the increase of altitude, the synergistic effect between the two on the selection of Shu Road is stronger when the influence of low towns is strong. The interaction analysis between rivers and post stations shows that the SHAP value gradually increases in the areas with great river influence, which means that the support effect of rivers on Shu Road route selection is more significant in such areas, fully showing that the interaction between rivers and post stations has a strong supporting effect on Shu Road route selection. Finally, the interaction between geological structure and elevation shows a negative impact; that is, with the increase of geological structure complexity and altitude, the combined effect of the two has an adverse effect on the Shu Road route selection.
In terms of military and political factors, when the strategic pass influence value is between 0 and 2, it can synergize with the administrative center’s hierarchy, but when this value exceeds 2, the relationship turns negative. This is because the optimal geographical locations of passes and administrative centers often misalign, as geographical constraint points, passes prioritize routes that meet traffic and defense requirements, thereby deviating from the optimal path connecting administrative centers, causing their influences to offset each other. Similarly, the relationship between passes and post stations also involves dynamics of synergy and competition. In areas where both influences are relatively low, natural constraints are limited, allowing the Shu Road routes to flexibly accommodate both needs and exhibit synergistic effects. However, when the pass impact index exceeds 2, its interaction with post stations in route selection becomes negative. This mainly stems from differences in functional positioning, passes focus on military defense, and are usually located in rugged terrain, which significantly increases the cost and difficulty of road construction nearby; in contrast, post stations provide material transport and rest, preferring locations on flat terrain that facilitate resource allocation. When both influences are strong, routes must simultaneously meet defense requirements and transportation convenience, making coordination difficult and resulting in mutual constraints.



