An Optimization Technique of the 3D Indoor Map Data Based on an Improved Octree Structure

*e construction and retrieval of indoor maps are important for indoor positioning and navigation. It is necessary to ensure a good user experience while meeting real-time requirements. Unlike outdoor maps, indoor space is limited, and the relationship between indoor objects is complex which would result in an uneven indoor data distribution and close relationship between the data. A data storage model based on the octree scene segmentation structure was proposed in this paper initially. *e traditional octree structure data storage model has been improved so that the data could be backtracked. *e proposed method will solve the problem of partition lines within the range of the object data and improve the overall storage efficiency. Moreover, a data retrieval algorithm based on octree storage structure was proposed. *e algorithm adopts the idea of “searching for a point, points around the searched point are within the searching range.” Combined with the octree neighbor retrieval methods, the closure constraints are added. Experimental results show that using the improved octree storage structure, the retrieval cost is 1/8 of R-tree. However, by using the neighbor retrieval, it improved the search efficiency by about 27% on average. After adding the closure constraint, the retrieval efficiency increases by 25% on average.


Introduction
Nowadays, people have higher requirements for using the electronic map due to the popularization of electronic map application and the rapid development of related technologies. e traditional two-dimensional map cannot meet the latest requirements in terms of visual effects. Surveys showed that people are spending more time in indoor environment nowadays, including shopping malls, exhibition halls, libraries, cruise ships, and many other large-scale indoor environments [1]. e existence of three-dimensional indoor map is of practical significance [2]. Data storage efficiency, retrieval consumption, time delay, and other parameters will directly affect the application level of the maps [3]. Consequently, the efficient management of the indoor map data has become a major challenge.
At present, all walks of life, including the fields of map, are faced with the problem that huge data is difficult to store and complex to query [4]. Since the data sets of a map scene are very large, they are not able to be stored directly by the indexes. erefore, a scene segmentation method is needed as a secondary index to reduce the data storage unit and achieve the lightweight storage. Generally speaking, due to the different environment, maps can be divided into outdoor maps and indoor maps. e regional segmentation technology is preferable as the outdoor scene is large and uneven, and the map data is stored as sheet. Compared with the outdoor map, the indoor map includes numerous objects, and the volume of the objects is small. e situation of uneven distribution often exists. If the sheet framing is used, a large number of objects may be distributed in a sheet. is extreme situation will reduce the regional segmental effect. In order to solve this problem, it is necessary to continue the segmentation, which will increase the cost of scene segmentation. e sheet framing cannot meet the vertical requirement between different floors and cannot preserve the three-dimensional nature of the data. e technology of the storage of outdoor map data has developed rapidly, while the indoor map data storage is still in the initial stage [5] of development. For the indoor data storage, the scene can be divided by tree structure, and the octree is one of the high-efficiency scene segmentation methods, which can realize the rapid segmentation of 3D map scene and retain the characteristics of map data [6]. However, at present, this method is mainly applied in the field of game scene and 3D image processing, and there are few applications for indoor map. Moreover, indoor map data is updated more frequently, and there are room partitions between the data. erefore, the traditional scene segmentation methods are not applicable for the indoor map data [7]. One of the key problems is to design a set of storage structure suitable for indoor map features based on fast scene segmentation method. e efficiency of the octree structure in the scene segmentation is very high. However, its performance in data retrieval is not ideal. After scene segmentation using octree structure, map data will be stored in corresponding nodes. We need to traverse every required data tree, so the efficiency of querying and updating indoor map data is not high. is leads to another key problem, which is improving the efficiency of data retrieval and ensuring high storage efficiency.
In this paper, a set of indoor map data storage model based on the scene segmentation is designed, which can fulfill the scene segmentation, code design, data expression, and storage structure design. And a fast data retrieval method based on the data storing models is also proposed.
ese results provide an efficient data storage and retrieval scheme.

Related Works
At present, map data processing software (such as ArcGIS) or domestic emerging software (including SuperMap) mostly adopt the scene segmentation for data unit division and form a map data index structure. e ArcGIS SDE of Esri supports fixed grid scene segmentation structure, while MapGIS and SuperMap support quad-tree scene segmentation structure. Furthermore, ArcView and MapInfo support R-tree scene segmentation structure, while Oracle Spatial supports both R-tree and quad-tree scene segmentation structure [8].
Fixed grid is a kind of scene segmentation structure which is widely used in two-dimensional space environment. Its specific principle is to use a preset size mesh to segment the scene and form a rectangular pixel of equal size. Each rectangular cell is uniquely annotated and recorded according to the row number and the column number. e contents stored in the rectangle cell area are related to the information and properties of the data. e data in the whole scene find their respective storage locations through uniquely marked rectangular area [9].
And when it is necessary to retrieve the data from the scene, the location of the cell can be located by querying the row number and the column number. Since there may be multiple data in each cell, it is also necessary to compare the data attribute values to determine the retrieved data. According to the research conducted by Qiao [10], data retrieval with fixed grid method can be divided into accurate retrieval and range retrieval. Accurate retrieval can complete the search of row number and column number to uniquely determine the cell location, but it still needs range retrieval to continue to retrieve all units that intersect the range retrieved in the first step. One of the studies conducted by Yang [11] pointed out that due to the variety of map data, when the data attributes were particularly complex, it would lead to the redundancy of the index records and reduce the efficiency of data retrieval.
is method is similar to the rectangle framing and longitude latitude framing in the map, and it is more suitable for two-dimensional space.
Originally as an index method, R-tree structure was proposed by Guttman in 1984. is structure is applicable to both two-dimensional environment and three-dimensional environment, and it is an extension of B-tree [12]. Many researches have been carried out on the deformation of R-tree, and specific needs have been met [13]. ese studies often expand R-tree node and store some properties similar to topological relationship. However, this method will double the stored information which increases the burden to the storage and cause the problem of data redundancy. e study carried out by Wang et al. [14] proposed a method combining R-tree and the octree to manage largescale three-dimensional scene. Its advantage is to implement dynamic, efficient, and real-time management of the change data during the interaction. It makes the rendering picture smoother, resulting in a significant reduction in rendering time. However, due to fusing two types of complex structures, it will consume more time to construct the data structure. e study carried out by Namdari et al. [15] proposed an efficient parallelization task execution method based on R-tree. By designing the storage structure, the problem of limited parallelization effect of R-tree on GPU was solved, and a fast search method of R-tree was proposed. R-tree is one of the commonly used storage methods at present, but the objects in the indoor scene are placed with a large density and uneven distribution, so this method is not much applicable [16].
As a scene segmentation method of tree structure, the quad-tree is mainly applied to two-dimensional scene. It uses the fixed grid structure to divide each space into four rectangular areas. It can achieve more efficient space segmentation compared with the grid structure. Compared with R tree, quad-tree structure is relatively simple, so its construction time is shorter. Due to the regularity of each recursion, each quad-tree node can be encoded. e data retrieval can be completed by encoding. is structure is more suitable for two-dimensional space scenes similar to the fixed grid structure [17]. e octree structure was first proposed by Meagher in 1982 [18]. It is an extension of the quad-tree in three-dimensional environment [19], and it has the characteristic of flexibility and extensibility [20]. It is a popular method in the field of 3D image processing and spatial data index [21] and has a better effect than R-tree [22]. e octree has been applied in the storage of 3D objects data such as iron and steel industry, etc. [23]. Riegler et al. [24] and Tatarchenko et al. [25] proposed a fast scene reconstruction method by taking advantage of the regularity of the octree segmentation. Deng et al. [26] proposed a method to add an update memo in the octree, which improves the update efficiency and significantly reduces the update cost of 3D objects. ese methods can initially realize the basic storage of 3D spatial data, but due to the large density and uneven distribution of indoor map data, these storage processes have many disadvantages in some aspects.
When the map scene is segmented by the octree, the objects' data is stored in the nodes. In this way, when retrieving objects, it needs to go through the tree. So, it is very tedious for the data with large retrieval requirements. Many scholars have studied the retrieval method, and the current aspect is the retrieval of neighbor nodes. e neighbor query is divided into four classes [27]: (i) all objects are also the query points. is is known as an all-kNN query (akNN); (ii) only selected objects are the query points. is is known as a Group Nearest Neighbor (GNN); (iii) there is a variant of GNN, which is called Group Nearest Group (GNG); and (iv) only object locations within a given rectangle are the query points. is is known as a Range-kNN query. Optimization techniques used include machine learning [28][29][30], deep learning [31,32], and optimization technologies for transportation [33][34][35]. e study carried out by Pan et al. [31] proposed a fine-grained classification model named RMA (ResNet-Multiscale-Attention) based on deep learning to analyze the subtle and local differences among navigation mark types for the recognition of navigation marks. e study carried out by Pan et al. [32] proposed a CNN-GRU model combined with the network structures of gated recurrent unit (GRU) and convolutional neural network (CNN). e GRU part learned the changing trend of water level, and the CNN part learned the spatial correlation among water level data observed from adjacent water stations. e study carried out by Cho et al. [36] proposed a neighbor retrieval method, which took advantage of the regularity of the octree segmentation and could find out the 26 neighboring nodes by calculating the offset in three directions of x, y, and z. However, the neighbors search was done after the tree is built again. is approach is simple and does not add any time complexity. Furthermore, Namdari et al. improved on this basis [15] and proposed an improved neighbor retrieval method, which stored the neighbors of all leaf nodes in the process of building the tree. It has the advantage of conventional octree partitioning. Storing neighbors when building a tree will not cause damage to the complexity of building tree. ey proved that the sum of time for retrieval, storing neighbors, and building tree is not much different from the time it takes to create the tree alone.
Although the neighbor node search method is feasible, it does not need all 26 neighbor nodes for the indoor scene of closed room. ere is still some unnecessary consumption, and the efficiency needs to be further improved. In this study, we proposed an octree-based data storage model with backtracking and an octree neighbor retrieval algorithm with closed constraints.

Map Scene Segmentation.
e octree storage model usually consists of three parts: scene segmentation, node coding, and data representation. e basic principle to fulfill the function is using the octree to segment 3D scene regularly, using octree code to encode the route of each node [37]. e cube boxes are further used to express the objects approximately, and the codes are stored in the corresponding nodes according to the size and location of the boxes [38][39][40].

Octree Scene Segmentation Technology.
e octree is a regular segmentation data structure. It approximately takes the overall scene of a three-dimensional indoor map as a cube and takes it as the root node of the tree. Moreover, it divides the scene into 8 or 0 pieces at a time during scene segmentation. Its schematic diagram is shown in Figure 1, and its definition is as follows: where v i , d i , and h i are the volume, side length, and depth of the cube obtained by the ith division, respectively, n is the number of objects contained in the cube, and d min is the minimum side length that the cube can be separated into. ere are three types of nodes in an octree. In order to distinguish them, three colors are used in this paper. e white nodes indicate that no data has been stored, whereas gray nodes indicate that more than two objects' data have been stored and black nodes indicate that one-or two-object data have been stored. White and black nodes can be regarded as leaf nodes, and gray nodes need to be further segmented. is segmentation is a recursive process, whose termination condition is that all nodes are leaf nodes or segmentation reaches the specified minimum segmentation area. Figure 1 shows a twice-segmented tree structure, in which (a) is a schematic diagram of three-dimensional cube, whereas white circles represent the objects, and (b) is a schematic diagram of two-dimensional tree structure.
After a three-dimensional map is recursively segmented by octree algorithm, many subregions will be formed, which are distributed in all the corners of the three-dimensional space.

Octree Node Addressing Encoding.
In order to make the data management organized in the octree data storage models, it is necessary to make clear position of each data corresponding to the tree. In this paper, the position of each subregion is marked by encoding. e node addressing code uses digits to mark the 8 child-nodes which were extracted from each node, so that the 3D data can be represented by one-dimensional digits. Among which the number of encoded bits is the same as the number of layers, and each encodes unique marks of the node region while recording the path of this node to the root node. e method of "push back" is used in encoding. e first segmented code is taken as the first digit, and the result of each recursive segmenting is added to the last several digits in turn. e segmented 8 subregions can be distinguished by the deviation degree from the three direction axes, and this method can mark the spatial information in the 8 directions with only 3 binary bits. e following formula can be used to calculate the node addressing encoding, where p is the current number of layers and n is the number of layers to be segmented: coding � x p y p z p , x p+1 y p+1 z p+1 , . . . , x p+n y p+n z p+n .
(2) e first bit of the three-bit binary code indicates the deviation degree from the x-axis, 0 indicates the subregion has no deviation in the x-axis direction, and 1 indicates the subregion has deviation in the x-axis direction. Similarly, the second bit and the third bit represent the deviation degree of the subregion in the y-axis and z-axis direction, respectively, which is exhibited in Figure 2. e maximum number of layers for node segmentation is determined by the system word length. m is used to indicate the maximum number of layers that the current system can be divided into, and Bits represents the number of bits in the system word length: A 64-bit system can be divided up into 21 layers. Assuming that the required minimum partition area is 1 m 2 , the maximum coverage area is 4 21 m 2 .
According to the addressing encoding method, the storage structure of the octree can be encoded. In order to easily record, the code can be converted to decimal representation as shown in Figure 3, which is a twice-segmented 3D scene. e specific steps of segmentation and encoding are as follows: (1) e 3D map scene is represented in the form of cube approximately. (2) By treating this cube as the root node of the tree, according to its deviation from the three axes, it is marked with three binary numbers, and then the binary numbers are converted into corresponding decimal numbers. e first segmentation and coding are completed. (3) After the first segmentation, the regions numbered 0, 2, 3, 5, and 7 do not contain data, so they are white nodes and can be used as leaf nodes without further segmentation. e regions numbered 1 and 6 contain one data, respectively, so they are black nodes and can be regarded as leaf nodes without further segmentation. e region numbered 4 contains 4 data, so it is a gray node. It cannot be regarded as a leaf node, and the segmentation should continue; repeat step (2) to divide and encode. (4) After the second segmentation, the region originally numbered 4 is divided into 8 subregions, among which the nodes numbered 40, 41, 42, 43, 44, and 47 do not contain data, so they are white. e nodes numbered 45 contain two data, and the node numbered 46 contains two data, so the two nodes are black. At this time, all nodes can be regarded as leaf nodes, so there is no need to segment, and the recursive operation of scene segmentation is finished.

Data Expression.
In three-dimensional indoor maps, most of the shapes of objects are very irregular, and the objects with cube shape occupy a much larger proportion than that with spherical shape. erefore, after statistical   analysis, Axially Aligned Bounding Box (AABB) method was considered to be more appropriate. e enclosing shape is a cuboid, and each side of the cuboid needs to be consistent with the corresponding coordinate axis direction. e benefit of normalizing the cube is that the AABB can be easily calculated based on the maximum and minimum coordinates of each vertex. e size and coordinates are as follows: e minimum coordinate of point A in the lower-left corner and the maximum coordinate of point B in the upper-right corner can be selected and wrapped into a range. Two points A and B can be used to represent the bounding box as shown in Figure 4.
By combining the above octree scene segmentation, node addressing encoding, and data approximate expression AABB, a storage model based on traditional octree can be formed. However, due to its approximate expression, some error rates still exist and are acceptable.

Design of Map Data Storage Method.
In the process of saving the approximate representation data into the octree, few practical problems appeared such as map data conflict, partition line and object conflict, etc. erefore, an improved octree structure with backtracking characteristics is proposed in this paper.

Resolution to Map Data Conflict.
In the three-dimensional indoor map scene, the distribution of objects is irregular. Many objects are too close to each other and even overlap. erefore, when using bounding boxes to represent the objects approximately, the bounding boxes may intersect or overlap. As AABB is cube and cube box sides, respectively, on the axis, when a minimum coordinate and a maximum coordinate are used to represent the cube, we should check whether the coordinates of the two objects overlap or not. Suppose the coordinates of A are (x A min , y A min , z A min ) , (x A max , y A max , z A max ) , and the coordinates of B are (x B min , y B min , z B min ) , (x B max , y B max , z B max ) ; then, the judgment conditions are as follows: (1) If x A max < x B min or x B max < x A min , the bounding box cubes of two objects do not conflict (2) If y A max < y B min or y B max < y A min , the bounding box cubes of two objects do not conflict (3) If z A max < z B min or z B max < z A min , the bounding box cubes of two objects do not conflict If none of the above three conditions is satisfied, the AABB surrounded cubes of two objects are to be in conflict. In the three-dimensional map of indoor scenarios, due to the relatively small volume of a single object, for the conflicted data, we should use a bigger bounding box for approximate expression, that is, obtaining the maximum and minimum coordinates of the four coordinates used by two objects to represent the coordinates of the new bounding box. Because this kind of conflict is not a lot in the actual indoor environment and the new bounding box volume is not large, the cost is acceptable. Another advantage of taking the method is to help solve the difficulty caused by the unexpected situation of the dividing line at the intersection of two objects of the AABB bounding boxes.

Resolution to Conflict between Dividing Line and
Object.
e linear way can replace the storage of pointers by addressing codes, which only need to record the addressing codes of leaf nodes, which can greatly reduce the storage pressure. In addition, the linear octree can be transformed into the corresponding linear list for representation. e elements in the linear list correspond to the nodes, which can increase the convenience of calculation.
Linear mode is one of the most widely used storage methods. All data of this method are only stored in the leaf nodes, and the middle nodes do not store any data. However, in the three-dimensional indoor map scene, the location of indoor data is very close. It often exists in the situation that the dividing line is on the indoor object. If the object data is segmented at this time, it will terminate the object data and need to be reconstructed again. is is a complex process and requires a large amount of calculation. erefore, this method is not applicable to the data storage of 3D indoor map.
According to the characteristics of the close distribution of indoor map data, a new data storage model is proposed in this paper. It improves the linear octree and makes it to have backtracking ability. Originally, the map data is still stored at the leaf nodes, when the dividing line occurs in the object, the object data is not divided and instead it gets stored in the nearest parent node that can fully contain the object data. Since the object data storage has been completed at this time, the scene segmentation can be continued.

Algorithm Implementation
(1) Definition of relevant data structure (I) Leaf Tree Node structure   RoomID//Room code the object in } e three structures defined above have different functions, but they are also related to each other. e algorithm of creating an octree is as follows Algorithm 1.

Closed-Orientation 3D Indoor Map Data Retrieval
Method. Based on the data storage model which is proposed in this paper, a data retrieval method with closed constraints was proposed according to the characteristics of more indoor partition to improve the efficiency of data retrieval.

Analysis of Neighbor Retrieval Algorithm Based on the
Octree. In octree structure, there are at most 26 neighbor nodes of a node. According to the type of critical location between the target node and neighbor node, three cases exist: surface-neighbor, edge-neighbor, and point-neighbor, as shown in Figure 5. ere are 6 surface-neighbors, 12 edgeneighbors, and 8 point-neighbors for one node.
In the octree, the calculation of neighbor nodes can be realized by finding the nearest common ancestor of target node and neighbor nodes. According to the direction and area information of the nodes, this method completes the calculation of address coding of neighbor nodes. is calculation is based on the modifying of the target node addressing code. e process is from the rightmost coding in turn to the left, updating the value of the target node at that position with the numerical results obtained by each bit of computation.
In the octree environment, if we want to find the 26 direction's information, we can only record the surfaceneighbor data in orthogonal direction {D, U, R, L, B, F}. e 12 edge-neighbors and 8 point-neighbors' data can achieve through orthogonal direction data twice or thrice operation.
is can reduce the amount of data table.
When the target node and the neighbor node in the given direction are brothers, the calculation method executes the "stop" command and directly modifies the rightmost digit value. Otherwise, the nearest common ancestor of the two nodes should be located, and then relevant calculation can be performed. When the layer of neighbor nodes is deeper than the target nodes, which is due to the neighbor node calculation method can only calculate the same size nodes with the target nodes, and the nodes calculated are not leaf nodes.
at is, the nodes adjacent to the target nodes can also continue to refine. Although it is difficult to solve this problem, the research background of this paper is 3D indoor maps. Most of the map data volume is small, and therefore we can regard the calculated neighbor nodes as the target node's neighbor nodes, and it does not need any further detailed analysis. e effects of these errors are negligible.

Neighborhood Retrieval Optimization Algorithm in
Indoor Map Scene. In the traditional octree neighbor node retrieval methods, the results of each retrieval are the target node's 26 neighbor nodes in all directions. As we knew from the analysis mentioned earlier, there is no need of all 26 neighbor nodes in the 3D indoor scenarios. We can take the indoor room partition into consideration. e neighbor nodes in the same room with the target nodes are needed with the data. e optimization of the traditional octree neighbor retrieval method can realize the filtrating of neighbor nodes, reduce the number of neighbor nodes, reduce the workload for the later neighbor data analysis, thus reduce the cost of retrieval, and improve the stability of the algorithm.
In the actual retrieval process of indoor map, according to the area where the target data is located, it can be divided into the following situations: (1) e retrieval of data on the room ground: the retrieval in this environment can improve the efficiency by using the closure neighbor retrieval method. (2) Corridor data retrieval: unlike the data on the room ground, the objects in corridor are limited, the environment is relatively open, and the enclosed space is few. erefore, using neighbor search algorithm does not improve the efficiency, and it will lead to unnecessary retrieval costs. So, in this case, we can retrieve directly. (3) e retrieval of data inside the room of nonground: the data in the area mainly refers to the space among walls and ceiling; it is similar to the data in the corridor. e purpose of retrieving it is not to move it, such as lamps on the ceiling. e purpose of retrieval is to repair, not to change the position. So even though it is closure, it does not meet the usage scenarios of closure neighbor search algorithm; this case also can retrieve directly. ese three cases can contain most of the data, and direct retrieval is sufficient for extreme cases.
Because different retrieval algorithms are used in different scenarios, the logical relationship of the object position parameters is as follows: x represents object data, A(x) represents data on the floor of the room, B(x) represents data on the corridor, and C(x) represents data in the room that is not on the floor: N represents neighbor search: Object data on the floor of the room requires neighbor retrieval . N(x, y) is the data that x and y are neighbor. R(x, y) is the data that x and y are in the same room: (N(x, y) ⟶ R(x, y)). (7) Although there are cases in which neighbor data is in the same room, not all the neighbor nodes are in the same room.

Algorithm Design.
Considering the closure of data, the data retrieval method is the combination of the traditional octree neighbor nodes retrieval method and the closure of indoor rooms. e calculated neighbor data is filtered again by adding the constraint condition of room closure: (1) Compare the ID of the target data with the node data to find the node where the target data is located and  Mathematical Problems in Engineering record the addressing code of the node, which is called the target node. (2) According to the addressing code of the target node, retrieve the location of the target node in the octree and compare the data in the node with the target data ID to obtain the target data. (3) If the target data do not conform to the application scope of neighbor retrieval, the retrieval shall be stopped; otherwise, the next step shall be carried out. (4) Calculate the neighbor nodes of the target node and consider the room constraints, no more than 26. Parse the data in the qualified neighbor node. e two algorithms of octree retrieval and octree neighbor retrieval are shown in Algorithms 2 and 3, respectively.

Creation of Experimental Scenarios.
In order to ensure the standardization and convenience of 3D indoor map scene creation, SketchUp and ArcGIS were used to create the map scene. ArcMap was used to create the two-dimensional scene base map, in which the surface data structure was used as the wall, and the point data structure was used as the marker point of each specific object in the scene. Finally, in the ArcScene platform, we added a height value for each surface type data structure and made it with a 3D data including height value. We changed the symbol expression mode of each point data to the specific object form which it represented, such as computer table, sofa, cabinet, etc. ese specific objects needed to be done by SketchUp specific components. For the purpose of beauty, wall, ground, windows, and doors can be decorated with concrete material. e final scene is shown in Figure 6. Map scenario consists of two floors; there is a corridor in the middle section of each floor. On both sides, there are some rooms of different sizes. e basic object types include computer chair, table, and bookcase inside the room, a total of 87 indoor objects, and the specific parameters of floor 1 and floor 2 as shown in Tables 1 and 2, not considering the dining regions and stairwells.

Experiments and Analysis of Neighbor Retrieval
Algorithm. For the map data retrieval, the time required is an important index to evaluate the efficiency of a retrieval method. erefore, in the experiment, based on the proposed storage model, the octree data retrieval method, R-tree data retrieval method, and octree neighbor data retrieval method are tested to analyze the time cost by these three methods in retrieving 3D indoor map data. In order to avoid the impact on the experimental results due to the lack of experimental data, the experiment is conducted under two simulation scenarios. e first experiment scene A is the map scene created in Section 4.1, and the second experiment scene B is shown in Figure 7. e modeling method of this scenario is adopted in Section 4.1.
Both experimental scene A and experimental scene B are three-dimensional indoor maps, and the details of them are shown in Table 3. Now in the second experimental scenarios, three retrieval methods are completed. It is now the analysis of the time used complexity of data retrieval under different conditions.
When 3D indoor map data is directly retrieved without any data structure and retrieval method, the time complexity of retrieval is (n p ), where n is the number of data and p is the number of data to be searched. When only using the proposed data storage model for the experimental data storage, without using any search method, as the octree, it cannot directly link to the other required node address based on a node address. erefore, it needs to do tree traversal for each retrieval; time complexity of the search is O(2 3(L− 1) ), where L is the depth of the tree. R-tree data retrieval method is like octree data retrieval method, but due to the overlapping area occurring in the R-tree, it takes extra time to detect if there is a collision of object data in the overlapping area. In an indoor environment, objects are packed more frequently, so retrieval takes more time. If the concept of "searching for a point, points around the searched point are within the searching range" is used at this time, the neighbor data information is retrieved by the traditional neighbor retrieval method of octree. Because of the regularity of the octree partitioning, it can calculate up to 26 neighbors map data around the target data through the formula. erefore, the time complexity of neighbor retrieval method is O (1).
is experiment simulated five data retrievals and took scene A as an example for analysis. e data retrieved each time were distributed in multiple rooms. e specific retrieval parameters are shown in Table 4. Figures 8 and 9 show the comparison of retrieval time among R-tree retrieval, the octree retrieval, and the octree neighbor retrieval under two scenarios, respectively. Figures 10 and 11 show the comparison of the octree retrieval and neighbor retrieval methods in terms of frequency times. From the experimental results, it can be concluded that the octree requires less time consumption in data retrieval operation than R-tree, and its stability is better. It indicates that the octree structure is not only better in construction time than R-tree structure, but also has advantages in data retrieval. For the octree structure, the use of neighbor retrieval method is better than not using it completely, which proves that the idea of "searching for a point, points around the searched point are within the searching range" is feasible.
is suggests that neighbor nodes data of the target node is significantly useful. It is verified that the octree neighborhood retrieval can improve the overall efficiency without increasing the time efficiency of single retrieval.

Experiments and Analysis of Data Retrieval Methods
Oriented to Closure Constraints. e experiments in this section will analyze from the aspect of retrieval cost, which refers to the number of neighbor nodes other than the target node each time the neighbor retrieval method is adopted. As the retrieved data needs to be parsed and represented each time, there will be more neighbors and the cost will be higher. e experiments still adopt the simulated retrieval data in the previous section to conduct in the experimental scene A and the experimental scene B.

Mathematical Problems in Engineering
From Figures 12 and 13, we can observe that the calculation method of neighbor nodes after adding the closure constraint condition has obviously reduced most cases in the number of neighbor nodes. Compared with the search method without constraint conditions, the search cost is reduced by 25 percent on average, which proves that the room closure condition can reduce the cost of data retrieval and then improve the efficiency of data retrieval on the premise of guaranteeing the efficiency of neighbor retrieval.

Conclusions
In this study, we evaluated the problems related to the storage consumption of 3D indoor maps. In order to reduce storage consumption and improve storage efficiency, a 3D data storage model based on the octree structure was proposed. e octree structure is used to segment the indoor map data. e addressing code was used to uniquely mark the generated nodes without retaining the pointers to the parent and child nodes. Compared with pointer storage, this storage method saved 60% of storage space. Considering the complexity caused by irregular shape of indoor objects, AABB method was used to approximately express the object data in the map scene. e advantage of this storage model based on scene segmentation lied in the fact that it could reduce the amount of storage units and improve the storage efficiency. Moreover, the connection between each storage unit was convenient for future management and use. en, according to the characteristics of close distribution of indoor map data, the situation of octree scene segmentation     line within the object data range was analyzed. e linear octree was improved to have a backtracking ability. When the dividing line occurred in the object, the object data was not divided and instead it got stored in the nearest parent node that could fully contain the object data, not just in leaf nodes. Ultimately, it led to strengthening the stability of data storage and improving the efficiency of storage. After experimental verification, the data storage model of the octree map did not consume much time compared with the traditional octree, which is 1/8 of the time consumed by R-tree structure. Moreover, considering the problem of high cost and low efficiency of data retrieval, a data retrieval method based on the octree storage model was proposed in this paper. e method mainly analyzed from two aspects. Initially, according to the feature of "searching for a point, points around the searched point are within the searching range" of map data retrieval, an octree neighbor nodes retrieval method was proposed to reduce the number of retrieval operations. en, by adding closure constraint conditions, the neighbor nodes retrieval method was improved to decrease the cost of data retrieval. en, we could improve the efficiency of data retrieval. Experimental results showed that the cost of retrieval was reduced by about 25%.
Due to the huge amount of indoor map data, the consumption of storage is crucial to the promotion and application of the system. e index linear storage based on octree        can save a lot of storage space, reduce storage costs by 60%, and save system development costs. Meanwhile, the neighbor retrieval method proposed by adding closed constraints improved the retrieval efficiency by about 25%. e method of map data storage and retrieval proposed in this paper saved storage space and improved retrieval speed in practical applications. e indoor map was used in indoor localization to display the positioning results in indoor scenes, so that users would have a good positioning experience. With the advent of the 5G era, indoor localization has developed rapidly, and the search efficiency of indoor maps will be increasingly demanded. is research can achieve the purpose of real-time display of positioning results in map scene.
ere are many potential future directions existing for this type of work. First, in terms of map data expression, AABB packaging box approximate expression method was adopted in this paper, which can meet current needs. However, for objects with special shapes, some segmentation methods based on point-cloud data can be adopted to improve the accuracy of data expression. Second, there are vast amounts of data and many concurrent operations such as data retrieval in the indoor map. erefore, cloud storage method and distributed system architecture can be combined to improve the robustness of data storage and retrieval, which could enhance the application experience of users.
Data Availability e datasets used and analyzed during the current study are available from the first author upon reasonable request.

Conflicts of Interest
e authors declare that they have no conflicts of interest regarding the publication of this paper. Retrieval no.

Number of neighbors
Octree neighbor retrieval Octree neighbor retrieval with closure constraint  Retrieval no.

Number of neighbors
Octree neighbor retrieval Octree neighbor retrieval with closure constraint