A method, retrieval method, and apparatus for constructing and retrieving a hybrid index based on a grid R-tree.

By partitioning large-scale spatial data into grid indexes and constructing independent R-tree indexes, combined with the triangulation algorithm, the performance bottleneck of traditional indexes in large-scale spatial data management is solved, and efficient spatial data querying and storage are achieved.

CN116303434BActive Publication Date: 2026-03-10XIAMEN GREAT POWER GEO INFORMATION TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-20
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Traditional single-memory space indexes cannot effectively manage large-scale and diverse spatial data, resulting in poor query performance, high memory overhead, slow construction speed, and difficulty in parallelizing the accurate spatial geometric relationship judgment of complex geometric objects.

Method used

A hybrid indexing method based on grid R-trees is adopted to partition ultra-large-scale spatial vector data into grid indexes and build independent R-tree indexes on each partition. Combined with triangulation algorithm to process complex geometric objects, it reduces memory usage and improves query efficiency.

Benefits of technology

It achieves efficient storage and querying of massive spatial vector data, reduces memory overhead, improves query speed and parallel construction capabilities, and enhances the query efficiency of complex geometric objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116303434B_ABST
    Figure CN116303434B_ABST
Patent Text Reader

Abstract

This invention discloses a method for constructing a hybrid index based on a grid R-tree, comprising: S1: initializing the hybrid index data structure using grid initialization parameters; S2: generating a global grid index partition mapping file, and storing the sequential number and unique number of each feature element in the global grid index partition mapping file; S3: generating a feature element storage file, and storing the feature element information of each feature element in the feature element storage file; S4: determining whether a feature element is a complex geometric object, and using a triangulation algorithm to split the complex geometric object of the feature element into several feature element triangulation triangles; S5: calculating the grid partition set of the feature element by combining the feature element and / or the minimum bounding rectangle of the feature element triangulation triangle and the grid initialization parameters; S6: traversing the grid partition set of the feature element and building an R-tree index for each grid partition.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of information technology, and in particular to a grid R-tree hybrid index construction method, retrieval method and device. BACKGROUND

[0002] In recent years, with the wide application of geographic information systems in the fields of electric power industry, transportation, weather warning, hydrological monitoring, vehicle logistics, disaster prevention and mitigation, agriculture, forestry and fishery, and public safety, the value of spatial data information is particularly evident in various industries. The unified storage, centralized management and efficient access of spatial big data accumulated over time have become key processing technologies for studying geographic information systems.

[0003] Currently, due to the large size of spatial data information and the diversity and complexity of these spatial data information, the query performance of spatial data is extremely high in actual application, and the spatial query performance is an important indicator for measuring spatial data operation.

[0004] It should be noted that spatial data query technology mainly constructs various types of spatial indexes to realize spatial data query operation, so as to meet the high-performance access requirements of spatial data. Among them, spatial indexes mainly include grid index, KD-tree index, quadtree index, R-tree index and the like.

[0005] However, the inventors have found that the traditional spatial index mainly uses a single memory index structure for spatial data management, which can only meet the access requirements of spatial data with small data size, and the full amount of spatial index data structure is loaded into the memory. This technical means has large memory overhead, slow index construction speed, low query efficiency, and poor actual application effect.

[0006] Therefore, the current traditional spatial index method has the following shortcomings:

[0007] (1) The traditional single memory spatial index only supports spatial data with small data size.

[0008] (2) The traditional single memory spatial index has low query efficiency. Spatial data retrieval efficiency is an important indicator of spatial index. Due to large-scale and diversified irregular spatial vector data, the spatial distribution has no rules. Using a single two-dimensional tree index structure will result in high index tree height, large spatial data retrieval cost, and slow query.

[0009] (3) The traditional single memory spatial index loads the full amount of spatial vector data into the memory, which has large memory overhead.

[0010] (4) Traditional single memory space index order construction speed is slow, which adopts R-tree, quadtree, KD-tree index and other two-dimensional tree index structure, and the construction of large-scale spatial data is slow and difficult to parallelize.

[0011] (5) The total number of point sets composed of complex geometric objects is relatively large, generally reaching tens of thousands of points or even more, and the traditional single memory space index consumes more CPU operation time for accurate spatial geometric relationship judgment of complex geometric objects. SUMMARY

[0012] In order to overcome the defects of the prior art, the technical problems to be solved by the present application are to provide a grid R-tree hybrid index construction method, retrieval method and device, which is simple in design and can support the construction of super large-scale spatial vector data index by adopting a hybrid index construction method. At the same time, the data retrieval performance is improved by optimizing the construction process of triangular partitioning of complex geometric objects, reducing the memory usage overhead, and enabling efficient spatial data retrieval according to the retrieval range.

[0013] In order to solve the above technical problems, the first technical scheme adopted by the present application is: a grid R-tree hybrid index construction method, comprising the steps of:

[0014] S1: initializing the grid hybrid index data structure by using grid initialization parameters;

[0015] S2: generating a global grid index partition mapping file, and storing the sequential number and unique number of each ground feature element in the global grid index partition mapping file;

[0016] S3: generating a ground feature element storage file, and storing the ground feature element information of each ground feature element in the ground feature element storage file;

[0017] S4: analyzing and judging the geometric range parameters, the number of constituent points, and the number of multi-faceted holes of the complex geometric object in the ground feature element information of each ground feature element, if the geometric range parameters, the number of constituent points, and the number of multi-faceted holes exceed the set threshold, the ground feature element is judged as a complex geometric object, and the complex geometric object of the ground feature element is split into a plurality of ground feature element partition triangles by using a triangular partitioning algorithm;

[0018] S5: calculating the grid partition set of the ground feature element in combination with the minimum circumscribed rectangle of the ground feature element and / or the ground feature element partition triangle and the grid initialization parameters;

[0019] S6: traversing the grid partition set of the ground feature element, and establishing an R-tree index for each grid partition.

[0020] In the grid R-tree hybrid index construction method designed in the application, the idea of divide and conquer is used for storage optimization, and the super large spatial vector data is divided according to the grid first index, each partition corresponds to a storage file, so that each partition file corresponds to an R-tree index. The application creatively combines grid index and R-tree index, effectively plays the advantages of the two indexes, and the mixed index advantages are complementary. Among them, the R-tree index after partitioning reduces the tree height of the only R-tree, reduces the geometric intersection judgment of the rectangular range of the query and the rectangular range of more levels of nodes, thereby improving the query efficiency.

[0021] In addition, in the application, by triangulating the complex geometric object, the complex geometric object can be decomposed into a plurality of simplified ground feature element triangulations, so as to improve the efficiency of the complex object accurate geometric operation, improve the query efficiency, and reduce the cpu resource utilization.

[0022] Comparing the technical scheme designed in the application with the technical scheme of traditional spatial index using a single memory index structure for spatial data management, it is not difficult to see that:

[0023] (1) The traditional single memory spatial index only supports spatial data with a small data size. The grid R-tree hybrid index scheme proposed in the application can first partition the massive data through the grid, and then independently construct an R-tree index on each partition, so as to meet the storage organization and management of massive spatial vector data.

[0024] (2) The traditional single memory spatial index has low query efficiency. The grid R-tree hybrid index scheme proposed in the application divides multiple R-tree indexes through the grid, so that the index rectangular range of each R-tree is controlled within a certain range, the geometric object data amount of a single tree is reduced, the tree height is reduced, the tree path during retrieval and query is small, and the query result set can be quickly obtained, thereby improving the retrieval and query efficiency.

[0025] (3) The traditional single memory spatial index loads all the spatial vector data into the memory, which has a large memory overhead. The grid R-tree hybrid index scheme proposed in the application first partitions the massive spatial vector data, reduces the spatial data amount of each partition, and constructs an R-tree index based on the disk, so as to support on-demand access to related spatial data from the disk.

[0026] (4) The traditional single memory spatial index has slow sequential construction speed. The grid R-tree hybrid index scheme proposed in the application uses first-level grid index for partitioning, reduces the data size, and each second-level index of the grid is independent, so that independent index construction can be carried out, parallel multi-tree index structure construction can be easily realized, and the overall spatial index construction time can be effectively shortened.

[0027] (5) The traditional memory space index is time-consuming for complex geometric object query precision geometric relationship operation. The grid R-tree hybrid index scheme proposed in the application is specially constructed for complex geometric objects, which is triangulated and then indexed. When the exact match is performed, since the complex object is composed of several simple feature elements, in most cases, the query range only needs to be matched with the split geometric object, which can effectively improve the query efficiency and reduce the cpu operation consumption.

[0028] Further, in the grid R-tree hybrid index construction method according to the application, in step S6, an R-tree index is established for each grid partition, specifically including the following steps:

[0029] S61: initializing the R-tree index, creating an R-tree index file, and setting the maximum number of nodes N of the R-tree node;

[0030] S62: when inserting the R-tree index file, first select a suitable path for inserting the feature element index item from the root node, perform geometric relationship operation on the minimum circumscribed rectangle of the feature element and the rectangular range of each node, and find an insertion path from the root node to the leaf node;

[0031] S63: the feature element index item is inserted into the leaf node of the insertion path in an appended manner;

[0032] S64: if the number of nodes of the leaf node is full, that is, exceeds the maximum number of nodes N of the R-tree node, the leaf node will be split into two nodes, and the whole process is propagated from the leaf node to the root node along the insertion path; if the root node is split, the whole R-tree index will increase a layer.

[0033] Further, in the grid R-tree hybrid index construction method according to the application, in step S1, the grid hybrid index data structure is initialized according to the grid minimum longitude grid_minx, the grid minimum latitude grid_miny, the grid maximum longitude grid_maxx, the grid maximum latitude grid_maxy, the grid size grid_cellsize, the grid row number grid_rows, and the grid column number grid_columns.

[0034] Further, in the grid R-tree hybrid index construction method according to the application, in step S2, the feature element sequence number is generated in ascending order from 1 during the construction of the feature element index, and the feature element unique number is a string of feature element unique identification.

[0035] Further, in the grid R-tree hybrid index construction method, in step S3, the feature element information includes feature element spatial attribute information and feature element entity attribute information, the feature element spatial attribute information includes a feature element geometric object shape, and the feature element entity attribute information includes a feature element unique number identifier and a feature element name.

[0036] To solve the above technical problems, the second technical solution of the present application is a grid R-tree hybrid index retrieval method, the grid R-tree hybrid index is constructed according to any one of the grid R-tree hybrid index construction methods, and the grid R-tree hybrid index retrieval method includes the following steps:

[0037] 100: According to the input geometric object shape, the minimum circumscribed rectangle of the geometric object is calculated as a query rectangular range of spatial data;

[0038] 200: The grid partition set in which the query rectangular range is located is calculated in combination with the grid initialization parameters;

[0039] 300: The grid partition set is traversed, the R-tree index of the corresponding grid partition is loaded, the R-tree index of the corresponding grid partition is subjected to a spatial retrieval operation in parallel according to the query rectangular range, the result set of each R-tree index is collected, the repeated feature element order numbers in the result set are removed, and the candidate feature element number result set is merged;

[0040] 400: The candidate feature element number result set is traversed, the unique number of each feature element is obtained from the relationship in the global grid index partition mapping file, and then the feature element information of the corresponding feature element is obtained from the feature element storage file to form a complete candidate feature element result set;

[0041] 500: The candidate feature element result set is traversed, the candidate feature element filtered out by the feature element subdivision triangle is obtained, and the other feature element geometric object shape and the input geometric object shape are subjected to accurate geometric intersection judgment to filter out the intersection feature element result set, the candidate feature element filtered out by the feature element subdivision triangle is directly added to the intersection feature element result set, and the final feature element result set is generated.

[0042] Further, in the grid R-tree hybrid index retrieval method, in step 100, the minimum circumscribed rectangle of the geometric object is composed of the left lower corner point and the right upper corner point information, which includes the minimum longitude query_minX, the minimum latitude query_minY, the maximum longitude query_maxX, and the maximum latitude query_maxY.

[0043] Further, in the grid R-tree hybrid index retrieval method, in step 200, the grid partition set of the grid region is obtained according to the minimum grid X direction number cell_minx, the minimum grid Y direction number cell_miny, the maximum grid X direction number cell_maxx and the maximum grid Y direction number cell_maxy of the grid region spanned by the calculated query rectangular range.

[0044] Further, in the grid R-tree hybrid index retrieval method, in step 300, the R-tree index of the corresponding grid partition is subjected to a spatial retrieval operation according to the query rectangular range, so as to collect the result set of each R-tree index, and the step 300 specifically includes steps 301-302.

[0045] 301: starting from the root node of the R-tree index, the query rectangular range is subjected to geometric intersection judgment with the root node, if the query rectangular range intersects with the root node, geometric intersection judgment needs to be performed with all child nodes of the root node;

[0046] 302: the R-tree index is traversed according to the depth-first algorithm, each branch of the R-tree index is iteratively traversed until the leaf node, and the result set of the intersected leaf node is collected;

[0047] 303: after removing the repeated result sets obtained by retrieval, the result set of the corresponding R-tree is obtained.

[0048] In order to solve the above technical problems, the third technical scheme adopted by the present application is: a grid R-tree hybrid index construction and retrieval device, comprising:

[0049] An index metadata module is used to record the basic data information of the grid R-tree hybrid index, and the basic data information includes grid initialization parameter information and R-tree parameter information;

[0050] A triangulation module is used to judge whether the ground feature element is a complex geometric object, and the complex geometric object is subjected to triangulation, so as to divide the complex geometric object of the ground feature element into a plurality of ground feature element triangulation triangles;

[0051] A grid index module is used to calculate the grid index of the ground feature element, and generate the grid index structure according to the index metadata information;

[0052] An R-tree index module is used to realize the generation and loading of the R-tree index file, and provide the data node insertion algorithm of the R-tree index and the R-tree spatial query algorithm;

[0053] A global grid index partition module is used to realize global grid index partition mapping file generation and loading, and provide a mapping relationship establishment function of ground feature element sequential numbering and ground feature element unique numbering;

[0054] A ground feature element storage module is used to realize ground feature element storage file generation and loading, provide ground feature element basic attribute information storage, ground feature element spatial geometry object serialization, and ground feature element related attribute information serialization storage functions;

[0055] A query data preprocessing module is used to realize input geometry object data preprocessing, generate a corresponding minimum circumscribed rectangle according to a geometry object element type, and realize spatial retrieval by calling a grid index module and an R-tree index module;

[0056] A query result set generation module can merge query candidate ground feature element result sets, and perform accurate geometry matching on a query input geometry object and a candidate result set to generate a final ground feature element result set.

[0057] The grid R-tree hybrid index construction method, the retrieval method and the device have the advantages that the scheme design is simple, a primary grid index partition is constructed for large-scale spatial vector data, a secondary R-tree index based on a disk is constructed for each grid index partition, massive spatial vector data index storage is realized, a high-efficiency hybrid index spatial query method is provided, and high-performance spatial vector data access requirements can be met.

[0058] The grid index and the R-tree index are combined creatively, the advantages of the two indexes are effectively exerted, the hybrid index advantages are complementary, the hybrid index construction mode is utilized, super-large-scale spatial vector data index construction is supported, and the triangular partition optimization construction process is performed for complex geometry objects. BRIEF DESCRIPTION OF DRAWINGS

[0059] Figure 1 A step flowchart of the grid R-tree hybrid index construction method in an embodiment of the present application;

[0060] Figure 2 A structure diagram of the grid R-tree hybrid index data structure.

[0061] Figure 3 A step flowchart of the grid R-tree hybrid index retrieval method in an embodiment of the present application;

[0062] Figure 4 Fig. 1 is a schematic diagram of the functional modules of the grid R-tree hybrid index construction retrieval device according to the present application in an embodiment. DETAILED DESCRIPTION

[0063] To make the technical contents, the purposes and effects of the present application clear, the following will be described in conjunction with the embodiments and the accompanying drawings.

[0064] Please refer to Figure 1 and Figure 2 In the present embodiment, the present application designs a grid R-tree hybrid index construction method, which comprises the following steps:

[0065] S1: initializing the grid hybrid index data structure by using the grid initialization parameters;

[0066] S2: generating a global grid index partition mapping file, and storing the ground feature element sequence number and the ground feature element unique number of each ground feature element in the global grid index partition mapping file;

[0067] S3: generating a ground feature element storage file, and storing the ground feature element information of each ground feature element in the ground feature element storage file;

[0068] S4: analyzing and judging the geometric range parameters, the number of constituent points, and the number of constituent multi-face holes in the ground feature element information of each ground feature element, and if the geometric range parameters, the number of constituent points, and the number of constituent multi-face holes exceed the set threshold value, judging that the ground feature element is a complex geometric object, and using a triangular subdivision algorithm to split the complex geometric object of the ground feature element into a plurality of ground feature element subdivision triangles;

[0069] S5: calculating and obtaining the grid partition set of the ground feature element in combination with the minimum circumscribed rectangle of the ground feature element and / or the ground feature element subdivision triangle and the grid initialization parameters;

[0070] S6: traversing the grid partition set of the ground feature element, and establishing an R-tree index for each grid partition.

[0071] Referring to Figure 1 , and combining Figure 2 It can be seen from the grid R-tree hybrid index data structure shown in the drawings that the most key idea of the present application is that a primary grid index partition is constructed for large-scale spatial vector data, and a secondary R-tree index based on a disk is constructed for each grid index partition, so as to realize the index storage of massive spatial vector data, to provide an efficient hybrid index spatial query method, and to meet the high-performance spatial vector data access requirements.

[0072] As Figure 1As shown, the inventors create a first-level grid index partition for the ground feature and / or ground feature dissected triangle, and write the ground feature and / or ground feature dissected triangle into a related grid index file, so that each partition corresponds to a storage file, so that each partition storage file corresponds to an R-tree index, and then write the ground feature index item into a second-level R-tree index file, to construct a disk-based second-level R-tree index for each grid index partition.

[0073] In addition, in the present application, by triangulating the complex geometric object, the complex geometric object can be decomposed into a plurality of simplified ground feature dissected triangles, so as to improve the efficiency of the complex object accurate geometric operation, improve the query efficiency, and reduce the cpu resource usage. In step S4, the plurality of ground feature dissected triangles obtained by splitting the complex geometric object based on the ground feature can be used for subsequent query operation optimization, and all the ground feature dissected triangles can become index objects and be associated with the original ground feature.

[0074] In addition, it should be noted that the grid R-tree hybrid index construction method designed in the present application can further include step S7: after writing the ground feature information of all ground features into the R-tree index file, refreshing and saving the file, and persistently writing it into the local disk.

[0075] In specific implementation and application, each R-tree index file can be named by X direction and Y direction grid number, and the saved file in step S7 can be specifically named as R{cell_row}_{cell_column}.idx; wherein cell_row is the grid Y direction row number, and cell_column is the grid X direction column number.

[0076] Further, in step S6, an R-tree index is established for each grid partition, which specifically includes the following steps:

[0077] S61: initializing the R-tree index, creating an R-tree index file, and setting the maximum number of nodes N of the R-tree node;

[0078] S62: when inserting the R-tree index file, first select a suitable path for inserting the ground feature index item from the root node, perform geometric relationship operation on the minimum circumscribed rectangle of the ground feature and the rectangular range of each node, and find an insertion path from the root node to the leaf node;

[0079] S63: inserting the ground feature index item into the leaf node of the insertion path in an appended manner;

[0080] S64: If the number of nodes in the leaf node is full, that is, it exceeds the maximum number of nodes N in the R-tree, then the leaf node will split into two nodes. The whole process will propagate from the leaf node to the root node from the bottom up along the insertion path. If the root node splits, the entire R-tree index will increase by one level.

[0081] In step S6 of this invention, it is necessary to traverse the set of grid partitions of the feature elements and build an R-tree index for each grid partition. Specifically, the R-tree index can be constructed in parallel based on the grid partitions for the feature elements and / or the triangular data of the feature elements. First, the data structure of the uninitialized grid partition R-tree index is initialized and prepared. Then, the feature elements are inserted into the disk-based R-tree index file according to the R-tree insertion algorithm.

[0082] Furthermore, in step S1, the grid hybrid index data structure is initialized based on the minimum longitude grid_minx, minimum latitude grid_miny, maximum longitude grid_maxx, maximum latitude grid_maxy, grid size grid_cellsize, number of grid rows grid_rows, and number of grid columns grid_columns.

[0083] It should be noted that, in this embodiment, in step S1 of the present invention, the grid index structure can be initialized specifically according to the minimum longitude grid_minx, the minimum latitude grid_miny, the maximum longitude grid_maxx, the maximum latitude grid_maxy, the grid size grid_cellsize, the number of grid rows grid_rows, and the number of grid columns grid_columns, so as to divide the given geographic space into grids of the same size; wherein, each grid data structure can specifically include: an outer rectangle, a grid number in the X direction, a grid number in the Y direction, and a grid-associated secondary index R-tree data structure.

[0084] Furthermore, in step S2, the sequential number of the feature element is generated sequentially from 1 according to the integer sequence number during the construction of the feature element index, and the unique number of the feature element is a string that uniquely identifies the feature element.

[0085] In step S2 of this invention, the sequential number and unique number of the ground feature can be written into the global grid index partition mapping file using the LSM algorithm. The sequential number of the ground feature can be used as the key value and the unique number of the ground feature can be used as the storage content.

[0086] Furthermore, in step S3, the feature information includes spatial attribute information and entity attribute information. The spatial attribute information includes the geometric shape of the feature, and the entity attribute information includes the unique identifier and name of the feature.

[0087] In the grid-based R-tree hybrid index construction method designed in this invention, the geometric shapes of geographic features included in the spatial attribute information can specifically include three categories: point shapes, line shapes, and area shapes. In this invention, the minimum bounding rectangle of the corresponding geographic feature can be further calculated based on the geometric shape of the geographic feature.

[0088] It should be noted that, in this embodiment, in step S3 of the present invention, the feature information can be specifically written into the feature storage file through the LSM algorithm. In the feature storage file, the unique number of the feature can be used as the key value. The storage content of the feature storage file can specifically include: the unique number of the feature, the name of the feature, the geometric shape of the feature, and the minimum bounding rectangle of the feature.

[0089] Furthermore, it should be noted that in this embodiment, in step S5 above, the minimum bounding rectangle of the feature or the partitioned triangle is composed of the information of the lower left corner point and the upper right corner point, which may specifically include the minimum longitude minX, the minimum latitude minY, the maximum longitude maxX, and the maximum latitude maxY. Using the above information, the minimum grid X-direction number cell_minx, the minimum grid Y-direction number cell_miny, the maximum grid X-direction number cell_maxx, and the maximum grid Y-direction number cell_maxy of the feature can be calculated.

[0090] In the specific calculation process, the calculation formula needs to use the integer calculus function math.Ceil, and the calculation formulas for each data point are as follows:

[0091] cell_minx=math.Ceil(minX-grid_minx) / grid_cellsize-1

[0092] Formula for calculating the minimum grid number in the Y direction:

[0093] cell_miny=math.Ceil(minY-grid_miny) / grid_cellsize-1

[0094] Formula for calculating the maximum grid number in the X direction:

[0095] cell_maxx=math.Ceil(maxX-grid_maxx) / grid_cellsize-1

[0096] Formula for calculating the maximum grid number in the Y direction:

[0097] cell_maxy=math.Ceil(maxY-grid_maxy) / grid_cellsize-1

[0098] By using the calculated ground features or the grid area spanned by the subdivided triangle, the minimum grid X-direction number cell_minx, the minimum grid Y-direction number cell_miny, the maximum grid X-direction number cell_maxx, and the maximum grid Y-direction number cell_maxy, the corresponding grid partition set can be obtained.

[0099] Accordingly, please refer to Figure 3 As shown, the present invention designs a grid R-tree hybrid index retrieval method. The grid R-tree hybrid index used in the grid R-tree hybrid index retrieval method is constructed according to the above-described grid R-tree hybrid index construction method of the present invention.

[0100] In this invention, the retrieval method based on a grid R-tree hybrid index specifically includes the following steps:

[0101] 100: Based on the shape of the input geometric object, calculate the minimum bounding rectangle of the geometric object as the query rectangle range for spatial data;

[0102] 200: Calculate the set of grid partitions containing the range of the query rectangle based on the grid initialization parameters;

[0103] 300: Traverse the set of grid partitions and load the R-tree index of the corresponding grid partition. Perform spatial retrieval operations on the R-tree index of the corresponding grid partition in parallel according to the query rectangle range to collect the result set of each R-tree index, remove duplicate land feature sequence numbers in the result set, and merge them into a candidate land feature number result set.

[0104] 400: Traverse the candidate feature number result set, obtain the unique feature number of each feature from the relationship of the global grid index partition mapping file, and then obtain the feature information of the corresponding feature from the feature storage file to form a complete candidate feature result set.

[0105] 500: Traverse the candidate feature result set, obtain the candidate feature elements selected by feature element subdivision triangles, and perform precise geometric intersection judgment between the geometric object shape of other feature elements and the input geometric object shape to filter out the intersecting feature result set. Add the candidate feature elements selected by the feature element subdivision triangles directly to the intersecting feature result set to generate the final feature result set.

[0106] It should be noted that in this embodiment, in step 300 above, the grid partition set is traversed, and the R index tree of the corresponding grid partition can be loaded according to the index file name R{cell_row}_{cell_column}.idx rule. Specifically, spatial retrieval operations are performed on the grid partition R tree index in parallel according to the input query rectangle range. During the R tree indexing process, ground features (i.e., determining that the ground feature is not a complex geometric object) or ground feature triangulation triangles (i.e., determining that the ground feature is a complex geometric object and using a triangulation algorithm to split the complex geometric object of the ground feature into several ground feature triangulation triangles) are retrieved. The results obtained through triangulation triangles are identified. For the same ground feature triangulation triangle, if there is a triangle that has geometric intersection with the query rectangle range, the corresponding ground feature is added to the query result set and identified.

[0107] In the above-described grid-based R-tree hybrid index retrieval method of the present invention, the feature information mentioned in step 400 may specifically include spatial attribute information and entity attribute information of feature elements.

[0108] Furthermore, in step 100 above, the minimum bounding rectangle of the geometric object is composed of information about the lower left corner and the upper right corner, including the minimum longitude query_minX, the minimum latitude query_minY, the maximum longitude query_maxX, and the maximum latitude query_maxY.

[0109] Furthermore, in step 200 above, the set of grid partitions of the grid region is obtained by using the calculated minimum grid X-direction number cell_minx, minimum grid Y-direction number cell_miny, maximum grid X-direction number cell_maxx, and maximum grid Y-direction number cell_maxy of the grid region spanned by the query rectangle.

[0110] It should be noted that in step 200 above, when specifically calculating the minimum grid X-direction number cell_minx, minimum grid Y-direction number cell_miny, maximum grid X-direction number cell_maxx, and maximum grid Y-direction number cell_maxy across the grid region spanned by the query rectangle, the calculation formula requires the use of the integer calculus function math.Ceil. The calculation formulas for each data point are as follows:

[0111] Formula for calculating the minimum grid number in the X direction:

[0112] cell_minx=math.Ceil(query_minX-grid_minx) / grid_cellsize-1

[0113] Formula for calculating the minimum grid number in the Y direction:

[0114] cell_miny=math.Ceil(query_minY-grid_miny) / grid_cellsize-1

[0115] Formula for calculating the maximum grid number in the X direction:

[0116] cell_maxx=math.Ceil(query_maxX-grid_maxx) / grid_cellsize-1

[0117] Formula for calculating the maximum grid number in the Y direction:

[0118] cell_maxy=math.Ceil(query_maxY-grid_maxy) / grid_cellsize-1

[0119] Furthermore, in step 300 above, spatial retrieval operations are performed in parallel on the R-tree indexes of the corresponding grid partitions according to the range of the query rectangle, so as to collect the result set of each R-tree index, specifically including the following steps 301-303:

[0120] 301: Start the query matching from the root node of the R-tree index, and perform a geometric intersection judgment between the query rectangle range and the root node. If the query rectangle range intersects with the root node it passes through, then a geometric intersection judgment needs to be performed with all child nodes of that root node.

[0121] 302: Traverse the R-tree index using the depth-first search algorithm, iteratively traversing each branch of the R-tree index until the leaf node, and collecting the result set of leaf nodes that have intersections;

[0122] 303: After removing duplicates from all retrieved result sets, merge them into the result set corresponding to the R tree.

[0123] In addition, further reading Figure 4 As can be seen, the present invention also designs a retrieval device based on a grid R-tree hybrid index, which is used to implement the above-mentioned retrieval method based on a grid R-tree hybrid index.

[0124] like Figure 4 As shown, in this embodiment, the retrieval device based on a grid R-tree hybrid index designed in this invention may specifically include:

[0125] The index metadata module records the basic data information of the grid-R-tree hybrid index. This basic data information includes grid initialization parameters and R-tree parameters. The grid initialization parameters may include the minimum longitude (grid_minx), minimum latitude (grid_miny), maximum longitude (grid_maxx), maximum latitude (grid_maxy), grid size (grid_cellsize), number of rows (grid_rows), and number of columns (grid_columns). The R-tree parameters may include the R-tree filename and the maximum number of nodes (N) in the R-tree.

[0126] The triangulation module is used to determine whether a feature is a complex geometric object and to triangulate the complex geometric object into several feature triangulation triangles.

[0127] A grid index module is used to calculate the grid index of geographic features and generate a grid index structure based on the index metadata information.

[0128] The R-tree index module is used to generate and load R-tree index files, and provides R-tree index data node insertion algorithms and R-tree space query algorithms.

[0129] The global grid index partitioning module is used to generate and load global grid index partitioning mapping files, and provides the function of establishing the mapping relationship between the sequential number of ground feature elements and the unique number of ground feature elements.

[0130] The feature storage module is used to generate and load feature storage files, and provides functions for storing basic attribute information of feature elements, serializing spatial geometric objects of feature elements, and serializing and storing related attribute information of feature elements.

[0131] The query data preprocessing module is used to preprocess the input geometric objects, generate the corresponding minimum bounding rectangle according to the geometric object feature type, and call the grid index module and R-tree index module to realize spatial retrieval.

[0132] The query result set generation module can merge the query candidate feature result sets and perform precise geometric matching between the query input geometric object and the candidate result set to generate the final feature result set.

[0133] In summary, this invention employs a divide-and-conquer approach for storage optimization. It partitions the massive spatial vector data using a grid-based first-level index, with each partition corresponding to a storage file, ensuring that each partition file corresponds to an R-tree index. The inventors creatively combine grid indexes with R-tree indexes, effectively leveraging the advantages of both, resulting in a complementary hybrid index. Specifically, the partitioned R-tree index reduces the height of a single R-tree, decreasing the geometric intersection determination between the query rectangle and the rectangles of nodes at multiple levels, thereby improving query efficiency.

[0134] Furthermore, in this invention, by triangulating complex geometric objects, the complex geometric objects can be broken down into several simplified triangulation triangles of ground features, thereby improving the efficiency of precise geometric calculations of complex objects, improving query efficiency, and reducing CPU resource utilization.

[0135] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for constructing a hybrid index based on a grid R-tree, characterized in that, The method comprises the steps of: S1: initializing a grid hybrid index data structure by using grid initialization parameters; S2: generating a global grid index partition mapping file and storing in the global grid index partition mapping file the ground feature element sequence number and the ground feature element unique number of each ground feature element; S3: generating a ground feature element storage file and storing in the ground feature element storage file the ground feature element information of each ground feature element; S4: analyzing and judging the geometric range parameter, the number of constituent points, and the number of constituent multi-face holes in the ground feature element information of each ground feature element, and if the geometric range parameter, the number of constituent points, and the number of constituent multi-face holes exceed a set threshold value, judging that the ground feature element is a complex geometric object, and splitting the complex geometric object of the ground feature element into a plurality of ground feature element triangulation triangles by using a triangulation algorithm; S5: calculating the grid partition set of the ground feature element in combination with the minimum circumscribed rectangle of the ground feature element and / or the ground feature element triangulation triangle and the grid initialization parameters, wherein the minimum circumscribed rectangle of the ground feature element and / or the ground feature element triangulation triangle is composed of the information of the lower-left corner point and the upper-right corner point, and specifically includes the minimum longitude minX, the minimum latitude minY, the maximum longitude maxX, and the maximum latitude maxY; the minimum grid X direction number cell_minx, the minimum grid Y direction number cell_miny, the maximum grid X direction number cell_maxx, and the maximum grid Y direction number cell_maxy of the grid region crossed by the ground feature element or the ground feature element triangulation triangle can be calculated through the above information, and the corresponding grid partition set can be obtained; S6: traversing the grid partition set of the ground feature element, and establishing an R-tree index corresponding to each grid partition.

2. The method of claim 1, wherein, In step S6, the R-tree index corresponding to each grid partition is established, and specifically comprises the following steps: S61: initializing the R-tree index, creating an R-tree index file, and setting the maximum node number N of the R-tree node; S62: when inserting the R-tree index file, first selecting a suitable path for inserting the ground feature element index item from the root node, performing geometric relationship operation on the minimum circumscribed rectangle of the ground feature element and the rectangle range of each node to find an insertion path from the root node to the leaf node; S63: inserting the ground feature element index item into the leaf node of the insertion path in an appended manner; S64: if the node number of the leaf node is full, that is, exceeds the maximum node number N of the R-tree node, the leaf node will be split into two nodes, and the whole process is propagated from the leaf node to the root node along the insertion path; if the root node is split, the whole R-tree index will increase by one layer. 3.The method of claim 1, wherein, In step S1, the grid hybrid index data structure is initialized according to the grid minimum longitude grid_minx, the grid minimum latitude grid_miny, the grid maximum longitude grid_maxx, the grid maximum latitude grid_maxy, the grid size grid_cellsize, the grid row number grid_rows, and the grid column number grid_columns.

4. The method of claim 1, wherein, In step S2, the ground object element sequence number is generated in the order of integer sequence number from 1 in the ground object element index construction, and the ground object element unique number is a string of ground object element unique identification.

5. The method of claim 1, wherein, In step S3, the ground object element information includes ground object element spatial attribute information and ground object element entity attribute information, the ground object element spatial attribute information includes ground object element geometric object shape, and the ground object element entity attribute information includes ground object element unique number identification and ground object element name.

6. A method for retrieving based on a grid R-tree hybrid index, wherein the grid R-tree hybrid index is constructed according to the method for constructing a grid R-tree hybrid index of any one of claims 1-5, characterized in that, The steps include: 100: according to the input geometric object shape, calculating the minimum circumscribed rectangle of the geometric object as a query rectangular range of spatial data; 200: combining the grid initialization parameters to calculate the grid partition set in which the query rectangular range is located; 300: traversing the grid partition set, loading the R-tree index of the corresponding grid partition, and performing a spatial retrieval operation on the R-tree index of the corresponding grid partition in parallel according to the query rectangular range, to collect the result set of each R-tree index, remove the repeated ground object element sequence numbers in the result set, and merge into a candidate ground object element number result set; 400: traversing the candidate ground object element number result set, obtaining the ground object element unique number of each ground object element from the relationship of the global grid index partition mapping file, and then obtaining the ground object element information of the corresponding ground object element from the ground object element storage file to constitute a complete candidate ground object element result set; 500: traversing the candidate ground object element result set, obtaining the candidate ground object elements filtered by the ground object element subdivision triangle, and performing accurate geometric intersection judgment on other ground object element geometric object shapes and the input geometric object shape, to filter out the intersection ground object element result set, and directly adding the candidate ground object elements filtered by the ground object element subdivision triangle to the intersection ground object element result set, to generate the final ground object element result set.

7. The grid R-tree hybrid index-based retrieval method according to claim 6, wherein, In step 100, the minimum circumscribed rectangle of the geometric object is composed of the left lower corner point and the right upper corner point information, including the minimum longitude query_minX, the minimum latitude query_minY, the maximum longitude query_maxX and the maximum latitude query_maxY.

8. The grid R-tree hybrid index-based retrieval method according to claim 6, wherein, In step 200, the grid partition set of the grid region is obtained through the minimum grid X direction number cell_minx, the minimum grid Y direction number cell_miny, the maximum grid X direction number cell_maxx and the maximum grid Y direction number cell_maxy of the grid region across which the calculated query rectangular range spans.

9. The grid R-tree hybrid index-based retrieval method according to claim 6, wherein, In step 300, according to the query rectangular range, the spatial retrieval operation is performed in parallel on the R-tree index of the corresponding grid partition to collect the result set of each R-tree index, which specifically includes steps 301-302: 301: starting from the root node of the R-tree index to query the match, performing geometric intersection judgment on the query rectangular range and the root node, if the query rectangular range intersects with the root node, geometric intersection judgment needs to be performed on all child nodes of the root node; 302: traverse the R-tree index according to the depth-first algorithm, iteratively traverse each branch of the R-tree index until the leaf node, and collect the intersected leaf node result set; 303: after removing the duplicate result set obtained by searching, merge the result set corresponding to the R-tree.

10. A retrieval device based on a grid R-tree hybrid index construction, characterized in that, Comprise: an index metadata module for recording the basic data information of the grid R-tree hybrid index, the basic data information including grid initialization parameter information and R-tree parameter information; a triangulation module for judging whether a feature element is a complex geometric object, and performing triangulation on the complex geometric object, i.e. analyzing and judging the geometric range parameter, the number of constituent points, and the number of constituent multi-faceted holes in the feature element information of each feature element, if the geometric range parameter, the number of constituent points, and the number of constituent multi-faceted holes exceed a set threshold, the feature element is judged to be a complex geometric object, and the complex geometric object of the feature element is divided into a plurality of feature element triangulation triangles by using a triangulation algorithm; the grid partition set of the feature element is calculated by combining the minimum circumscribed rectangle of the feature element and / or the feature element triangulation triangle and the grid initialization parameter information; wherein the minimum circumscribed rectangle of the feature element and / or the feature element triangulation triangle is composed of the left lower corner point and the right upper corner point information; a grid index module for calculating the grid index of the feature element, and generating a grid index structure according to the index metadata information; an R-tree index module for generating and loading an R-tree index file, and providing an R-tree index data node insertion algorithm and an R-tree space query algorithm; a global grid index partition module for generating and loading a global grid index partition mapping file, and providing a mapping relationship establishment function of the sequential number of the feature element and the unique number of the feature element; a feature element storage module for generating and loading a feature element storage file, providing a basic attribute information storage function of the feature element, a serialization function of the spatial geometric object of the feature element, and a serialization storage function of the related attribute information of the feature element; a query data preprocessing module for realizing data preprocessing of an input geometric object, generating a corresponding minimum circumscribed rectangle according to the geometric object element type, and calling the grid index module and the R-tree index module to realize spatial searching; a query result set generation module capable of merging the query candidate feature element result set, and performing accurate geometric matching on the query input geometric object and the candidate result set to generate a final feature element result set.

Citation Information

Patent Citations

  • Method for indexing spatial data in cloud computing environment

    CN108009265A

  • Three-dimensional adaptive grid R + tree hybrid index construction, maintenance and query method

    CN113901156A