## 3 Proposed Procedure
### Texture Mapping Process
#### 3.3.2 Texture Merging  
The texture merging algorithm involves combining multiple GeoTIFF tile files into a single large-scale GeoTIFF. This process focuses on maintaining coordinate system consistency while aligning pixel data and correctly positioning them within the merged dataset. The process consists of five main stages: overall boundary calculation, merged dataset creation, tile data reading and merging, GeoTransform definition, and merged GeoTIFF generation.  
Overall Boundary Calculation: the geographical boundaries of each GeoTIFF tile are analyzed to determine the total size and boundaries of the merged dataset.  
The GeoTIFF files' GeoTransform structure is as follows in Table 9:  
Calculate tile minimum/maximum boundaries using _GeoTransform_ values.  
\[x_{min}=\textit{GeoTransform}[0]\]  
\[y_{max}=\textit{GeoTransform}[3]\]  
\[x_{max}=x_{min}+\textit{GeoTransform}[1]\cdot\textit{Raster Width}\]  
\[y_{min}=y_{max}+\textit{GeoTransform}\;[5]\cdot\textit{Raster Height}\]  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**No.** & **Index** & **Element Name** & **Description** \\ \hline
1 & GeoTransform [0] & x\_min & Upper-left x coordinate of \\  & & & image \\
2 & GeoTransform [1] & x\_scale & Pixel size in x direction \\
3 & GeoTransform [2] & x\_rotation & Default 0 if no rotation \\
4 & GeoTransform [3] & y\_max & Upper-left y coordinate of \\
5 & GeoTransform [4] & y\_rotation & Default 0 if no rotation \\
6 & GeoTransform [5] & y\_scale & Pixel size in y direction \\ \hline \hline \end{tabular}
\end{table}
Table 9: Description of GDAL GeoTransform Structure.  
Figure 6: GeoTIFF export and coordinate validation in QGIS 3.34.7.  
Calculate the overall extent (_overallExtent_) by comparing the minimum and maximum coordinates of all tiles. \[overallExtent[0]=min(minX\ values)\] \[overallExtent[1]=min(minY\ values)\] \[overallExtent[2]=max(maxX\ values)\] \[overallExtent[3]=max(maxY\ values)\]
* Merged Dataset Creation: the merged GeoTIFF dataset is generated based on the overall boundary.
* Pixel size is calculated using _GeoTransform_ values, and a memory-based dataset is created using the GDAL library, initializing resolution, data type, and number of bands. \[totalWidth=\frac{overallExtent[2]-overallExtent[0]}{GeoTransform[1]}\] \[totalHeight=\frac{overallExtent[3]-overallExtent[1]}{GeoTransform[5]}\]  
Tile Data Reading and Merging: the _GeoTransform_ values of each tile are read to calculate appropriate positions in the merged dataset.  
\[x_{offset}=\frac{x_{tile\_min}-overallExtent[0]}{GeoTransform[1]}\]  
\[y_{offset}=\frac{overallExtent[3]-y_{tile\_max}}{GeoTransform[5]}\]  
Pixel data from each tile are read and written to the corresponding location in the merged dataset. Overlapping data between tiles are handled through a simple overwriting approach by subsequent tiles.  
* GeoTransform Definition: the GeoTransform array for the merged dataset is defined based on overall boundary values and pixel sizes.
* Merged GeoTIFF Generation: The merged data are saved as a final GeoTIFF file, including metadata (coordinate system, boundaries, resolution, etc.). The resulting GeoTIFF file is compatible with software such as QGIS 3.34.7.