Fast area identification method and device based on multi-level index
Through the multi-level indexing method combined with quadratic and triangular segmentation algorithm, the problem of low computing efficiency in aircraft area recognition is solved, faster and more accurate area recognition is achieved, and the query performance of the geographical information system is improved.
Patent Information
- Application Number
- CN202411329459.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-10
AI Technical Summary
The prior art has low computational efficiency in aircraft area identification and cannot meet the requirements of fast computing, resulting in insufficient identification accuracy and efficiency.
The multi-level indexing method is adopted, combined with the quadratic segmentation and triangular segmentation algorithm, and the organization efficiency and query performance of map data are improved through primary spatial index and secondary spatial index to determine whether the aircraft is located in the preset area.
It significantly improves the organizational efficiency and query performance of spatial data, enables the geographic information system to respond to query requests faster and more accurately, and provides better geographic information services.
Smart Images

Figure CN119293038A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of rapid map positioning, and in particular to a rapid region recognition method and device based on multi-level indexing. Background Art
[0002] In response to the requirements for regional safe use of aircraft, regional identification technology research is carried out. Based on the longitude and latitude position information given by the aircraft, it is compared with the regional electronic map stored internally to determine the relative relationship between the aircraft and the given area in the electronic map, calculate whether the current position of the aircraft is within the given area, and create a set of fast identification algorithms to efficiently and accurately identify whether the aircraft has entered the given area. The existing commonly used calculation methods include using angle and discrimination methods, horizontal / vertical intersection point discrimination methods and other algorithms to determine whether a point is within the area, and in order to increase the calculation efficiency of complex surfaces, the data will be thinned or divided into multiple polygons for calculation, but this method will result in different degrees of calculation accuracy and low calculation efficiency, and cannot meet the requirements of fast calculation. Summary of the invention
[0003] The purpose of the embodiment of the present invention is to provide a method and device for fast region identification based on multi-level indexing, which not only improves the efficiency of spatial data organization, but also optimizes the performance of spatial query and analysis by combining secondary subdivision and triangulation algorithms with spatial indexing. This combination enables the geographic information system to respond to query requests more quickly and analyze spatial data more accurately, thereby providing users with better quality geographic information services.
[0004] To solve the above technical problem, a first aspect of an embodiment of the present invention provides a fast region recognition method based on a multi-level index, comprising the following steps:
[0005] Acquire map data of a preset area, divide the map data once to obtain a plurality of rectangular blocks and a plurality of irregular blocks that can be spliced, and establish a spatial index of the plurality of rectangular blocks and the plurality of irregular blocks, wherein the plurality of irregular blocks are located at the edge of the map;
[0006] Perform secondary triangulation on each of the irregular blocks to obtain a plurality of triangular face sub-blocks that can be spliced into the irregular block, and establish a secondary spatial index corresponding to the primary spatial index of the irregular block, wherein the secondary spatial index corresponds to the plurality of triangular face sub-blocks of the irregular block;
[0007] Acquire coordinate data of a preset point, and obtain a plurality of target rectangular blocks or a plurality of target irregular blocks corresponding to the coordinate data and a plurality of target triangular face sub-blocks corresponding thereto based on the primary spatial index and the secondary spatial index;
[0008] It is determined whether the preset point is located in the target rectangular blocks or the target irregular blocks and their corresponding target triangular face sub-blocks. If so, it is determined that the preset point is located in the preset area. Otherwise, it is determined that the preset point is located outside the preset area.
[0009] Further, the determining whether the preset point is located in the plurality of target rectangular blocks or the plurality of target irregular blocks and the plurality of target triangular face sub-blocks corresponding thereto includes:
[0010] Based on the coordinate data of the preset point, combined with the primary spatial index, determining whether the preset point is located in the preset area;
[0011] If not, it is determined that the preset point is outside the preset area;
[0012] If so, determine whether the preset point is located in the target rectangular block or in the target irregular block. If the preset point is located in the target rectangular block, determine that the point is inside the preset area. If the preset point is located in the target irregular block, determine whether the preset point is located in a target triangular face sub-block in the target irregular block through the secondary spatial index.
[0013] Further, the determining whether the preset point is located in a target triangular face sub-block in the irregular block in combination with the secondary spatial index includes:
[0014] Based on the coordinate data of the preset point, in combination with the secondary space search, searching for the circumscribed rectangle or the minimum bounding rectangle of the triangular surface sub-block close to the coordinate data from among the plurality of triangular surface sub-blocks;
[0015] Based on the circumscribed rectangle or the minimum bounding rectangle, a target triangular surface sub-block corresponding to the preset point is determined.
[0016] Furthermore, the primary spatial index and the secondary spatial index include: index identifier, boundary data and centroid coordinates;
[0017] The boundary data includes: the rectangular block, the irregular block level and the triangular face sub-block.
[0018] Further, the boundary data also includes: coordinate data of three vertices of the target triangle sub-block;
[0019] The determining whether the preset point is located in a target triangular face sub-block in the target irregular block in combination with the secondary spatial index includes:
[0020] Based on the plurality of target triangular surface sub-blocks, respectively calculating the distance value between the preset point coordinates and each vertex of each target triangular surface sub-block;
[0021] According to the distance values between the preset point coordinates and each vertex of the target triangular surface sub-block, it is determined whether the preset point is located inside the target triangular surface sub-block.
[0022] Furthermore, after obtaining the coordinate data of the preset point, the method further includes:
[0023] Calculating a distance between the coordinate data of the preset point and the coordinate data of a historical preset point;
[0024] In combination with the positional relationship between the historical preset point and the boundary of the preset area, it is determined whether the preset point is located inside the preset area based on the distance value.
[0025] Furthermore, the methods for establishing the primary spatial index and the secondary spatial index include: a grid index method, a quadtree index method, a Kd tree index method or an R tree index method.
[0026] Accordingly, a second aspect of an embodiment of the present invention provides a fast region identification device based on a multi-level index, comprising:
[0027] A primary segmentation module, which is used to obtain map data of a preset area, perform a primary segmentation on the map data to obtain a plurality of rectangular blocks and a plurality of irregular blocks that can be spliced, and establish a primary spatial index of the plurality of rectangular blocks and the plurality of irregular blocks, wherein the plurality of irregular blocks are located at the edge of the map;
[0028] A secondary triangulation module, which is used to perform secondary triangulation on each of the irregular blocks to obtain a plurality of triangular face sub-blocks that can be spliced into one of the irregular blocks, and to establish a secondary spatial index corresponding to the primary spatial index of the irregular block, wherein the secondary spatial index corresponds to the plurality of triangular face sub-blocks of the irregular block;
[0029] An index retrieval module, which is used to obtain coordinate data of a preset point, and obtain a plurality of target rectangular blocks or a plurality of target irregular blocks corresponding to the coordinate data and a plurality of target triangular face sub-blocks corresponding thereto based on the primary spatial index and the secondary spatial index;
[0030] The first position judgment module is used to judge whether the preset point is located in the target rectangular blocks or the target irregular blocks and their corresponding target triangular face sub-blocks. If so, the preset point is determined to be located in the preset area; otherwise, the preset point is determined to be located outside the preset area.
[0031] Furthermore, the first position determination module includes:
[0032] A first judging unit, configured to judge whether the preset point is located in the preset area based on the coordinate data of the preset point in combination with the primary spatial index;
[0033] a second judging unit, configured to judge, if no, that the preset point is outside the preset area;
[0034] A third judgment unit is used to judge whether the preset point is located in the target rectangular block or in the target irregular block. If the preset point is located in the target rectangular block, it is determined that the point is inside the preset area. If the preset point is located in the target irregular block, it is determined by a secondary spatial index whether the preset point is located in a target triangular face sub-block in the target irregular block.
[0035] Further, the third judgment unit includes:
[0036] A rectangle search subunit, which is used to search, based on the coordinate data of the preset point and in combination with the secondary space search, for a circumscribed rectangle or a minimum bounding rectangle of the triangular face sub-block close to the coordinate data from among the plurality of triangular face sub-blocks;
[0037] The sub-block acquisition sub-unit is used to determine a sub-block of the target triangular surface corresponding to the preset point based on the circumscribed rectangle or the minimum bounding rectangle.
[0038] Furthermore, the primary spatial index and the secondary spatial index include: index identifier, boundary data and centroid coordinates;
[0039] The boundary data includes: the rectangular block, the irregular block level and the triangular face sub-block.
[0040] Further, the boundary data also includes: coordinate data of three vertices of the target triangle sub-block;
[0041] The third judgment unit also includes:
[0042] A distance calculation subunit, which is used to calculate the distance value between the preset point coordinates and each vertex of each target triangular surface sub-block based on the plurality of target triangular surface sub-blocks;
[0043] The position determination subunit is used to determine whether the preset point is located inside a target triangular surface sub-block according to the distance values between the coordinates of the preset point and each vertex of the target triangular surface sub-block.
[0044] Furthermore, the multi-level index-based rapid region recognition device further includes: a second position determination module, which further includes:
[0045] A historical data calculation unit, which is used to calculate the distance between the coordinate data of the preset point and the coordinate data of a historical preset point;
[0046] A fourth judgment unit is used to judge whether the preset point is located inside the preset area based on the distance value in combination with the positional relationship between the historical preset point and the boundary of the preset area.
[0047] Furthermore, the methods for establishing the primary spatial index and the secondary spatial index include: a grid index method, a quadtree index method, a Kd tree index method or an R tree index method.
[0048] Correspondingly, the third aspect of an embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the above-mentioned multi-level index-based rapid region recognition method.
[0049] Correspondingly, a fourth aspect of an embodiment of the present invention further provides a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the above-mentioned fast region recognition method based on multi-level indexing is implemented.
[0050] The above technical solution of the embodiment of the present invention has the following beneficial technical effects:
[0051] The combination of triangulation algorithm and spatial index not only improves the efficiency of spatial data organization, but also optimizes the performance of spatial query and analysis. This combination enables the geographic information system to respond to query requests more quickly and analyze spatial data more accurately, thereby providing users with better geographic information services. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 is a flow chart of a fast region identification method based on multi-level indexing provided by an embodiment of the present invention;
[0053] Figure 2 It is a logical schematic diagram of a fast region identification method based on multi-level indexing provided by an embodiment of the present invention;
[0054] Figure 3 It is a module block diagram of a fast region identification device based on multi-level indexing provided by an embodiment of the present invention;
[0055] Figure 4 is a block diagram of a first position determination module provided by an embodiment of the present invention;
[0056] Figure 5 is a block diagram of a third judgment unit provided by an embodiment of the present invention;
[0057] Figure 6 This is a block diagram of a second position determination module provided in an embodiment of the present invention.
[0058] Reference numerals:
[0059] 1. Primary segmentation module, 2. Secondary segmentation module, 3. Index retrieval module, 4. First position judgment module, 41. First judgment unit, 42. Second judgment unit, 43. Third judgment unit, 431. Rectangular retrieval subunit, 432. Sub-block acquisition subunit, 433. Distance calculation subunit, 434. Position judgment subunit, 5. Second position judgment module, 51. Historical data calculation unit, 52. Fourth judgment unit. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.
[0061] Please refer to Figure 1 and Figure 2 A first aspect of an embodiment of the present invention provides a fast region recognition method based on a multi-level index, comprising the following steps:
[0062] Step S100, obtaining map data of a preset area, dividing the map data once to obtain a plurality of rectangular blocks and a plurality of irregular blocks that can be spliced, and establishing a spatial index of the plurality of rectangular blocks and the plurality of irregular blocks, wherein the plurality of irregular blocks are located at the edge of the map.
[0063] Spatial index refers to a data structure that is arranged in a certain order according to the location and shape of spatial objects or a certain spatial relationship between spatial objects. It contains summary information of spatial objects, such as the object's identifier, circumscribed rectangle, and pointer to the spatial object entity. Spatial index can be regarded as a form of spatial data query, which is used to describe the location information of data stored on the medium, thereby improving the efficiency of the system in acquiring data. It is also called spatial access method (SAM). As an auxiliary spatial data structure, spatial index is located between spatial operation algorithms and spatial objects. Through screening, a large number of spatial objects that are not related to specific spatial operations are excluded, thereby improving the speed and efficiency of spatial operations. The method of spatial index mainly includes adding a special external spatial data structure to the system to provide spatial attributes with the same function as B-tree for linear attributes; and using space filling curves (such as Z order, Hilbert curve) to map spatial objects to one-dimensional space so that spatial objects can be stored in a standard one-dimensional index. In general, spatial index is a technical means to optimize the efficiency of spatial data query and data acquisition. Through specific data structures and methods, fast access and efficient processing of spatial data can be achieved.
[0064] The above-mentioned primary spatial index corresponds to the rectangular block and the irregular block, and the data of the rectangular block and the irregular block can be obtained based on the primary spatial index.
[0065] Step S200, performing secondary triangulation on each irregular block to obtain a plurality of triangular face sub-blocks that can be spliced into an irregular block, and establishing a secondary spatial index corresponding to the primary spatial index of the irregular block, wherein the secondary spatial index corresponds to the plurality of triangular face sub-blocks of the irregular block.
[0066] The triangulation algorithm is a basic data structure commonly used in spatial geographic information systems (GIS). This algorithm divides convex polygons through a set of triangles and can be applied to the construction of surfaces and spatial topology as well as the construction of ground object schematics. In triangulation, polygons are converted into a set of triangles that meet specific conditions. These conditions ensure that the triangles have the best shape characteristics. For example, any edge of a triangle should not be too short or too long, and two triangles should not share an edge that is too long, thereby ensuring the balance of triangles and good computing performance. The triangulation algorithm plays an important role in calculations such as finite element simulation and ray tracing rendering. It optimizes the efficiency of spatial data query and data acquisition by converting geometric models into triangular mesh data. The triangulation algorithm is an effective spatial data structure that is used to divide polygons and optimize the shape characteristics of triangles, thereby improving computing performance and the efficiency of spatial data processing.
[0067] Delaunay triangulation is a commonly used special triangulation. Its definition is: if a triangulation T of a point set V contains only Delaunay edges, then the triangulation is called a Delaunay triangulation. Among them, the Delaunay edge is defined as follows: there is an edge e belonging to E, and there is a circle passing through the two endpoints a and b of the edge, and the circle (note that it is inside the circle, and at most three points on the circle are co-circular) does not contain any other points in the point set V. Such an edge is called a Delaunay edge.
[0068] The secondary spatial index in step S200 corresponds to a number of triangular surface sub-blocks in each irregular block, and data of each triangular surface sub-block can be obtained based on the secondary spatial index.
[0069] Step S300, obtaining coordinate data of a preset point, and obtaining a plurality of target rectangular blocks or a plurality of target irregular blocks corresponding to the coordinate data and a plurality of corresponding target triangular face sub-blocks based on the primary spatial index and the secondary spatial index.
[0070] The combination of triangulation algorithm and spatial index is mainly reflected in the organization, query and processing of spatial data. This combination enables geographic information system (GIS) to manage, retrieve and analyze complex spatial data more efficiently. First, the triangulation algorithm divides spatial data into a series of triangles, which not only meet specific conditions such as shape optimization and balance, but also can fully represent the original spatial data. In this way, triangulation provides a compact and easy-to-process data structure, which provides a basis for the establishment of spatial index. Secondly, spatial index is a data structure arranged in a certain order based on the position and shape of spatial objects or a certain spatial relationship between spatial objects. Based on triangulation, spatial indexes for these triangles can be established. For example, each triangle can be assigned a unique identifier and associated with its circumscribed rectangle, centroid or other spatial features. This feature information is stored in the spatial index to quickly locate and access specific triangles. When performing spatial queries or analysis, the spatial index can quickly determine which triangles are related to the query area or analysis operation. Then, these triangles and their related spatial data can be further processed to meet specific query requirements or perform complex spatial analysis.
[0071] Step S400, determining whether the preset point is located in a plurality of target rectangular blocks or a plurality of target irregular blocks and their corresponding plurality of target triangular face sub-blocks, if so, determining that the preset point is located in a preset area, otherwise determining that the preset point is located outside the preset area.
[0072] Therefore, the combination of quadratic subdivision and triangulation algorithms with spatial indexing not only improves the efficiency of spatial data organization, but also optimizes the performance of spatial query and analysis. This combination enables the geographic information system to respond to query requests more quickly and analyze spatial data more accurately, thereby providing users with better geographic information services.
[0073] Specifically, the determination in step S400 of whether the preset point is located in a plurality of target rectangular blocks or a plurality of target irregular blocks and their corresponding plurality of target triangular face sub-blocks includes:
[0074] Step S410: Based on the coordinate data of the preset point and in combination with the primary spatial index, it is determined whether the preset point is located in the preset area.
[0075] Step S420: If the preset point is not located in the preset area, it is determined that the preset point is located outside the preset area.
[0076] Step S430, if the preset point is located in the preset area, determine whether the preset point is located in the target rectangular block or in the target irregular block; if the preset point is located in the target rectangular block, determine that the point is inside the preset area; if the preset point is located in the target irregular block, determine whether the preset point is located in a target triangular face sub-block in the target irregular block through a secondary spatial index.
[0077] Furthermore, the step S430 of combining the secondary spatial index to determine whether the preset point is located in a target triangular face sub-block in the irregular block includes:
[0078] Step S431 : Based on the coordinate data of the preset point, in combination with the secondary space search, a circumscribed rectangle or a minimum bounding rectangle of a triangular face sub-block close to the coordinate data is searched in a plurality of triangular face sub-blocks.
[0079] Step S432: determining a target triangular face sub-block corresponding to the preset point based on the circumscribed rectangle or the minimum bounding rectangle.
[0080] The circumscribed rectangle or minimum bounding rectangle (MBR) of a triangle is the smallest rectangle that can completely contain all the vertices of a triangle. This rectangle is usually closely related to the shape and size of the triangle, but it is not always parallel to one of the sides of the triangle. The minimum bounding rectangle helps to quickly determine which triangles may intersect with the query point or query area, thereby speeding up the spatial query and indexing process.
[0081] When calculating the minimum bounding rectangle, you usually need to consider all the vertices of the triangle and find the maximum and minimum coordinate values of these vertices on the X-axis and Y-axis. These coordinate values define the boundaries of the rectangle, ensuring that the triangle is completely inside the rectangle. The minimum bounding rectangle can be used in various spatial data structures, such as R-trees, to efficiently store and query spatial objects.
[0082] In spatial indexes, the minimum bounding rectangle is used as a fast filtering mechanism to narrow the search range and improve query efficiency by excluding triangles that obviously do not contain the query target. When performing a spatial query, first check whether the query area intersects with the minimum bounding rectangle of the triangle. If so, further consider whether the triangle meets the query condition. This approach significantly reduces the number of triangles that need to be checked in detail, thereby improving query performance.
[0083] In addition, the primary spatial index and the secondary spatial index both include: index identifier, boundary data and centroid coordinates. The boundary data includes: the rectangular block, the irregular block level and the triangular face sub-block.
[0084] Furthermore, the boundary data also includes: coordinate data of three vertices of the target triangle sub-block.
[0085] Optionally, methods for determining whether a preset point is located in several target triangular face sub-blocks include: area method, vector method, ray method, barycentric coordinate method or same-side method. To determine whether a point on a plane is located inside a triangle, multiple methods can be used, including:
[0086] 1. Area method:
[0087] Calculate the areas of the three small triangles formed by the point and the three vertices of the triangle. If the sum of the areas of these three small triangles is equal to the area of the original triangle, the point is inside the triangle; if the sum of the areas is less than the area of the original triangle, the point is outside the triangle.
[0088] 2. Vector method:
[0089] Starting from a vertex of the triangle, traverse the edges of the triangle in a counterclockwise direction. If the point is always on the left side of the forward direction, the point is inside the triangle; otherwise, the point is outside the triangle.
[0090] 3. Ray method:
[0091] Draw a horizontal ray to the left from the point to be judged. If the number of intersections between this ray and the triangle is odd, the point is inside the triangle; if the number of intersections is even, the point is outside the triangle.
[0092] 4. Barycentric coordinate method:
[0093] The point's position is determined by calculating its barycentric coordinates. If the point's barycentric coordinates are within the triangle's barycentric coordinate range (i.e., all coordinate values are between 0 and 1), then the point is inside the triangle.
[0094] 5. Same side method:
[0095] Construct vectors and calculate cross products respectively to determine the position of the point relative to the sides of the triangle. If the point is on the same side relative to all sides of the triangle, the point is inside the triangle.
[0096] Optionally, in the embodiment of the present invention, the step S430 of combining the secondary spatial index to determine whether the preset point is located in a target triangular face sub-block in the target irregular block further includes:
[0097] Step S433 , based on a plurality of target triangular surface sub-blocks, respectively calculating the distance value between the preset point coordinates and each vertex of each target triangular surface sub-block.
[0098] Step S434 , judging whether the preset point is located inside the target triangular surface sub-block according to the distance values between the preset point coordinates and each vertex of the target triangular surface sub-block.
[0099] Furthermore, after obtaining the coordinate data of the preset point in step S300, the method further includes:
[0100] S510, calculating a distance value between coordinate data of a preset point and coordinate data of a historical preset point.
[0101] S520: Based on the positional relationship between the historical preset point and the boundary of the preset area, it is determined whether the preset point is located inside the preset area based on the distance value.
[0102] Specifically, the method for establishing the primary spatial index and the secondary spatial index in the embodiment of the present invention includes: a grid index method, a quadtree index method, a Kd tree index method or an R tree index method.
[0103] Optionally, the spatial indexing method includes: grid indexing method, quadtree indexing method, Kd tree indexing method or R tree indexing method. The spatial indexing construction method includes:
[0104] 1. Grid index: For a two-dimensional coordinate set, use a grid to divide it into different subdivisions and create an index. This method can effectively reduce the search range from the set of all points to the search of the set of points within a certain range.
[0105] 2. Quadtree index: Similar to grid index, it reduces the number of searches by creating subdivided regions. Quadtree index divides each region into four parts (similar to a rectangular coordinate system) through an iterative method. Depending on the number of points in different regions, the quadtree index may eventually generate an extremely unbalanced tree.
[0106] 3. Kd tree index: Kd tree can establish partition index for multidimensional data. It finds the dimension with the largest variance in each dimension, divides the data set into two subtrees with the median of this dimension as the root node, and then recursively performs the above steps on the two subtrees to establish Kd tree.
[0107] 4. R-tree index: By establishing the minimum enclosing rectangle of the node, and then iteratively establishing the minimum enclosing rectangle for these minimum enclosing rectangles, the space is divided.
[0108] Accordingly, please refer to Figure 3 A second aspect of an embodiment of the present invention provides a fast region identification device based on a multi-level index, comprising:
[0109] A primary segmentation module 1 is used to obtain map data of a preset area, perform a primary segmentation on the map data to obtain a plurality of rectangular blocks and a plurality of irregular blocks that can be spliced, and establish a primary spatial index of the plurality of rectangular blocks and the plurality of irregular blocks, wherein the plurality of irregular blocks are located at the edge of the map;
[0110] A secondary triangulation module 2 is used to perform secondary triangulation on each irregular block to obtain a plurality of triangular face sub-blocks that can be spliced into an irregular block, and to establish a secondary spatial index corresponding to the primary spatial index of the irregular block, wherein the secondary spatial index corresponds to the plurality of triangular face sub-blocks of the irregular block;
[0111] An index retrieval module 3 is used to obtain the coordinate data of a preset point, and obtain a number of target rectangular blocks or a number of target irregular blocks corresponding to the coordinate data and a number of target triangular face sub-blocks corresponding thereto based on the primary spatial index and the secondary spatial index;
[0112] The first position judgment module 4 is used to judge whether the preset point is located in a plurality of target rectangular blocks or a plurality of target irregular blocks and their corresponding plurality of target triangular face sub-blocks. If so, the preset point is judged to be located in a preset area; otherwise, the preset point is judged to be located outside the preset area.
[0113] For further information, please refer to Figure 4 , the first position determination module 4 includes:
[0114] A first judging unit 41, configured to judge whether the preset point is located in the preset area based on the coordinate data of the preset point in combination with the primary spatial index;
[0115] A second judging unit 42, which is used to judge that the preset point is outside the preset area if no;
[0116] The third judgment unit 43 is used to judge whether the preset point is located in the target rectangular block or in the target irregular block. If the preset point is located in the target rectangular block, it is determined that the point is inside the preset area. If the preset point is located in the target irregular block, it is determined by the secondary spatial index whether the preset point is located in a target triangular face sub-block in the target irregular block.
[0117] For further information, please refer to Figure 5 , the third judgment unit 43 includes:
[0118] A rectangle search subunit 431 is used to search for a circumscribed rectangle or a minimum bounding rectangle of a triangular face subblock close to the coordinate data among several triangular face subblocks based on the coordinate data of the preset point in combination with the secondary space search;
[0119] The sub-block obtaining sub-unit 432 is used to determine a target triangular surface sub-block corresponding to the preset point based on the circumscribed rectangle or the minimum bounding rectangle.
[0120] Furthermore, the primary spatial index and the secondary spatial index include: an index identifier, boundary data and centroid coordinates; the boundary data includes: the rectangular block, the irregular block level and the triangular face sub-block.
[0121] Furthermore, the boundary data also includes: coordinate data of three vertices of the target triangle sub-block.
[0122] At this time, the third judgment unit 43 further includes:
[0123] A distance calculation subunit 433, which is used to calculate the distance value between the preset point coordinates and each vertex of each target triangular surface sub-block based on a plurality of target triangular surface sub-blocks;
[0124] The position determination subunit 434 is used to determine whether the preset point is located inside the target triangular surface sub-block according to the distance values between the coordinates of the preset point and each vertex of the target triangular surface sub-block.
[0125] For further information, please refer to Figure 6 The fast region recognition device based on multi-level indexing further includes: a second position determination module 5, which further includes:
[0126] A historical data calculation unit 51, which is used to calculate the distance between the coordinate data of the preset point and the coordinate data of a historical preset point;
[0127] The fourth judgment unit 52 is used to judge whether the preset point is located inside the preset area based on the distance value in combination with the positional relationship between the historical preset point and the boundary of the preset area.
[0128] Furthermore, the methods for establishing the primary spatial index and the secondary spatial index include: a grid index method, a quadtree index method, a Kd tree index method or an R tree index method.
[0129] Correspondingly, the third aspect of an embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the above-mentioned multi-level index-based rapid region recognition method.
[0130] Correspondingly, a fourth aspect of an embodiment of the present invention further provides a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the above-mentioned fast region recognition method based on multi-level indexing is implemented.
[0131] The embodiment of the present invention aims to protect a method and device for rapid area recognition based on multi-level indexing, wherein the method includes the following steps: obtaining map data of a preset area, performing a primary triangulation on the map data to obtain a number of rectangular blocks and a number of irregular blocks that can be spliced together, and establishing a primary spatial index of the several rectangular blocks and the several irregular blocks, wherein the several irregular blocks are located at the edge of the map; performing a secondary triangulation on each irregular block to obtain a number of triangular face sub-blocks that can be spliced together into an irregular block, and establishing a secondary spatial index corresponding to the primary spatial index of the irregular block, wherein the secondary spatial index corresponds to the several triangular face sub-blocks of the irregular block; obtaining coordinate data of a preset point, and obtaining a number of target rectangular blocks or a number of target irregular blocks and their corresponding number of target triangular face sub-blocks based on the primary spatial index and the secondary spatial index; judging whether the preset point is located in the number of target rectangular blocks or the number of target irregular blocks and their corresponding number of target triangular face sub-blocks, if so, determining that the preset point is located in the preset area, otherwise determining that the preset point is located outside the preset area. The above technical scheme has the following effects:
[0132] The combination of quadratic subdivision, triangulation algorithm and spatial index not only improves the efficiency of spatial data organization, but also optimizes the performance of spatial query and analysis. This combination enables the geographic information system to respond to query requests more quickly and analyze spatial data more accurately, thereby providing users with better geographic information services.
[0133] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0134] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A fast region recognition method based on multi-level indexing, characterized in that: The steps include: Acquire map data of a preset area, divide the map data once to obtain a plurality of rectangular blocks and a plurality of irregular blocks that can be spliced, and establish a spatial index of the plurality of rectangular blocks and the plurality of irregular blocks, wherein the plurality of irregular blocks are located at the edge of the map; Perform secondary triangulation on each of the irregular blocks to obtain a plurality of triangular face sub-blocks that can be spliced into the irregular block, and establish a secondary spatial index corresponding to the primary spatial index of the irregular block, wherein the secondary spatial index corresponds to the plurality of triangular face sub-blocks of the irregular block; Acquire coordinate data of a preset point, and obtain a plurality of target rectangular blocks or a plurality of target irregular blocks corresponding to the coordinate data and a plurality of target triangular face sub-blocks corresponding thereto based on the primary spatial index and the secondary spatial index; It is determined whether the preset point is located in the target rectangular blocks or the target irregular blocks and their corresponding target triangular face sub-blocks. If so, it is determined that the preset point is located in the preset area. Otherwise, it is determined that the preset point is located outside the preset area.
2. The multi-level index-based fast region recognition method according to claim 1, characterized in that: The determining whether the preset point is located in the plurality of target rectangular blocks or the plurality of target irregular blocks and the plurality of target triangular face sub-blocks corresponding thereto comprises: Based on the coordinate data of the preset point, combined with the primary spatial index, determining whether the preset point is located in the preset area; If not, it is determined that the preset point is outside the preset area; If so, determine whether the preset point is located in the target rectangular block or in the target irregular block. If the preset point is located in the target rectangular block, determine that the point is inside the preset area. If the preset point is located in the target irregular block, determine whether the preset point is located in a target triangular face sub-block in the target irregular block through the secondary spatial index.
3. The multi-level index-based fast region recognition method according to claim 2, characterized in that: The determining whether the preset point is located in a target triangular face sub-block in the target irregular block in combination with the secondary spatial index includes: Based on the coordinate data of the preset point, in combination with the secondary space search, searching for the circumscribed rectangle or the minimum bounding rectangle of the triangular surface sub-block close to the coordinate data from among the plurality of triangular surface sub-blocks; Based on the circumscribed rectangle or the minimum bounding rectangle, a target triangular surface sub-block corresponding to the preset point is determined.
4. The multi-level index-based fast region recognition method according to claim 3, characterized in that: The primary spatial index and the secondary spatial index include: index identifier, boundary data and centroid coordinates; The boundary data includes: the rectangular block, the irregular block level and the triangular face sub-block.
5. The multi-level index-based fast region recognition method according to claim 4, characterized in that: The boundary data also includes: coordinate data of three vertices of the target triangle sub-block; The determining whether the preset point is located in a target triangular face sub-block in the target irregular block in combination with the secondary spatial index includes: Based on the plurality of target triangular surface sub-blocks, respectively calculating the distance value between the preset point coordinates and each vertex of each target triangular surface sub-block; According to the distance values between the coordinates of the preset point and each vertex of the target triangular surface sub-block, it is determined whether the preset point is located inside a target triangular surface sub-block.
6. The multi-level index-based fast region recognition method according to any one of claims 1 to 5, characterized in that: After obtaining the coordinate data of the preset point, the method further includes: Calculating a distance between the coordinate data of the preset point and the coordinate data of a historical preset point; In combination with the positional relationship between the historical preset point and the boundary of the preset area, it is determined whether the preset point is located inside the preset area based on the distance value.
7. The multi-level index-based fast region recognition method according to any one of claims 1 to 5, characterized in that: The methods for establishing the primary spatial index and the secondary spatial index include: a grid index method, a quadtree index method, a Kd tree index method or an R tree index method.
8. A fast region recognition device based on multi-level indexing, characterized in that: include: A primary segmentation module, which is used to obtain map data of a preset area, perform a primary segmentation on the map data to obtain a plurality of rectangular blocks and a plurality of irregular blocks that can be spliced, and establish a primary spatial index of the plurality of rectangular blocks and the plurality of irregular blocks, wherein the plurality of irregular blocks are located at the edge of the map; A secondary triangulation module, which is used to perform secondary triangulation on each of the irregular blocks to obtain a plurality of triangular face sub-blocks that can be spliced into the irregular block, and to establish a secondary spatial index corresponding to the primary spatial index of the irregular block, wherein the secondary spatial index corresponds to the plurality of triangular face sub-blocks of the irregular block; An index retrieval module, which is used to obtain coordinate data of a preset point, and obtain a plurality of target rectangular blocks or a plurality of target irregular blocks corresponding to the coordinate data and a plurality of target triangular face sub-blocks corresponding thereto based on the primary spatial index and the secondary spatial index; A position judgment module is used to judge whether the preset point is located in the target rectangular blocks or the target irregular blocks and their corresponding target triangular face sub-blocks. If so, the preset point is determined to be located in the preset area; otherwise, the preset point is determined to be outside the preset area.
9. An electronic device, characterized in that: include: at least one processor; And a memory connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the multi-level index-based rapid region recognition method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed by a processor, a fast region recognition method based on multi-level indexing as described in any one of claims 1-7 is implemented.