# Semi-Automatic Method of Extracting Road Networks from High-Resolution Remote-Sensing Images
## 2 Materials and Methods
### Methodology
#### 2.2.1 Interactive Single-Road Extraction
For each segment, two consecutive nodes A and B adjacent to endpoint C are selected, and \(\theta\) is the angle between the vectors \(\overline{\text{BA}}\) and \(\overline{\text{AC}}\). Endpoint C is retained when \(\theta<10^{\circ}\). Otherwise, it is deleted along with the overly short segment, shown in red in \[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]6 Figure 8b,d show the results of road segment optimization. To connect the optimized segments into an entire road, a road connection algorithm is designed. The connection rules include rules governing the distance between endpoints and the angle between vectors. If two segments meet the connection rules, the endpoints are connected. The rule governing the distance between endpoints is defined as follows: first, the distance between two endpoints must be the shortest globally. Second, considering the continuous and uninterrupted characteristics of a road, we again choose \(\mathrm{d_{t}}\) as the distance threshold for connection. The distance between two connected endpoints should be less than \(\mathrm{d_{t}}\). Furthermore, considering the smoothness of a specific road, the rule governing the angle between vectors is defined as shown in \[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]7 Black solid lines show the segments, black dotted lines show their extensions, and blue dashed lines indicate the horizontal-right direction. If the endpoints A and B of the road segment meet the distance rule, then we find the nodes A\({}^{\prime}\) and B\({}^{\prime}\) adjacent to the endpoints A and B. \(\theta_{1}\) and \(\theta_{2}\) (\(\theta_{1},0_{2}\in(0^{\circ},180^{\circ}]\)) are the angles between the vectors A\({}^{\prime}\)A and B\({}^{\prime}\)B and the horizontal-right direction, respectively, and \(\theta=|\theta_{1}-\theta_{2}|\). If \(\theta>90^{\circ}\), the endpoints are connected. The connection line is shown in red. \[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]8 Optimizing segments: (**a**,**c**) show vectors with offset problems; (**b**,**d**) are the respective results of endpoint modification. \[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]9 Angle rule between vectors: (**a**) the two vectors are on the same side of the horizontal line; (**b**) the two vectors are on opposite sides of the horizontal line. Figure 3:0 Endpoint modification. FindVertex (Lines) is used to find the endpoint of the segment. FindVertexAzimuth (Lines) is used to calculate the angle between the end vector and the horizontal-right direction. ConnectedPt stores the number of connected vertices. The isinConnectedPt(i, connectedpt) function is used to determine whether the currently numbered vertex i has been connected; isinSameLine(Ver(i), Ver(j)) is used to judge whether the two vertices are on the same road segment; cal_Distance(Ver(i), Ver(j)) is used to calculate the Euclidean distance between two vertices; findLinefromVer(Ver(i)) is used to find the corresponding road segment through vertex Ver(i); and JudgeConnectOrder(L1, L2, & Line1, Temp_line, & Line2) is used to determine the connection order. The combine function connects segments. ChangeLine(L1, Line1, & Lines) is used to reset lines and deleteLine(L2, & Lines) is used to delete redundant segments. Figure 11 shows the connection results of single roads, in which (a) and (c) depict two roads to be connected. The middle part of each road is divided into two sections due to tree occlusion, and this cannot be repaired by the morphological closing algorithm; (b) and (d) show the road connection results.