3D Documentation with TLS of Caliphal Gate (Ceuta, Spain)

Three-dimensional surveying with a terrestrial laser scanner (TLS) has implied a revolution in the field of 3D modeling, as this methodology provides detailed point-clouds with simplified processes of capture. In addition to the point-clouds, other outputs can be obtained, such as ortho-images, virtual itineraries, 2D cartography, and meshes, which implies a second avenue of multimedia products, such as 3D Portable Document Format (PDF) files and interactive applications. All these options are interesting for the management and broadcast of cultural heritage. The works that have been developed in this research are aimed at setting a workflow for the TLS surveying works and subsequent data management for the generation of a 3D model of the Caliphal Gate of Ceuta, which is considered as one of the most important medieval findings in Spain in recent years, and its immediate surroundings. This model and the different outputs that have been obtained from it allow for the continuation of the historiographic analysis of the complex, while documenting a partial stage in the development of the works of enhancement. In addition to this, these products are not only useful in terms of conservation studies or enhancement, as they are also suitable for the dissemination of the site. Special attention has been set on the paid suitable software for data management while generating the outputs, and for its application by the final users.


Introduction
Any project that implies the enhancement or development of a certain asset or space requires an adequate stage of documentation that assesses its initial state. The geometric definition that is obtained during these initial works must be applied to develop a well-founded analysis of the potential alternatives and uses for this enhancement project, so as to select the most suitable option. Geomatics plays a role of capital importance, as it links the conceptual dimension of the project, and the physical framework of reality. A simple analysis of this issue highlights the bi-directionality and the union between the works that must be held to be able to design the use for the asset (the surveying activities, which are aimed at capturing the geometry of the element of interest in an accurate way), and those to be developed to materialize the design itself (the stage of staking out).
Considering the importance of geomatics in the field of the preservation and enhancement of cultural heritage, its vital contribution to the recovery or the German architectonic heritage after the Second World War can be presented. In 1885, the Royal Institute of Photogrammetry of Prussia was for an integral enhancement of historical sites within a certain territory or region, which evaluate the current state of assets and provide them new uses that are compatible with their conservation, such as the enablement of museums [37].
The main aim of the works that are described in this article is setting a workflow for the TLS surveying campaign and subsequent data management for the generation of a 3D model of the Caliphal Gate (Ceuta, Spain) and its immediate surroundings. This model is the basis for the generation of different outputs which are suitable for the conservation, enhancement, and dissemination of the site.

Materials
Two Leica GS-15 global positioning system (GPS) receivers were applied to observe the external control points and the vertices of the micro-geodetic network (see Sections 2.2 and 3). These two devices were used to observe in real time kinematic (RTK) mode, and the coordinates of each basis were measured four times. Final coordinates were obtained by calculating the average of the observed values, as long as the difference between them was less than 3.5 cm.
For the capture of the field observables, a Leica ScanStation C5 TLS ( Figure 1) was selected. The range of this device allows for measuring maximum distances of 300 m (it being conditioned by the albedo), with accuracies of about 4 mm in single measurements, and recording speeds that range between 25,000 and 50,000 points per second. Certain features, such as the screen or the user's interface, ease the register of data, avoiding the necessity to carry and use a laptop.
programs for an integral enhancement of historical sites within a certain territory or region, which evaluate the current state of assets and provide them new uses that are compatible with their conservation, such as the enablement of museums [37].
The main aim of the works that are described in this article is setting a workflow for the TLS surveying campaign and subsequent data management for the generation of a 3D model of the Caliphal Gate (Ceuta, Spain) and its immediate surroundings. This model is the basis for the generation of different outputs which are suitable for the conservation, enhancement, and dissemination of the site.

Materials
Two Leica GS-15 global positioning system (GPS) receivers were applied to observe the external control points and the vertices of the micro-geodetic network (see Sections 2.2 and 3). These two devices were used to observe in real time kinematic (RTK) mode, and the coordinates of each basis were measured four times. Final coordinates were obtained by calculating the average of the observed values, as long as the difference between them was less than 3.5 cm.
For the capture of the field observables, a Leica ScanStation C5 TLS (Figure 1) was selected. The range of this device allows for measuring maximum distances of 300 m (it being conditioned by the albedo), with accuracies of about 4 mm in single measurements, and recording speeds that range between 25,000 and 50,000 points per second. Certain features, such as the screen or the user's interface, ease the register of data, avoiding the necessity to carry and use a laptop.
The GPS and TLS devices guarantee the quality of the data that are measured in the field to generate the 3D model, in terms of absolute and relative positioning. For the management of GPS data, two different software programs were applied: Leica Ski-pro was used to solve the GPS coordinates, and the planimetric and altimetric networks were adjusted with Geored.
Considering the management of the point-clouds obtained by means of TLS, Leica Cyclone was chosen, not only as it was the alternative designed by the same manufacturer, but also due to it robustness. Reconstructor and Geomagic Rapidform were applied to generate the mesh and to obtain graphic outputs from it.
Given the size of the files, it was necessary to count with a powerful workstation for the management of point-clouds. The main characteristics of its set up are listed next: • Intel Core i7 3770 K, with CPU at 3.5 GHz, 3901 MHz; • Four main processors and eight logical processors; • RAM: 32 GB; The GPS and TLS devices guarantee the quality of the data that are measured in the field to generate the 3D model, in terms of absolute and relative positioning.
For the management of GPS data, two different software programs were applied: Leica Ski-pro was used to solve the GPS coordinates, and the planimetric and altimetric networks were adjusted with Geored.
Considering the management of the point-clouds obtained by means of TLS, Leica Cyclone was chosen, not only as it was the alternative designed by the same manufacturer, but also due to it robustness. Reconstructor and Geomagic Rapidform were applied to generate the mesh and to obtain graphic outputs from it.
Given the size of the files, it was necessary to count with a powerful workstation for the management of point-clouds. The main characteristics of its set up are listed next:

Previous Works
The possibility to work with a properly-referred system of coordinates has a critical importance for any project of heritage analysis or enhancement. This reference framework offers benefits such as allowing for the junction of any planimetric or altimetric work related to the process of enhancement.
Considering the case of Spain, there are planimetric (national geodesic network) and altimetric (high precision network) official reference frameworks. Hence, it is easy to obtain a local network of topographic vertices, and to characterize its points with (x,y,z) coordinates in accordance with these two reference systems. This eases the management of any surveying activity that could be required within the area. The adopted system can be summarized as it follows: • European Terrestrial Reference System 1989 (ETRS89). ETRS89 replaced the regional reference system ED50 in the year 2015, after a period of coexistence of both systems (2012-2015); • Planimetric Universal Transverse Mercator (UTM) coordinates, the official projection system since July 1970; • Altimetric coordinates referred with respect to the mean sea level of Alicante (NMMA), which were obtained by means of GPS and previous junction with vertices within the precise leveling network.
The main objective of these previous works was the implementation of a network of vertices outside the archaeologic complex, so that it allows for an adequate coordinate translation of the TLS point-clouds. Hence, its use provides an accurate geometric definition of the spaces that are included within the area of interest not only in relative coordinates (which would be necessary for the development of most of the measurements and observations that would be required by activities related to archaeological surveying, engineering or construction), but also in absolute coordinates according to the referred system. The sequence of activities that was followed to fulfill these objectives is listed next:

•
Analysis of any existing network; • Physical location and signaling of outside vertices; • Observation with GPS of the outside vertices; • Analysis, compensation, and determination of final coordinates; • Digital identification and documentation of each outside vertex.

TLS Surveying
TLS can be considered as a non-invasive technique, given the fact that the surveyor does not interact with the elements that are scanned. The strategy to capture data in an optimal way must consider three main aspects. Firstly, it is necessary to define the number of scans that are required to obtain a complete definition of the heritage element itself, according to its size or geometrical complexity. Secondly, the best location for the set of references (standard spheres or targets that will be applied to join adjacent point-clouds) with respect to the TLS must be decided, as a proper intervisibility between them is necessary. It is worth mentioning that a quasi-optimal location must be selected for all the involved elements. That is to say, those that provide the best possible quality for the final product, taking into account spatial constrictions, and guaranteeing the integrity of all the elements of value within the archaeological site. Thirdly, an adequate relative location of these reference elements must be also taken into account: A linear arrangement of the spheres or targets would imply a mathematic indetermination and, therefore, the definition of a rotation axis instead of a joining plane for an adequate alignment of neighboring scans.
After setting the TLS and the references in the selected locations, several data, such as the resolution, accuracy, record number, or destiny and format of the file, must be selected or defined to start the scanning process. A previous low-resolution scan can help to define both the area to be captured by a more detailed subsequent scan, and to check if the location given to the different references with respect to the TLS is adequate. In this regard, it is advisable that the capture has a suitable resolution for the element that is modeled. Some devices even allow for naming of these references, which eases the management of the point-clouds in later stages. It is worth noting that, in addition to this, the development of sketches in field notebooks that include the location of the device and the references, and any other helpful detail of the lay out, can be very interesting to simplify these tasks, especially if data were surveyed and managed by different staff members.
Any registered point belonging to a certain cloud will be defined by its spherical or Cartesian coordinates, with respect to the optical center of the device. It is possible to relate both types of coordinates with Equations (1) to (3), where d is the range or distance between the TLS and the point itself, θ is the horizontal angle, α is the elevation angle, and x, y, z are the Cartesian coordinates. These coordinates can be corrected by calibration [38].
The integrity of each raw point-cloud should be assessed on the screen of the device after the scan has been finished to confirm that it has been fully acquired. It is important to check the continuity of raw scans, since vibrations or movements of the device can break that coherence, it being necessary to repeat certain sections.
The adaptation of this strategy for the particular case that is considered in this research, which is characterized by spatial constraints (such as slopes, hollows related to the excavations, heritage elements, etc.), is one of the innovations of this work.

Data Management According to the Desired Outputs
Opposed to the simplicity of the observations, data management is time consuming and requires highly specialized personnel. The presence of the operator in charge of their treatment during the surveying activities, or at least the generation of detailed sketches and schemes by surveyors will ease this stage. Considering the experience gathered through the development of this and other works related to TLS application and modeling, the relation between the times required to survey and manage data is estimated to range between 1 and 5 for the cases of clean point-clouds or simple meshes.
The characteristics of the final outputs can condition the procedures to be followed, but stages of alignment/registration, georeferencing (application of the absolute coordinates of the micro-geodetic network vertices to calculate those of the point-clouds), unifying (merging the complete set of point-clouds not only in a single file, but also in a single point-cloud), cleaning (removal of odd points, duplicated data, etc.), and exportation are common. An adequate combination of unifying and cleaning can help to reduce the total size of the files, although they imply an important consumption of time.
Special attention should be paid to the process of georeferencing, as it can contribute to guarantee the accuracy of the final model. Taking into account the main aspects considered in Sections 2.2.1 and 2.2.2, every single point-cloud will have its own coordinate system. Hence, it will be necessary to consider a common reference system in order to have them joined in a single file. This process is known as "registering" or "alignment". Two options can be adopted for the definition of that common reference system. The relative coordinate system of one of the scans could be adopted as general system. In that case, the remaining scans should be referred with respect to the one selected as basis. The second alternative implies the adoption of an external and absolute coordinate system. In this case, the process is known as "georeferencing". The application of UTM as absolute reference system has two main advantages: A wide-context definition is possible, and the outputs generated from 3D surveying with TLS can be integrated in other preexisting digital models, cartographies, or even in online repositories (such as Google Earth). An intermediate alternative is possible, as the different point-clouds can be referred to the local system of one of them, and the total set can be transformed to the absolute system in a second step. The selection of the most suitable option will depend on the size of the project itself, and the number of available control points.
In the case of archaeological sites, such as the one that is proposed in this research, both the registering/alignment and the georeferencing present complications, such as the fact of being commonly developed in confined spaces or with poor lighting conditions. A combination of direct and indirect georeferencing can be required, which guarantees an effective management of field data.
The first option requires setting the TLS in points whose coordinates are known in advance, or defining them during the campaign with surveying techniques. A proper leveling, the selection of an external reference of known coordinates to orientate the device, and the height of the latter are also required to apply the direct referencing.
Indirect georeferencing is based on a 3D transformation. To apply this alternative, subsequent point-clouds must be pairwise superposed, considering at least three evenly distributed points that appear in both scans and are easy to identify. If their coordinates with respect to the external reference system are known, a rapid and direct transformation will be possible. The Helmert transformation [39], which is applied for this process, is expressed in Equations (4) and (5).
where (X E ) and (X i ) are matrices that comprise the coordinates of a control point (i.e., the center of one of the reference spheres) with respect to the external and relative systems of coordinates respectively, (∆X) is the vector used to express the translation of the origin of coordinates, R is the rotation matrix, and µ is a scaling factor. It is worth noting that the scaling factor is not considered by several authors [40].
Although three is the minimum number of points that is required, a set of four points is recommended. Several point-cloud management programs, such as Leica Cyclone, allow as many points as desired to be considered, although only those that provide a better adjustment will be applied. It is worth noting that other singular features appearing in two or more scans can be applied to align them (corners in facades, windows, or doors); however, the results will offer a lower quality with respect to those obtained with standardized references. There are propagations of error models for direct and indirect georeferencing, which also include other sources of error [40,41]. The data quality indicator is the positioning accuracy of the 3D coordinates of a point in the external coordinate system, which is described by a variance-covariance matrix that is designed for each specific case.
From a general point of view, it is worth mentioning the main outputs which can be obtained from TLS data: The point-clouds themselves (after the processes of registering, georeferencing, cleaning, unifying, and decimation if needed), meshes, infographics, ortho-images, and videos of virtual itineraries. The point-clouds can be considered as a final product by themselves, but they can be adopted as the basis to generate meshes and, therefore, triangulated or even texturized models.
These meshed models and the graphical outputs that they can provide constitute a second source of final products. Hence, infographics, orthoimages, and virtual itineraries can be obtained from them, too. Anyway, the list of available alternatives does not conclude with those previously mentioned, as an adequate treatment with specific software permits the inclusion of triangulated models in interactive Portable Document Format files (PDFs), easing the distribution and visualization of information, or even the implementation of interactive applications.
These products offer a great potential for the enhancement of geological heritage, as their simplicity of use and access can help to promote the properties or sites through the 2.0 platforms. These outputs can ease the management of the sites in the case of tourism activities. Virtual itineraries and interactive applications can be suitable tools for training both skilled and recent employees, improving their knowledge about the geometry and features of the asset. They are valuable for the management of emergences, as georeferenced point-clouds constitute a reliable source of information about the most useful routes to reach a certain location. Despite some restrictions associated with the size of files or the impossibility to import the radiometric/colorimetric information with some common software programs, such as Autocad or Microstation, the development of 2D cartography is available. The logic evolution of this sort of computer programs will increase the application of this technology in projects of enhancement, although a complete replacement of other surveying techniques is not likely in a close future.
Scheme 1 shows a workflow proposal for data management that is derived from the experience gathered by the authors during the development of this work and some other campaigns aimed at capturing mining and geological heritage assets [19]. The scheme summarizes the different itineraries that can be followed to obtain the outputs mentioned. However, the order could be altered. For example, a point-cloud can be initially cleaned, exported, and imported again before developing the subsequent step, so as to adopt it as the basis for any other operation instead of the raw point-cloud. This sequence can avoid further filtering, but requires special care, as this simplification could imply erasing any standardized or geometrical reference by mistake, compromising the stages of alignment/registering and geo-reference. Different software programs can be introduced as tools for the development of this management process, and this is the main reason why the observance of an adequate migration in terms of compatibility of file formats is required.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 7 of 21 These products offer a great potential for the enhancement of geological heritage, as their simplicity of use and access can help to promote the properties or sites through the 2.0 platforms. These outputs can ease the management of the sites in the case of tourism activities. Virtual itineraries and interactive applications can be suitable tools for training both skilled and recent employees, improving their knowledge about the geometry and features of the asset. They are valuable for the management of emergences, as georeferenced point-clouds constitute a reliable source of information about the most useful routes to reach a certain location. Despite some restrictions associated with the size of files or the impossibility to import the radiometric/colorimetric information with some common software programs, such as Autocad or Microstation, the development of 2D cartography is available. The logic evolution of this sort of computer programs will increase the application of this technology in projects of enhancement, although a complete replacement of other surveying techniques is not likely in a close future.
Scheme 1 shows a workflow proposal for data management that is derived from the experience gathered by the authors during the development of this work and some other campaigns aimed at capturing mining and geological heritage assets [19]. The scheme summarizes the different itineraries that can be followed to obtain the outputs mentioned. However, the order could be altered. For example, a point-cloud can be initially cleaned, exported, and imported again before developing the subsequent step, so as to adopt it as the basis for any other operation instead of the raw point-cloud. This sequence can avoid further filtering, but requires special care, as this simplification could imply erasing any standardized or geometrical reference by mistake, compromising the stages of alignment/registering and geo-reference. Different software programs can be introduced as tools for the development of this management process, and this is the main reason why the observance of an adequate migration in terms of compatibility of file formats is required. Scheme 1. Workflow proposal for data management according to the desired outputs and functions.

Ceuta and the Caliphal Gate
Ceuta ( Figure 2) is a Spanish autonomous city on the Northern Coast of Africa, neighboring with Scheme 1. Workflow proposal for data management according to the desired outputs and functions.

Ceuta and the Caliphal Gate
Ceuta ( Figure 2) is a Spanish autonomous city on the Northern Coast of Africa, neighboring with Morocco. It is 14 miles away from Cádiz and, according to the Spanish National Institute of Statistics, its population was 84,913 inhabitants in January, 2018 [42]. Its extension is 18.5 km 2 . The first evidences of human occupation in the area have an age of about 270,000 years, although the current urban core has been inhabited for 2700 years [43]. Given its strategic position on the southern side of the Strait of Gibraltar, it is possible to trace several historical periods of colonization or domain: Phoenicians, Mauritanians, Romans, Byzantines, Muslims, Portugal, the Iberian Union, and finally, Spain.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 8 of 21 its population was 84,913 inhabitants in January, 2018 [42]. Its extension is 18.5 km 2 . The first evidences of human occupation in the area have an age of about 270,000 years, although the current urban core has been inhabited for 2700 years [43]. Given its strategic position on the southern side of the Strait of Gibraltar, it is possible to trace several historical periods of colonization or domain: Phoenicians, Mauritanians, Romans, Byzantines, Muslims, Portugal, the Iberian Union, and finally, Spain.
(a) (b) The necessities of defense related to its location implied the construction of walls around the city. The Caliphal Gate ( Figure 3) is a reminiscence of the medieval defensive wall that was hidden by the subsequent works that configured the royal walls of Ceuta (Figure 2b), which were declared an asset of cultural interest as historical ensemble in 1985. The necessities of defense related to its location implied the construction of walls around the city. The Caliphal Gate (Figure 3) is a reminiscence of the medieval defensive wall that was hidden by the subsequent works that configured the royal walls of Ceuta (Figure 2b It is thought that Romans built the first closures, but no remains of walls have been found to confirm it. The construction of the medieval wall that surrounded the Islamic medina (with the main religious and politic buildings, wealthy residences, and other facilities, such as baths) was started by Abd al Rahman III and finished by his son, al Hakam, in 962 [44]. Although the basic layout of this defensive structure was maintained until 1541, it suffered severe damages through the Portuguese siege (1415). Those circumstances made it necessary to accomplish great works to guarantee the security of the site.
On June 28 2002, the Caliphal Gate and part of the medieval barrier were discovered during a visit inside the part of the royal walls that communicates with the National Tourism Parador "La Muralla", which was inaugurated in 1967. In fact, the archaeological site itself, with a total surface of about 60 m 2 , was used as a cellar of the hotel. This visit was one of the activities of a congress about fortifications [45]. Until that date, it was commonly thought that the construction of the scarp of the royal moat (1541-1549), which belongs to the structures known as the Portuguese ramparts [46], had removed any remain of the Caliphal Wall. This discovery demonstrated that part of it was applied as a reinforcement to construct the subsequent ramparts. In fact, it was comprised between the scarp and the inner vaults that were built in 1724 [47] under the Spanish domain. The Caliphal Gate and Wall are not the only interesting elements in the site from a historical point of view: Between 2003 and 2009, five campaigns of excavations found Roman remains from the I to the III century A.D., such as an impermeabilized circular structure which was connected to a sewage, a pit excavated in gneiss, or pottery [48]. Slags that were used to level the floor during the period of use and construction of the Renaissance structures were also found. It is thought that Romans built the first closures, but no remains of walls have been found to confirm it. The construction of the medieval wall that surrounded the Islamic medina (with the main religious and politic buildings, wealthy residences, and other facilities, such as baths) was started by Abd al Rahman III and finished by his son, al Hakam, in 962 [44]. Although the basic layout of this defensive structure was maintained until 1541, it suffered severe damages through the Portuguese siege (1415). Those circumstances made it necessary to accomplish great works to guarantee the security of the site.
On June 28 2002, the Caliphal Gate and part of the medieval barrier were discovered during a visit inside the part of the royal walls that communicates with the National Tourism Parador "La Muralla", which was inaugurated in 1967. In fact, the archaeological site itself, with a total surface of about 60 m 2 , was used as a cellar of the hotel. This visit was one of the activities of a congress about fortifications [45]. Until that date, it was commonly thought that the construction of the scarp of the royal moat (1541-1549), which belongs to the structures known as the Portuguese ramparts [46], had removed any remain of the Caliphal Wall. This discovery demonstrated that part of it was applied as a reinforcement to construct the subsequent ramparts. In fact, it was comprised between the scarp and the inner vaults that were built in 1724 [47] under the Spanish domain. The Caliphal Gate and Wall are not the only interesting elements in the site from a historical point of view: Between 2003 and 2009, five campaigns of excavations found Roman remains from the I to the III century A.D., such as an impermeabilized circular structure which was connected to a sewage, a pit excavated in gneiss, or pottery [48]. Slags that were used to level the floor during the period of use and construction of the Renaissance structures were also found.

Main Areas of Work
The 3D model was developed according to three main units. The first one was the Royal Walls unit (Figure 4a), which was observed by describing an itinerary that started on the bailey, descended to the archaeological complex of Caliphal Gate (Figure 4b), and finally reached the outside of the National Parador by passing through it. The units two and three were located in the Caves of "El Moro" and "El Candelero" (Figure 4c). These two vaults are enclosed within the Royal Walls, and were represented in two independent models, which were referred to according to local coordinates.

Main Areas of Work
The 3D model was developed according to three main units. The first one was the Royal Walls unit (Figure 4a), which was observed by describing an itinerary that started on the bailey, descended to the archaeological complex of Caliphal Gate (Figure 4b), and finally reached the outside of the National Parador by passing through it. The units two and three were located in the Caves of "El Moro" and "El Candelero" (Figure 4c). These two vaults are enclosed within the Royal Walls, and were represented in two independent models, which were referred to according to local coordinates.

Results of the Previous Works: Micro-Geodetic Network
After defining the main areas of work, six vertices were located on the bailey (101 to 106), two support points were set on the National Parador (343, 341), two other vertices on the surveillance

Results of the Previous Works: Micro-Geodetic Network
After defining the main areas of work, six vertices were located on the bailey (101 to 106), two support points were set on the National Parador (343, 341), two other vertices on the surveillance path of the counterscarp (601, 603), and a last vertex on the Weapon Square (602). Figure 5 shows their location, and Table 1 lists their coordinates.  The accuracy of the network had to be enough to guarantee the coherence with the subsequent representation of the 3D model, considering a scale of 1:500. The vertices of the micro-geodetic network and the support points were referred to with respect to the permanent station in Ceuta Heliport, which belongs to the National Network of Reference Stations (ERGNSS) and the European Network of Permanent Stations (EUREF, EPN). Two GPS devices were used to observe in RTK mode, recording the coordinates of each basis four times. Final coordinates were obtained by calculating the average of the observed values, as long as the difference between them was lesser than 3.5 cm. This value can be assumed as the accuracy provided for the absolute coordinates of the point-clouds that were produced, and it is sufficient for most works in the fields of topography and cartography. However, 4 mm can be offered as the accuracy provided by TLS for simple measurements when working in relative coordinates.  The accuracy of the network had to be enough to guarantee the coherence with the subsequent representation of the 3D model, considering a scale of 1:500. The vertices of the micro-geodetic network and the support points were referred to with respect to the permanent station in Ceuta Heliport, which belongs to the National Network of Reference Stations (ERGNSS) and the European Network of Permanent Stations (EUREF, EPN). Two GPS devices were used to observe in RTK mode, recording the coordinates of each basis four times. Final coordinates were obtained by calculating the average of the observed values, as long as the difference between them was lesser than 3.5 cm. This value can be assumed as the accuracy provided for the absolute coordinates of the point-clouds that were produced, and it is sufficient for most works in the fields of topography and cartography. However, 4 mm can be offered as the accuracy provided by TLS for simple measurements when working in relative coordinates.

Point-Clouds
For this work, 23 scans were acquired, with 427 million points and a total size of 23.5 GB. Had the complete set of scans been taken, it would have been necessary to register them as a single point-cloud. As mentioned in Section 2.2.3., the whole set can be referred to according to one of the point-clouds, or geo-referred with respect to an absolute system.
In order to develop this procedure, it was necessary to apply a software tool that allowed the algorithm for this transformation to be defined. In this case, as it has been previously mentioned, ETRS89 was adopted as the universal system of reference. Leica Cyclone was applied for the transformation of coordinates. This specialized software offers great advantages when working with point-clouds obtained by using devices from the same manufacturer, although it allows for files acquired with TLSs developed by other companies to be imported.
After choosing the tool for the primary management of the point-clouds, the micro-geodetic network of vertices and the support points had to be considered in order to determine the correspondences between the registered references within the point-clouds, and their homologues in reality. Hence, it was possible to set the conditions that were needed for the aimed transformations.
The registering process is characterized by the generation of data bases to allocate the model spaces that are generated from a single scan, or by the junction of two or more. This is a process that requires the development of intermediate nested workspaces to integrate the different scans that were acquired during the fieldwork. As final steps, the georeferencing, cleaning, and depuration of the previously registered point-clouds can be mentioned. This process generates projects that increase the already intensive requirements of available memory to storage them. It is worth mentioning that, after importing the files, developing the first tempting registers, and developing the final georeferenced joins previous to exportation, the absolute size of the data base associated to the project was 90.1 GB.

Meshes
Given the great amount of data associated to the point-clouds, the initial step that was followed to obtain the triangulated 3D model implied the analysis of the main available alternatives. Reconstructor and Geomagic Rapidform were considered as the most suitable tools for this work. Most of the management was developed with the latter, while the first one was applied to achieve an intelligent partition of the general model, so as to obtain uniform sections in terms of size, and to optimize the management of data. After the initial importation and adequation of files with Reconstructor, a step of filtering was followed to enhance the definition of the elements, and the point-clouds were meshed, reducing the empty areas that were not accessible for the TLS to scan, due to the geometry of the spaces and its relative location with respect to the device. Afterwards, the individual sections were joined as a single entity. The final step implied the exportation of the digital model to a compatible *.ply file. An effective routine for the treatment of point-clouds and meshes had to observe the kind of intermediate files that it generated, since problems of compatibility are common even with file formats that should be accepted without problems by post-processing programs, as declared in their specification sheets.
Considering the first and main unit of this work, which includes the Caliphal Gate, the mesh was divided into 13 archives to ease its management, with a total size of 3.01 GB. Another lighter version was exported, with a size of 494 MB. The treatment of the files belonging to the Caves ("El Moro" and "El Candelero") followed the same steps, but they were exported as auto-executable files.

Other Outputs of Interest
Treated point-clouds and meshes are the basis for the development of a set of outputs that imply important benefits for the management and broadcast of the cultural asset that is modeled. In this case, orthoimages, virtual itineraries, and an interactive application were the main products.

Orthoimages
Eight orthoimages were obtained from the unified point-cloud (Figure 6), and the other five from the meshed model (Figure 7a). These images show elements of special interest within the archaeological site, such as the Caliphal Gate or the original patterned medieval paintings on one of its side walls (Figure 7b). The tools that were applied to generate these orthoimages differed when working with point-clouds or meshes, although the process was the same in both cases. In this work, orthoimages from point-clouds were obtained with Leica Cyclone, and Geomagic Rapidform was applied for those that were generated from meshes. Considering the process of obtention, the first step implied selecting the area of interest. After that, a reference plane was defined. This plane had to be significant for the element that is needed to represent. Orthographic projection was selected to obtain the image: Given the fact that the projective rays are parallel in this perspective, any distortion associated with the viewer's position or that of the element was avoided. A virtual camera had to be perpendicularly placed with respect to the reference plane (and therefore, to the element itself). After following these steps, the elements that were

Virtual Itineraries
Software tools applied for the management and meshing of the point-clouds allow the possibility to set itineraries to be followed by a virtual viewer of a certain height. The process that is needed to follow in order to define these itineraries implies locating a series of individual virtual cameras, which will act as nodes or sights comprised by the itinerary. It is worth noting that the height is not needed to be a constant. This contributes to varying the experience associated with the visualization of the video, which is the final format of the itinerary. Hence, it is possible to emulate the point of view of a potential visitor to the archaeological site or, for example, to get the perspective of a drone that flew through the asset.
After defining the different locations for the virtual camera, it is necessary to generate a spline curve that contains them (Figure 8a). This curve is representative of the viewer's displacement through the model, and it conditions the final result. The definition of the curve must be accurate enough to guarantee an adequate feeling of realism: Effects such as penetration through walls should be avoided to increase it. An adequate definition of the itinerary can simulate the rotation of the whole model or of certain parts of special interest, thus providing important and non-exclusively geometric information in a fast and intuitive way.
Had the itinerary been defined, it would have been necessary to define aspects such as the speed of the displacement, or other desired features of the exported video (such as the grade of compression or the dimensions or format of the screen).
Considering this work, eight different videos were developed, six of them from the basis of the point-clouds (Figure 8b), and two more from the meshes. The process to generate the latter two was the same as the one described for point-clouds. These videos had durations from 1:00 to 1:30 min, and sizes between 788 MB and 2.37 GB. In addition to them, another itinerary was developed from the meshed model, with a length of 4:20 and a size of 1.84 GB (Figure 8). The main aim of these videos was the dissemination of the site, and the documentation of the state of the works of enhancement in an intermediate stage. Two main types of videos were generated. The first one was based in the generation of rotations. Hence, three different files were generated. The first one implied the rotation of the whole point-clouds set, including those taken outside the complex. The second video included the indoor complex and part of the royal walls. It was particularly appreciated by the archaeologist, as it provided an idea of the location and distribution of the asset within the walls. The third one, Considering the process of obtention, the first step implied selecting the area of interest. After that, a reference plane was defined. This plane had to be significant for the element that is needed to represent. Orthographic projection was selected to obtain the image: Given the fact that the projective rays are parallel in this perspective, any distortion associated with the viewer's position or that of the element was avoided. A virtual camera had to be perpendicularly placed with respect to the reference plane (and therefore, to the element itself). After following these steps, the elements that were included within the screen should be exported to a suitable format.

Virtual Itineraries
Software tools applied for the management and meshing of the point-clouds allow the possibility to set itineraries to be followed by a virtual viewer of a certain height. The process that is needed to follow in order to define these itineraries implies locating a series of individual virtual cameras, which will act as nodes or sights comprised by the itinerary. It is worth noting that the height is not needed to be a constant. This contributes to varying the experience associated with the visualization of the video, which is the final format of the itinerary. Hence, it is possible to emulate the point of view of a potential visitor to the archaeological site or, for example, to get the perspective of a drone that flew through the asset.
After defining the different locations for the virtual camera, it is necessary to generate a spline curve that contains them (Figure 8a). This curve is representative of the viewer's displacement through the model, and it conditions the final result. The definition of the curve must be accurate enough to guarantee an adequate feeling of realism: Effects such as penetration through walls should be avoided to increase it. An adequate definition of the itinerary can simulate the rotation of the whole model or of certain parts of special interest, thus providing important and non-exclusively geometric information in a fast and intuitive way.
to be followed by the cameras allowed routes that are not limited to those that would be followed by a visitor to be established, as it was possible to adopt more creative options, including flights. In this case, the two options were explored: The most realistic one considered the simulation of a visitor's walkthroughs (e.g., starting from the allure, going down through the site, and reaching the outside by crossing the National Parador), while the second alternative implied the introduction of flights (crossing the channel and getting into the site through a window, or within the inner complex).

Interactive Application
One of the most interesting outputs obtained from the 3D model was the interactive application ( Figure 9), which can be considered as the natural next step to be taken in order to enhance the user's experience, as the possibility to decide the way to be followed through the 3D scenery is enabled. Had the itinerary been defined, it would have been necessary to define aspects such as the speed of the displacement, or other desired features of the exported video (such as the grade of compression or the dimensions or format of the screen).
Considering this work, eight different videos were developed, six of them from the basis of the point-clouds (Figure 8b), and two more from the meshes. The process to generate the latter two was the same as the one described for point-clouds. These videos had durations from 1:00 to 1:30 min, and sizes between 788 MB and 2.37 GB. In addition to them, another itinerary was developed from the meshed model, with a length of 4:20 and a size of 1.84 GB (Figure 8). The main aim of these videos was the dissemination of the site, and the documentation of the state of the works of enhancement in an intermediate stage. Two main types of videos were generated. The first one was based in the generation of rotations. Hence, three different files were generated. The first one implied the rotation of the whole point-clouds set, including those taken outside the complex. The second video included the indoor complex and part of the royal walls. It was particularly appreciated by the archaeologist, as it provided an idea of the location and distribution of the asset within the walls. The third one, which can be found online [49], comprised the rotation of the gate itself. The rest of the videos were designed as itineraries through the site. The liberty that this alternative offered when setting the paths to be followed by the cameras allowed routes that are not limited to those that would be followed by a visitor to be established, as it was possible to adopt more creative options, including flights. In this case, the two options were explored: The most realistic one considered the simulation of a visitor's walkthroughs (e.g., starting from the allure, going down through the site, and reaching the outside by crossing the National Parador), while the second alternative implied the introduction of flights (crossing the channel and getting into the site through a window, or within the inner complex).

Interactive Application
One of the most interesting outputs obtained from the 3D model was the interactive application ( Figure 9), which can be considered as the natural next step to be taken in order to enhance the user's experience, as the possibility to decide the way to be followed through the 3D scenery is enabled.
The main aim of this output was the dissemination of the asset with a tool that provides a higher grade of freedom to move through the site. These products can be adapted for different purposes, such as their presentation in tourism exhibitions, their online diffusion as browser applications, or their implementation in specially enabled rooms in visitor, museums, or interpretation centers. The sizes of the files applied to obtain the interactive application were optimized without compromising the chromatic information. In order to achieve this reduction, the following steps were taken. The chromatic information was translated into a texture map, so as to increase the quality of the information obtained from the pictures provided by the TLS camera, and the texture quality was enhanced by modifying the RGB levels, the contrast, brightness, etc.). The polygonal mesh was optimized by a procedure of smart-decimation: The original density of polygons was maintained in curved and complex areas, while it was reduced in plane surfaces. After that, the texture maps were applied onto the optimized meshes. When this treatment of reduction and optimization was finished, the meshes were pre-processed with the software Blender. Several adjustments of scale, position, and orientation were done, and the texture and UV maps were verified. Minor defects of the mesh, such as gaps in the mesh due to the absence of points, were filled. The next step implied the use of the The main aim of this output was the dissemination of the asset with a tool that provides a higher grade of freedom to move through the site. These products can be adapted for different purposes, such as their presentation in tourism exhibitions, their online diffusion as browser applications, or their implementation in specially enabled rooms in visitor, museums, or interpretation centers. The sizes of the files applied to obtain the interactive application were optimized without compromising the chromatic information. In order to achieve this reduction, the following steps were taken. The chromatic information was translated into a texture map, so as to increase the quality of the information obtained from the pictures provided by the TLS camera, and the texture quality was enhanced by modifying the RGB levels, the contrast, brightness, etc.). The polygonal mesh was optimized by a procedure of smart-decimation: The original density of polygons was maintained in curved and complex areas, while it was reduced in plane surfaces. After that, the texture maps were applied onto the optimized meshes. When this treatment of reduction and optimization was finished, the meshes were pre-processed with the software Blender. Several adjustments of scale, position, and orientation were done, and the texture and UV maps were verified. Minor defects of the mesh, such as gaps in the mesh due to the absence of points, were filled. The next step implied the use of the software Unity 3D to place the meshes in the scenery, to configure and assign materials and lighting, and to determine the itinerary and interaction with the user. Although according to the requirements of the project in this particular case they were not required, additional elements such as texts, images, or other information could be added. After concluding the ambiance, the stage of publishing started. The web player project (159 MB) and the *.exe file (551 MB) were compiled, along with the final tests, before closing the project.

Discussion
Three-dimensional models obtained by means of TLS, on which technicians can rely to establish plans for conservation and exploitation of archaeological heritage, are characterized by rigorous metrics. They must be supported by point-clouds made with sufficient quality from both the instrumental and methodological point of view. In this sense, the previous works carried out to provide a single system of reference, the design of a good observation (especially in the case of confined spaces), the selection of an optimal resolution, and an adequate methodology for the alignment/registration are fundamental to guarantee that the propagation of the error is as small as possible, and to maximize the representativeness of the model, as it has been justified in previous sections.
Given the size of the point-clouds, it is necessary to decide among several options of hardware and software for their management. This research provided a workflow for the management and generation of the outputs and suggested some suitable programs, although they are not the only available options. In this sense, Leica Cyclone, Reconstructor, Geomagic Rapidform, and Blender were applied for the processing of point-clouds and generation of meshes. Considering a practical application of the obtained outputs by the final user, it is worth discussing the possibilities associated with open-source alternatives to view, manage, and share them, as they are affordable options that can avoid the necessity to adopt other specific tools. Alternatives such as CloudCompare or MeshLab are interesting freeware options to process point-clouds and meshes, respectively. The first one is particularly useful for the visualization of point-clouds, and it allows distances or angles to be measured. The second option is a valuable open-source option of the management of meshes, as it offers several algorithms for their treatment, which can be more or less adequate, according to the characteristics of the model. However, MeshLab shows a higher limitation in terms of the maximum number of points that can be managed with respect to CloudCompare. The difficulty to work with absolute coordinates is an important inconvenience to take into account in both cases, although this problem is not exclusive for open-source software. It is related to the use of 32-bit floating variables [19], which is today common for many management and meshing programs, and also for current graphic cards. However, CloudCompare counts with an effective system to translate coordinates, which permits limiting the amount of significative numbers to consider when working with point-clouds. These options offer other practical advantages for the final user, such as the possibility to calculate volumes, or the different algorithms that they offer for the generation of surfaces.
The previously described software allows models, orthoimages, and virtual itineraries to be generated from the point-clouds, but the adoption of the meshes for their development provides more tangibility and a higher degree of immersion in the element or environment represented, with the obtention of photorealistic models that maintain the metric fidelity. In this sense, these results can be useful for all the stages of conservation and enhancement of the heritage assets, given the fact that the geometric information is suitable for the development of any project of enhancement, or for the development of any constructive solution for the enablement of access, that is compatible with the integrity of the site or element. Another way to use this type of products is their application for marketing and dissemination initiatives, since a virtualization of the site implies a first approach to potential visitors. Virtual tours and itineraries can be designed and aimed at different platforms and social targets, and therefore their level of interactivity can vary, depending on the final product, either video, interactive PDF, or interactive application. All these options provide a way for improving communication between the promoting organism and society, constituting interaction channels that were unimaginable a relatively short time ago, such as social networks, through multimedia products that allow for the enrichment and dynamization of their profiles.
Considering the practical case of this research, a methodology of observation was developed to guarantee an optimal 3D model from the point of view of quality, which was focused more on the metric approach than on the chromatic aspects. A workflow was implemented to process the data obtained as a result of the designed methodology. Finally, we completed an analysis of products and sub-products that could be generated from the point-clouds and meshes, along with their potential application in the field of conservation, enhancement, and dissemination of archaeological heritage.
The discussion of the aspects that could be improved in this research should focus on the degree of definition of the point-clouds, which was not uniform and was strongly conditioned by the relative location of the available points for the observations, and the archaeological complex itself. In addition to this, given the necessities of the operating organism, metrics were emphasized over chromatic aspects. Due to this, no complementary cameras to the one of the TLS were applied. The use of such devices would have improved the quality of textures, and therefore the realism of the model. Despite this and the variation of lighting conditions through the observation, the quality of the outputs that were obtained for conservation and the potential dissemination of the heritage asset were considered as sufficient.

Conclusions
Virtual models provide a better comprehension of actual objects, and they imply an interesting option for the solution of problems in many scientific disciplines, such as archaeology. However, TLS surveying procedures and the subsequent data management require workflows that are not formally established today. This research was focused on establishing a proposal for these workflows.
A methodological strategy for data capture when working in archaeological sites, which are commonly characterized by being difficult to observe, has been set. This allows for registering data with sufficient quality.
A collection of different software programs, for both managing point-clouds and generating outputs, has been presented. The possibilities for the application of open-source programs by the final user have been emphasized, as the availability of this type of tools eases the access to the information.
The results that were generated have been the basis for the analysis of potential outputs that can be suitable for conservation, enhancement, and dissemination of the assets.
The works that have been developed in this research are aimed at setting the previously mentioned workflow for the generation of a 3D model of an archaeological site (the Caliphal Gate and its immediate surroundings), which allows the historiographic analysis of the complex to continue. This progress permits simulating and assessing any intervention, and provides a series of different sub-products for the broadcast of the site, as has been described.