Types and historical roles of secret gates: a new understanding of the Ming Great Wall based on a digital heritage survey

ABSTRACT The database of images of the Ming Great Wall, along with on-site investigation and verification, has allowed more than 120 secret gate sites to be located and classified for the first time. Based on typological analyses of the relationship between each type of secret gate’s form and function, we created a classification system of the Ming Great Wall’s secret gates. By combining traditional historical textual research, site surveys, and GIS micro-terrain analysis, we found that secret gates, as a key element, integrate other facility types into a coordinated regional defense system, revealing several active and flexible defense modes and more sophisticated planning intentions than were initially recognized. Finally, based on historical textual research, we found that secret gates played a broad and positive role in political interaction and socio-economic exchanges between the Ming Dynasty and Mongolian tribes, offering a new perspective on the historical function and the “open” or “closed” nature of the Ming Great Wall. Moreover, the methods introduced are likely to be applicable to the examination of other types of cultural route heritage. Graphical Abstract


Introduction
Various dynasties and political entities throughout Chinese history, situated in different historical contexts and geographical environments, had built great walls. The research and interpretation perspectives applied to understanding the purposes and historical roles of such walls are also multiple. For example, walls have been interpreted as boundaries of agricultural and pastoralism resources (Lattimore 1937;Wang 2008), regulators of political and economic relations (Li 2017), means of securing the conquest of non-traditional agricultural areas (Di Cosmo 2002;Shelach Lavi et al. 2020), etc. The focus of this study is the Great Wall of the Ming Dynasty, and the direct historical reason for its construction is considered to be the Ming Dynasty's political and military policy turn in the 16th century (Waldron 1990). The political focus in China shifted to internal affairs, and the border defense strategy gradually came to depend on the Great Wall defense system (Zhao 2015). Under the influence of the blockade formed by the Great Wall, the Ming Dynasty and Mongolian tribes maintained necessary political, economic, and resource relationships through customs stations and strategic passes built into the long wall. The physical "open" or "closed" nature of the Ming Great Wall system is most directly reflected in the geographical spatial distribution of its great passes, "Guan" (关), and small passes, "Kou" (口). The wall line spans about 5000 kilometers from east to west. Relative to the wall's overall length, the number and distribution of Guan and Kou passes is limited, supporting the conservative impression that the wall's length limited exchange between cultural groups. However, exchanges of people and goods between the two sides were never fully interrupted (Deng 2019), and various types of cultural interaction occurred (Ha 1996). However, the precise role of the Ming Great Wall in these exchange activities remains unclear.
According to historical records, in addition to the Guan and Kou passes, the Ming Great Wall once contained a lower level of channels distributed across its length, which Chinese texts as "secret gates" (暗门or 闇门). These secret gates were relatively ubiquitous and more widely distributed than the Guan and Kou passes (the secret gates were not necessarily literally "secret"; rather, their secrecy was a relative concept that will be summarized in Chapter 5.4.)

Secret gates: The lowest level of the Ming Great Wall passageways
A secret gate is a type of passage that was built into a city wall in ancient times. The form and location of the gates were kept secret. Such gates were used to send out shock troops when cities were attacked or besieged as a component of active defense or to send sentries to perform tasks associated with intelligence collection and transmission. The secret gate was an important type of defensive facility in ancient Chinese cities. Compared with their use in urban defense facilities, secret gates in the Great Wall played an important role in the economic and political interactions that took place in border areas, reflecting the flexibility and openness of the frontier defense system. Figure 1. Date distribution of ancient books with information related to "secret gates".

The gap between the rich historical records and contemporary site research
The history of secret gates can be traced back to the document Mozi-beitu (墨子·备突) by , which recorded the design and defense methods associated with secret gates inherited from earlier dynasties (Qin 2006). Many historical documents contain records of secret gates. Using full-text search, we searched for Ding-xiu and Unihan (Ding-xiu and Unihan 鼎秀和书同文) using the keywords "暗门" ("secret gate") and "闇 门" ("secret gate" in traditional Chinese writing for secret gate), respectively, and selected records relating to defense facilities from the returned items ( Figure 1). The earliest document was Mozi-beitu, and usage of these terms was observed in documents up to and including those created in the Republic of China. The terms' mentions increased sharply after the establishment of the Ming Dynasty, and a considerable proportion of the literature's content was related to the Ming Great Wall. Therefore, secret gates and the corresponding military considerations have a long history and were an integral aspect of frontier defense during the Ming Dynasty.
Compared to beacon towers, city walls, passes, and other facilities found along the Great Wall, secret gates are small in scale and can be easily destroyed or buried. The existing sites are scattered throughout a vast geographical region divided by a complex terrain. Therefore, archaeological investigations of the Ming Great Wall Site rarely involve secret gates despite the large number of historical records that document them. Researchers focus primarily on the more common features, such as the building types and spatial distribution of the "brick hollow defense tower" (Zhang 2019), site selection of beacon towers based on geographic information systems (GIS) analyses (Cao, Li, and Zhang 2017;Chen, Du, and Cui et al. 2017), and the rammed earth technology used to construct the Great Wall (Shen et al., 2018) as well as systematically documenting the characteristics of the known affiliated facilities (Li, X.M., 2019). However, few archaeological and historical studies relating to the secret gates have been published to date : Li Liya and Sun Chi (2004) found a Z-shaped doorway at the archaeological site of Hongmen Castle (红门马市). Based on historical documents, they confirmed it to be a secret gate that was used in the horse trade. Shang Heng (2017) made a preliminary study of the secret gates' historical function based on field surveys of individual sites and historical materials. Liu, Cao, and Li (2012) researched secret gates and permanent roadblocks (峡榨) in the Ming Great Wall in Qinghai province, and partly revealed the formal characteristics of secret gates in the Northwestern region. These results are mainly based on archaeological reports and historical background interpretation of individual cases. In-depth and systematic research of secret gate sites and their historical role from the perspective of the Ming Great Wall as a whole have remained lacking prior to this study.
The paucity of research on the secret gates reflects the problems of fragmentation and the loss of detailed site information owing to the Wall's large geographical scale and earlier research efforts' shortcomings with respect to digital information collection and management methods. These factors have hindered a comprehensive grasp and observation of heritage information from specific perspectives.

Research objective
This paper is focused on the following research topics: (1) The general forms of the secret gates in the Ming Great Wall: We sought to determine whether the secret gates underwent systematic development in terms of their architectural characteristics. By clarifying the architectural types based on analyses of the sites' architectural forms and functions, we can make scientific judgments regarding the gates' design and associated purposes within the complex site environment.
(2) The spatial distribution of the secret gates and the associated defense mechanisms of the Ming Great Wall: The secret gates' locations and forms were related to the local defense environment and were often integral to the strategic pass defense. The specific strategies and planning concepts at play in the secret gates' placement have not been investigated hitherto.
(3) The historical roles that secret gates played in the social, economic, and political aspects of the frontier area: The secret gate is the most basic port of the Ming Dynasty's northern frontier. As such, its historic role may reflect the Great Wall's key strategic significance from a micro-historical perspective.

Material and methods
This study adopted the research perspective of macrocosm and microcosm and must be based on materials that prioritize accuracy and comprehensiveness. Therefore, the following material acquisition and research methods were applied.   the spatial scale and form of earlier survey results are still unable to show the site's three-dimensional details, such as site diseases, facility remains, and so on.

Rapid census and type comparison of heritage information on a super large geographical scale
Since 2018, our research team has initiated a whole-line digital survey of the Ming Great Wall with the aim of collecting detailed three-dimensional (3D) image information pertaining to the whole-line ruins and compiled an image database of the entire Ming Great Wall line. At present, the image database contains ultra-low altitude aerial image data for about 6000 kilometers of the Ming Great Wall, beacon towers, castles, and other single facilities. In theory, digital 3D modeling with centimeter accuracy can be obtained via spatial alignment of continuous photogrammetric data collected using multiple aerial routes and a shooting height of about 30-50 meters. On this basis, we conducted preliminary database management and image retrieval using the Web GIS platform (Figure 2).
Using the platform, we were able to retrieve quickly and screen high-definition images of the whole wall line, complete the image recognition and location of the secret gate sites, and then screen out a total of 82 sites with complete preservation of doorways or doorway foundations, as well as 25 existing samples of Kou passes. Using 3D digital model reconstruction, the size of each site, including the width and height of the inner and outer gate openings, could be obtained with decimeter accuracy. Finally, samples from each site type were statistically analyzed and compared.

Mutual verification of historical documents and site investigation information
Historical documents record the formal characteristics of the secret gates and related historical events. Using traditional historical textual research methods, we synthesized the fragmented secret gate information and conducted historical interpretation based on the actual space of the site to confirm the authenticity of the historical information and enhance our understanding of the artifacts' authenticity.

Types of secret gate site and their architectural function tendency
Using the above research methods and tools, we adopted whole-line quantitative statistics of secret gate sites' characteristics as a starting point to obtain a holistic and detailed appreciation of the gates' material forms and possible functions and lay an empirical foundation for the subsequent architectural history research.

Overall distribution of secret gate site
The digital survey process revealed that the existing secret gate sites are primarily distributed in the Wall's eastern section in Beijing, Tianjin, and Hebei Province. At these sites, the secret gates' structures mainly involve brick and stone masonry. In Shanxi Province, secret gate structures of rammed earth covered with bricks are found sporadically, with a gradual reduction in quantity along the wall from east to west. At the rammed earth wall site in Northwest China, it is almost impossible to find secret gate sites. As Figure 3 illustrates, historical documentssuch as ancient maps and local archives -indicate that secret gates were widely distributed in the Northwestern region of the Ming Great Wall. Moreover, secret gate sites are rapidly disappearing as a result of natural and human factors. Owing to the dearth of academic and public knowledge regarding this topic, the secret gates have been overlooked by many protection projects, resulting in a loss of key historical information.

Genealogy of secret gate types
Using images of the secret gate sites and field investigations of typical sites, we were able to conduct an architectural typology analysis that revealed rich architectural forms and genealogical relationships (Table 1). First, we summarized the core function of each secret gate by categorizing it as either a straight-through type or non-straightthrough type passage. Each gate was then categorized as one of six basic types according to specific streamlined organizational characteristics. Each basic type had various subtypes with structural and functional differences. The genealogy includes all secret gate sites found to date.
This genealogy was established based on analyses of the sites' architectural forms and functions, to clarify the type and relate it to form and function. Therefore, the functional topological relationships in the map do not indicate a temporal inheritance and evolution relationship.

Straight-through type: The most basic form of secret gate
The straight-through type is the key secret gate form. Of the 82 samples assessed, the straight-through type accounted for the greatest proportion (61%). This includes the arch-top type (type-z1) and the flat-top (type-z2) type, which is supported by a stone beam or slab.

Scale characteristics of the straight-through type
The dimensions of the outer entrance of the secret gate site (here, the outer side refers to the side of the Great Wall facing the area controlled by nomadic tribes during the Ming Dynasty) directly reflect the design intention regarding the efficiency and safety of travel through the passage. We calculated statistics pertaining to the width of the outer entrance for all samples and found that the value distribution range was widest for the archtop type (type-z1). The value distribution range for the flat-top type (type-z2) was concentrated in the area below 1.05 m, making these smaller than the arch-top type passages ( Figure 4).
It was difficult to obtain the height values of the outer gate openings because the floor surface of the doorways in most sites had been buried by debris resulting from structural collapse and flood deposits, or the brick arch of the entrance had fallen such that its current height did not reflect its original appearance. We screened out 27 valid samples that were relatively intact. Among these, the height distribution of the outer openings of each type of secret gate showed no clear regularity ( Figure 5).
Overall, the characteristics of flat-top secret gates reflect the limits of the dimensions of secret gates along the Ming Great Wall. Taking sample 6 (39.328999 N, 114.832913 E) in Figure 4 as an example, the size of the outer gate opening is 0.54 m (width) x 1.09 m (height) while the inner gate opening is 0.83 m (width) x 1.71 m (height). The doorway's inner dimensions can accommodate an adult of medium height standing upright, but they would have had to bend down to pass through the outer opening. The narrow shape and small scale of this type of secret gate may be related to the limited span of stone-beam structures and reflect the design intention in terms of the safety and secrecy of the entrance.

Comparing secret gates and Kou passes
A high degree of similarity is evident between straightthrough secret gates and Kou (small) passes, which may lead scholars to overlook the secret gate's particularity as a relatively independent pass level and architectural form. Therefore, it is necessary to clarify the secret gate concept by comparing the dimensions of Kou passes and secret gates.
Historical documents indicate that, as a doorway form characterized by extreme dimensions, the secret gate form was sometimes adopted for Kou passes: "The market-surveillance tower of Shahu Kou (杀虎口) is located above the secret gate . . . " (Wang 1969); "the tower above the pass, towering and majestic, with a secret gate under it"(Da Qing Yi Tong Zhi). For example, the Shimenzi Kou (石门子 口) is a small pass that was built under the jurisdiction of Leng Kou (冷口) (Guo 1987). The width of its outer doorway is 0.93 m, which is similar in dimension to a secret gate and contrasts sharply with the widest "Kou" (Figure 6).  We selected 25 samples of Kou sites with relatively complete doorways from the Ming Great Wall image database ( Table 2). Comparison of the median and mean values of the straight-through secret gates and Kou passes in terms of outer doorway width revealed that the values for Kou passes were significantly higher than those for straight-through secret gates (either type-z1 or type-z2) ( Table 3).  Overall, the above analysis indicates that the secret gate is a relatively independent item in the Ming Great Wall's doorway system, but their narrow and secretive doorway form was also used by some small passes.

Secret gate type with specific function tendency
The construction and planning of frontier passes including secret gates, required serious consideration regarding the conflicting needs of trafficability and security. To balance this requirement with varying terrain conditions, two main groups of design features that are more complex than the straightthrough type were adopted in some secret gates: (1) wall-climbing-steps, defense-platforms, and watchtowers to maintain the trafficability of the straight-through doorway and strengthen the defense of the entrance and the interior (type-Z3 in Table 1) and (2) set changes in the horizontal direction (type-WZ and NZ in Table 1) or vertical direction (type-DL in Table 1) of the passage's trajectory to form a non-straight-through secret gate, thus diminishing trafficability and strengthening the doorway's military control.
The non-straight-through secret gate type includes a special form of blocked doorway (type-FD in Table 1). For example, the secret gate in the wall section of Tianyun mountain (天云山) has a blocking wall inside a straight-through doorway. The defender can climb to the top of the blocking wall using the inner steps and use a ladder to descend the wall to the outside. Alternatively, under the cover of the blocking wall, they can attack any enemies who enter through the doorway. This design facilitates one-way access to the inside of the wall (Figure 7).
Our analysis also revealed a secret gate form with an outside entrance that was completely concealed. We found a half-brick-thick false wall obscuring the outside entrance of a secret gate (40.154803 N, 119.232475 E) at the Jieling Kou (界岭口) section. The false wall does not bear the weight of the arched top of the doorway but is integrated with the outer surface of the city wall and has the same masonry texture. Before it was broken, this secret gate could not be identified from the outside of the wall (Figure 8).
This type of secret gate has a long history. Du You (杜佑735-812 A.D.) described this form of secret gate as follows: " . . . cutting tunnels in the city wall from the inner side until just 15-20 cm of packed earth is left to prevent penetration of the outer layer of the wall. In the middle of the night, or at the beginning of the enemy's arrival such that their camp is incomplete, the elite cavalry leaps out of the Tumen to attack the enemy unprepared" (Mo Di, 2006). Tumen (突门), meaning literally "the gate used to launch a sudden attack" is a special form of secret gate. The remains of such gates are particularly rare across the Great Wall, perhaps because they were designed specifically for wartime rather than daily life, limiting their application. The secret gate of Jieling Kou (界岭 口) offers precious physical evidence of the ancient Tumen defense facility.

The construction time sequence relationship between the secret gate and the wall lines
The temporal sequence of construction between the secret gate and wall lines and other facilities reflects the functional closeness between the secret gates and the entire defense system and whether the secret gate participated in the entire spatial and functional planning process of the Great Wall's defense system. The limited information about the secret gates' construction time (Table 4) indicates that they were generally constructed at the same time as other facilities, such as the wall, defense tower, guard room, water gate, and so on. Therefore, the time taken to create the secret gates may be estimated based on the large-scale construction time of the walls in each section. During the early Ming period, the northern frontier facilities mainly consisted of strategic fortresses, beacon towers, trenches, and walls near the passes (Li 2019). According to the results retrieved from the database of ancient Chinese books (mentioned in Section 1.2), the earliest record reads as follows: "in 1430 A.D.(宣德 五年), the main pass castle and two blockade walls were built . . . two rivers converge and pass through the secret gate . . . " (Chu 1780). The emergence of the secret gate in the Ming Dynasty's northern fortifications may have begun with the construction of local blockade walls at strategic passes. From the Chenghua period (成化年间 1465-1487 A. D.), Ningxia (宁夏), Yansui (延绥), Datong (大同) and other western regions took the lead in building continuous walls on a large scale. The continuous walls in the eastern four military districts (in which 94% of the sites sample in this study are located) were built between 1551 and 1555 A.D. (i.e., during the Jiajing period嘉靖) (Liu 1997). Therefore, secret gates may appear in large numbers simultaneously with the gradual construction of continuous walls after the Chenghua period, reaching their climax during the Jiajing period.
As it was widely used in defense operations, the form and function of the secret door would also be changed and improved according to the actual combat experience and regional characteristics. For example, the appearance of type DL (Table 1) should be later than the form of secret gate set on the wall. The construction of hollow brick defense towers began in 1569 A.D. (Fan 2010). Qi Jiguang (戚继光 1528-1588 A.D.), the founder of the hollow defense tower, would adjust the secret gates' positions based on practical experience: "The secret gate opened under the defense tower is weak in defense, while the construction of the wall builders is rough. I worried that their engineering construction does not follow the rules or is not solid. It seems safer that the gate is moved from the foundation up to the outer wall of the defense tower with a ladder placed outside, which could be take back when the enemy attacks." (Qi 1962) This may be regarded as the beginning of type DL.
The historical records suggest that some secret gates in the western sections of the Ming Great Wall may have had greater traffic capacity, with larger doorways, to allow the passage of cavalry. In the wall section of Ningxia, located in the flat Gobi desert, Li Shiao (李士翱1488-1562 A.D.) suggested that a barbican entrance (瓮城) be constructed with a new secret gate outside the original secret gate to strengthen protection, and introduced the usage: "First put down the gate plate of the old secret gate, then fill the Barbican ground with tie ji li (铁蒺 藜; an iron ball with spikes), and lift the new secret gate open . . . Seeing that the gate has been opened, the enemy will certainly not continue to attack the wall, but rush into the secret gate. When more than a dozen cavalry rushed in, the garrison immediately put down all the gate plates . . . ." (Li 1962.) The secret gate was evidently basically synchronized with the wall line in the construction sequence and was a long-standing indispensable facility in the Ming Great Wall system. It was not a product of temporary and unofficial construction and later transformation. Of course, owing to the limitations of the historical materials, it is impossible to observe the temporal and spatial distribution regularity and regional differences of secret gate construction activities, which remain a topic for future research.

The role of secret gates in local defense system of the Ming Great Wall
Above, the basic functions of the secret gate were analyzed based on architectural scale. In this section, the analytical perspective shifted to the site's regional environment and found that a positive supportive and cooperative relationship operated between the secret gates and other facilities (for example, branch walls, defense towers, passes. etc.), indicating the deep integration of secret gates and regional defense planning intentions.
In the section that follows, we discuss and summarize typical applications of secret gates according to trafficability based on slope analysis. Basic terrain data with sub-meter accuracy were obtained via aerial photogrammetry at a relative height of about 200 meters. The impacts of slope on climb-over behaviors in mountain operations and traffic are quoted from the empirical values of slope-based classification of infantry trafficability proposed by Mauricio Nicolas Vergara (Table 5). This formed the basis of reclassification of the terrain used to build the cost raster in the Arc GIS analysis of the cost-path, which helped us to observe the terrain accessibility clearly and analyze the planning intentions of the facilities, including secret gates.

Side attack mode
General Qi Jiguang (戚继光1528-1588 A.D.) explained the function of secret gates in the defense of the pass as follows. . "A secret gate should be created below each watchtower. It is convenient for firearm-shooting outside the wall, and enables the troops to go out to defend the wall against the enemy on the side slope" (Qi 1965).
The ancient rulers often used the highest points of the mountains in front of the Great Wall to build perimeter fortifications, as these locations were favorable for long-range observation in the direction of the valley connected to the pass. If necessary, troops could be sent to attack the invader's flanks in the valley. As Figure 9 illustrates, the Longyu Kou (龙峪口) and the 17 th water gate are separated by a hill. X1, X2, and X3 had high defense facilities (they are type-DL) and opened toward the steep hillside to ensure protection of the terrain. These three gates opened on the top of the range beside the valley's main pass, posing a threat to the enemy's flank or rear as they invaded the two ravines.

Joint defense mode
The density of secret gates along the defense line directly affects the Great Wall's local defenses. On this topic, Li Shiao (李士翱1488-1562 A.C.) stated the following: "There are nine fortresses along the Great Wall in Hedong, Ningxia (宁夏河东), which stretch for more than 200 Li (about 112 kilometers). There are four secret gates in Huamachi, Anding, Xingwu, and Qingshui, each 60-70 Li (about 33-39 kilometers) apart. These face straight into the region occupied by the enemy, where the enemy is more likely to find our weakness. There is no chance of winning there for us" (Li 1962). The Simatai pass (司马台), for example, has five secret gates within 500 meters on both wings ( Figure  10). According to the cost path analysis and the existing traditional mountain path, the topographical conditions outside the wall are conducive to traffic connection between the five secret gates with a distance of only 200-300 m. The secret gates of the Simatai pass exhibit clear characteristics of mutual cooperation.

Connecting defense lines
The periphery of the Great Wall line includes numerous supplementary defense facilities, such as trenches, parapets, and beacon towers. Use of these facilities would have required military personnel to shuttle frequently between multiple defense lines to achieve cooperation between defense fortifications. The secret gates played a key role in such transportation. As Figure 11 indicates, the 21 st watchtower in Jinshanling (金山岭) guards the fork connecting Zhuanduo Kou (砖垛口), Shaling Kou (沙岭口), and the branch wall, which constitute the core of regional defense.
The east side of the 21 st watchtower is a weak point of regional defense. Therefore, a parapet about 1.5 m high was erected 5-10 meters outside the 21 st watchtower, and neatly arranged shooting holes for harquebus and cannons open onto the parapet. Located at a distance of 50-100 m from this parapet are the ruins of another 400 m-long parapet composed of a cliff with rubble masonry.  Thus, the main line and parapets formed three lines of defense. Z1 is a straight-through secret gate with wall-climbing steps (type-ZD3 in Table 1) that connects the two exterior defense layers.
The variety of facility coordination indicates that the Ming Great Wall system did not rely on a single passive defense strategy but, rather, implemented an active defense strategy. It comprised multiple defense lines and fortress groups, with the secret gate system playing a key role. Based on observations of the site selections for the secret gates along the whole line, the complex cooperation mode is summarized (Figure 12).

The broader roles of secret gates in the historical development of the frontier
In addition to playing an important military role in the Ming Great Wall's military defense mechanisms, the secret gate also fulfilled numerous non-military roles. Historical texts that document important diplomatic events, trade activities, and official policy in border areas frequently mention secret gates. Based on historical information mining, the secret gate's specific functional performance in a non-military context will be analyzed and discussed in this section.

Garrisoned farming and logging
The effective operation of the Great Wall's defense system was directly affected by local economies and people's livelihoods in border areas. During the longterm and stable development that took place during the middle and late Ming period, the population in the frontier area gradually increased. With the intensification of land annexation, the lack of farming resources led to the collapse of the garrisoned farming system (Liao 2010). Thus, the relatively rich resources coming in from outside the border buffered the effects of internal social pressure. Pang Shangpeng (庞尚鹏 1524-1580 A.D.) made the following point in his memoirs when rectifying the garrison order in Gansu district (甘肃镇) as an imperial envoy: "The military officers originally issued a ban against going outside the border without permission, which prevented farming outside the border. Why not build secret gates on the trenches of the Great Wall that are close to water sources such as rivers and flood areas, and allow the nearby residents to pass through to use the wasteland with soldiers guarding from the heights of the wall?" (Pang 1962).
Later records of Gansu local chronicles confirmed that this proposal was implemented: " Zhenfan Chuan (镇番川) . . . there are 50 beacon towers along the Great Wall, one every five Li. Each has a secret gate, allowing woodcutters to come in and out through." (Zhang 1999) Consequently, the secret gate became a survival tool for poor garrison troops and civilians, enabling them to cross the border to cut wood and cultivate crops. This was key to maintaining social stability in the border areas.

Border trading
Secret gates were also an important facility in the border market along the Ming Great Wall, with market castles, watchtowers, barbican entrances, and other facilities constituting the market defense system (Figure 13). The narrow scale of a secret gate allows only one person to lead a horse in and out. This is conducive to controlling the flow of people and preventing chaos, market grabbing, and other harmful behaviors. The Ming Dynasty and Mongolian tribes also established detailed mutual market rules:"If the Mongols do not enter through the secret gate but secretly climb over the wall, when caught, 19 cattle and sheep will be confiscated as punishment" (Wang 1969, 247);"Any officer who dares to sell harnesses through secret gates will be immediately punished for collaborating with the enemy";"Let the interpreter go to the Mongols and announce that it is not allowed to take in count the horses that are dying and cannot be ridden. Those horses with tongue broken, mane cut, throat stabbed, stomach poured into by sand, and those who are too young to be fed forage are not allowed to enter the secret gate" (Wang 1969, 259). Thus, secret gates were widely used in the markets along the Ming Great Wall as core channels in specific transaction processes. Figure 14 illustrates the known location of the secret gate in the horse market site.

Political contacts
The Great Wall was the product of political decisionmaking. Therefore, the study of the Great Wall site may constitute a type of foreign policy archaeology (Waldron 1990). It was also the lever and stabilizer of official political and economic relationships marked by the "tributary system and border trade" (Li 2017). Secret gates played an irreplaceable role in the "micro-circulation" of material and information between the two sides of the border areas and were likely to be important points of communication. One historical text states: "Tuotuo (the son of Altan-Khan) led about ten riders to the secret gate of Ningyuan castle in Xuanfu town. He called out to the translator and swore by his sword for peaceful trade with the Ming Dynasty." (Ming Shi Zong Shi Lu 1983) After establishing stable political relations with Altan-Khan (俺答汗1507-1582 A.D.), the Ming government even tacitly allowed his tribe to cross the Wall defense area in Hexi (河西走廊) through the secret gate and travel between Qinghai(青海) and the northern grassland: "The tribal leaders who enter through the Shuiquan secret gate and ShiXiakou secret gate follow the above two routes respectively. The commander of the defense zone should lead the army to escort them out from Biandu Kou (扁都口) within a time limit, and the tolerance for their staying is forbidden. The tribes returning from Qinghai should also be escorted and monitored . . . ." (Ming Shen Zong Shi Lu 1983) Thirty years after Altan-Khan's death, however, Prince Su-nang (素囊台吉) stopped paying tribute to the Ming Dynasty as a result of dissatisfaction with the Dynasty's recognition of Bushitu's (卜石兔台吉) succession to the throne of Khan. Wang Shiqi (王士琦), vice governor of Shanxi Province, once recorded the process of coping with the border crisis: "I wrote a letter to the general, asking the castles along the Great Wall to rectify their troops and weapons, repair beacon towers and warning facilities, patrol and guard day and night, and threatened to block the secret gates in person on January 15 (in the lunar calendar). Prince Su-nang and his twelve tribes panicked and all came to ask for tribute. On March 2, I personally went to the market to receive tribute . . . " (Wang 1969, 243) Nomadic tribes are highly autonomous and geographically dispersed, and their economy largely depends on trade, plunder, and other auxiliary economic sources of non-nomadic production (Wang 2008). Thus, by closing secret gates and banning folk trade, Mongolian tribal nobles could often be compelled to compromise politically. With the help of widely distributed geographical channels, such as secret gates, the Ming government could respond flexibly to the demands of different nomadic groups and avoid the systematic impact of local disputes on the border situation.

Relativity of the appellation "secret gate"
The above historical roles demonstrate that the secret gate was known by those on both sides of the Great Wall in the context of their long communication and interaction. Therefore, the secret gate's nomenclature seems to be inconsistent with the reality, but throughout the Ming Dynasty, the title did not change among the government or the people. Today, numerous villages or places named "anmen-dun" (暗门墩 meaning "the beacon tower with a secret gate") and "an-men-cun" (暗门村 means "the village next to the secret gate") still exist throughout the Ming Great Wall area. 1 On this issue, we may derive inspiration from the ancients' understanding of the secret gates of the Ming Great Wall. Lu Xiangsheng (卢象升 1600-1639 A.D.) once suggested to the emperor that he unseal the secret gates along the border to allow soldiers and civilians to go out to cut wood so as to improve people's livelihoods and open up the information channel from the north: "The wall blocking and port closing are just covering our eyes and ears ourselves. According to the system handed down by our ancestors, there are many secret gates under the border wall, just as people have holes in their bodies. People do not totally close their features to stop harmful things entering the body . . . " (Lu 1829). In Lu's discussion on the secret gate, we find the plain and dialectical philosophy of Chinese thought traditions: the meaning of "secret" (暗) also goes beyond the narrow concept of concealment in a material sense and becomes a relative concept with broader denotative significance.
It should be noted that the secret gate was a formal port and the resulting folk or official exchanges were under the direct management of the Ming government, as reflected in the above research. Therefore, the "secrecy" of the secret gate is not necessarily non-governmental, local, or temporary. Its opening and closing often reflects changes in the official policy toward the nomadic tribes in the north. The "secrecy" of the secret gate is often reflected in the limited impact of local interaction and the flexibility of policy practice, which supplemented the overall border defense policy.

Conclusion and discussion
The secret gate's function has been observed and analyzed by considering the architectural scale, the regional scale, and the broader historical narrative background; the conclusions may be summarized from three aspects: the form of historical buildings, the planning purposes and defense mechanisms, and the historical role and influence (1) The secret gates of the Ming Great Wall constitute a relatively independent hierarchy of pass systems, with the widest distribution in the Great Wall passageways. To cope with different terrain conditions, military purposes, and traffic demands, various architectural types with different functional characteristics were developed, which can be classified according to their functional dimensions.
(2) The various cooperation modes of secret gates with other facilities reveal that the defense mechanisms of the Ming Great Wall included a strong active defense, launched outside the wall, such as flank attack and containment behind enemy lines, which is in contrast to the stereotypical view that the border defense depended simply on conservative linear fortifications.
(3) Secret gates were an important material mediator of the Ming government's official political and economic relations with Mongolian tribes, which reflects the flexibility of the Ming Dynasty's frontier policy in practice. Therefore, the discovery of secret gates, which form a basic port system, provides new perspectives for further discussion regarding the closed or open nature of the Ming Great Wall.
As is typical of historical cultural routes, the Great Wall includes many tangible elements with cultural significance that have emerged from multi-dimensional exchanges between different groups throughout the Great Wall area. The relatively scattered heritage elements illustrate the interaction of movement along the route (World Heritage Centre 2019). Secret gates or other facilities were important material vehicles for multi-dimensional interaction and movement and are now a key element for augmenting knowledge of the roles of seemingly isolated defense facilities in the overall system. From a holistic perspective, the characteristic statistics and comparative observations of various facilities synthesize the macro-and micro-historical perspectives, lending greater depth to research into the Great Wall.
The establishment and application of the threedimensional image database of the Ming Great Wall has overcome the constraints of the vast spatial scale and considerable geographical segmentation of the remains, improved the efficiency of heritage information processing and the accuracy of site observation, and accelerated heritage exploration and the formulation of scientific protection strategies.

Disclosure statement
No potential conflict of interest was reported by the author(s).

Funding
This work was supported by the National Natural Science Foundation of China [51878437,51878439,51908179]

Notes on contributors
Zhe Li is the associate professor who teaches architectural design and history in the School of Architecture of Tianjin University. He focused on landscape archaeological research of ancient military architectural heritage and related heritage protection. At the same time, he has long been engaged in the research on the spatial quantitative analysis method of traditional settlements based on UAV low altitude photogrammetry data.
Xiaolong Tuo is a doctoral student majoring in architecture in the School of Architecture of Tianjin University. He has been devoted to the study of the history of ancient Chinese military architecture with the current research focuses on the history of the military settlement system in northwest China and the protection of related urban and architectural heritage.
Mengdi Zhang is a doctoral student majoring in architecture in the School of Architecture of Tianjin University. Her current research focuses on the image recognition technology and data mining in the field of architectural heritage.

Picture source
The drawing of Type-NZ1 in Table 1 is from the reference document (Li, Y.L., 2004). The base map in Figure 3 is based on the investigation and measurement of the Ming Great Wall in 2009 conducted by the State Administration of Cultural Heritage of China. The base map of Figure 13 is from the ancient map in the reference document (Wang 1969). Other images (including the base photos, drawing, mapping, and 3D models) are from the authors' fieldwork.