Geometric object screening method, apparatus, device, and storage medium
By using a spatial block structure of a multi-branch tree to filter geometric objects, the problem of low filtering accuracy in existing technologies is solved, query efficiency is improved and computational resource waste is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CETC JINCANG (BEIJING) TECH CO LTD
- Filing Date
- 2022-12-30
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies have low precision in filtering geometric objects, resulting in wasted computing resources and reduced query efficiency.
By identifying approximate objects of the target geometric object, the accuracy of geometric object selection is improved by using the spatial block structure of a multi-branch tree for filtering.
This reduces the number of geometric objects that do not meet the query range from entering the precise calculation stage, saving computing resources and improving query efficiency.
Smart Images

Figure CN116244338B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device and storage medium for screening geometric objects. Background Technology
[0002] The spatial data used by Geographic Information Systems (GIS) is multidimensional data, which is usually composed of multidimensional coordinates or coordinate sequences composed of multidimensional coordinates.
[0003] For this type of multidimensional data, the minimum bounding rectangle (MBR) of the geometric object (i.e., the geometric shape corresponding to the spatial data) can be used as the spatial index of the geometric object (i.e., the spatial data). Based on the spatial index, the spatial data can be queried: First, if a usable spatial index exists for the geometric object, the spatial index is used to efficiently screen the geometric object. For example, geometric objects whose MBR does not overlap with the query range are quickly excluded to narrow down the query range. Second, the results of the first step of screening are used to perform precise geometric calculations to accurately select the geometric objects that truly meet the query conditions.
[0004] However, the low precision of the geometric object filtering in the first step results in a large number of geometric objects being retained for precise calculation in the second step, which in turn leads to a waste of computing resources and a decrease in query efficiency. Summary of the Invention
[0005] This application provides a geometric object filtering method, apparatus, device, and storage medium to address the problem of low geometric object filtering accuracy leading to wasted computational resources and low query efficiency in geometric object queries.
[0006] In a first aspect, this application provides a method for filtering geometric objects, including:
[0007] Determine the target geometric object, which includes a first geometric object representing a query range and a second geometric object to be detected as to whether it satisfies the query range;
[0008] Determine the approximate object corresponding to the target geometric object. The approximate object includes a first approximate object corresponding to the first geometric object and / or a second approximate object corresponding to the second geometric object. The data structure of the approximate object is a multi-branch tree. The nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximate object.
[0009] Based on the first approximation object and / or the second approximation object, the second geometric object is filtered to reduce the number of geometric objects in the second geometric object that do not meet the query range.
[0010] In one possible implementation, the target geometric object contains an object identifier of the target geometric object, and determining the approximate object corresponding to the target geometric object includes: if the approximate object is found in the cache space according to the object identifier, then the approximate object is read from the cache space according to the object identifier.
[0011] In one possible implementation, the method further includes: if the approximate object is not found in the cache space according to the object identifier, then determining whether the target geometric object belongs to a large geometric object; if the target geometric object belongs to a large geometric object, then generating the approximate object and storing the approximate object in the cache space.
[0012] In one possible implementation, determining whether the target geometric object belongs to a large geometric object if no approximate object is found in the cache space based on the object identifier includes: determining the attribute value of the minimum boundary matrix (MBR) of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension; comparing the attribute value with the upper limit value; if the attribute value is greater than the upper limit value, determining that the target geometric object belongs to a large geometric object, otherwise determining that the target geometric object does not belong to a large geometric object.
[0013] In one possible implementation, determining the attribute value of the MBR of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension includes: determining the target column to which the target geometric object belongs in the geometric object column of the data table, wherein the same geometric object column of the data table contains attribute information of geometric objects of the same category; obtaining the attribute value of the MBR of the target geometric object in the target dimension from the attribute information of the target geometric object according to the object identifier; determining the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension as the upper limit value of the attribute corresponding to the target column in the target dimension, wherein the upper limit value of the attribute corresponding to the target column in the target dimension is obtained by statistically analyzing the attribute values of the MBR of multiple geometric objects in the target column in the target dimension.
[0014] In one possible implementation, the statistical process of the upper limit value of the attribute corresponding to the target column in the target dimension includes: calculating the quantiles of the multiple geometric objects in the target dimension based on the attribute values of the MBRs of the multiple geometric objects in the target column in the target dimension; and calculating the upper limit value of the attribute corresponding to the target column in the target dimension based on the quantiles.
[0015] In one possible implementation, the step of generating the approximate object and storing the approximate object in the cache space if the target geometric object belongs to a large geometric object includes: if the target geometric object belongs to a large geometric object, determining the spatial range of the approximate object according to the MBR of the target geometric object; recursively subdividing the spatial range of the approximate object using a multi-branch tree algorithm to generate a multi-branch tree corresponding to the approximate object, the multi-branch tree being used to represent the approximate object; and storing the multi-branch tree in the cache space.
[0016] In one possible implementation, during the process of recursively subdividing the spatial range of the approximate object using a multi-branch tree algorithm to generate a multi-branch tree corresponding to the approximate object, the nth subdivision of the spatial range of the approximate object includes: traversing nodes in the multi-branch tree to determine the current node; dividing the spatial block corresponding to the current node into multiple sub-space blocks; determining the positional relationship between the multiple sub-space blocks and the target geometric object; and determining the block type corresponding to the current node and / or creating corresponding nodes for the sub-space blocks that meet the subdivision conditions among the multiple sub-space blocks based on the positional relationship.
[0017] In one possible implementation, determining the block type corresponding to the current node and / or creating corresponding nodes for the subspace blocks that meet the subdivision conditions among the plurality of subspace blocks based on the positional relationship includes: if all the plurality of subspace blocks are located inside the target geometric object, then determining the block type corresponding to the current node as an internal block; if the positional relationship between the plurality of subspace blocks and the target geometric object is an overlapping relationship or a contact relationship, then determining the block type corresponding to the current node as a boundary block.
[0018] In one possible implementation, the method further includes: if the positional relationship between the plurality of subspace blocks and the target geometric object is different, and there are subspace blocks among the plurality of subspace blocks that have an overlapping or contacting relationship with the target geometric object, then create corresponding nodes for the remaining subspace blocks among the plurality of subspace blocks, excluding the subspace blocks that have a disjoint relationship with the target geometric object.
[0019] In one possible implementation, dividing the spatial block corresponding to the current node into multiple sub-space blocks includes: dividing the spatial block into multiple sub-space blocks on an average basis according to spatial quadrants, wherein different sub-space blocks are located in different spatial quadrants.
[0020] In one possible implementation, after determining the block type corresponding to the current node based on the positional relationship and / or creating corresponding nodes for the subspace blocks that meet the subdivision conditions among the multiple subspace blocks, the method further includes: determining the number of nodes in the multi-way tree; if the number of nodes is greater than the soft boundary value, determining the positional relationship between the leaf node located in the multi-way tree and the target geometric object; and determining the block type corresponding to the leaf node based on the positional relationship between the leaf node and the target geometric object.
[0021] In one possible implementation, the step of filtering the second geometric object based on the first approximate object and / or the second approximate object to reduce the number of geometric objects in the second geometric object that do not meet the query range includes: performing positional relationship condition filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object; and filtering the second geometric object based on the positional relationship between the first geometric object and the second geometric object to reduce the number of geometric objects in the second geometric object that do not meet the query range; wherein, the positional relationship condition filtering may include at least one of the following: inclusion condition filtering, being included condition filtering, disjoint condition filtering, overlapping or contact condition filtering, and distance range condition filtering.
[0022] In one possible implementation, when the positional relationship condition filtering includes inclusion condition filtering, the step of performing positional relationship condition filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object includes: if the MBR of the second geometric object is located inside the inner block of the first approximate object, then the positional relationship between the first geometric object and the second geometric object is determined to be an inclusion relationship; if the MBR of the second geometric object does not overlap with the inner block of the first approximate object and the MBR of the second geometric object does not overlap with the boundary block of the first approximate object, then the first geometric object and the second geometric object are determined to be a disjoint relationship or a non-inclusion relationship.
[0023] In one possible implementation, when the positional relationship filtering includes inclusion condition filtering, the step of performing positional relationship condition filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object includes: if the MBR of the first geometric object is located inside the inner block of the second approximate object, then the first geometric object and the second geometric object are determined to be in an inclusion relationship; if the MBR of the first geometric object does not overlap with the inner block of the second approximate object and the MBR of the first geometric object does not overlap with the boundary block of the second approximate object, then the first geometric object and the second geometric object are determined to be in a disjoint relationship or not in an inclusion relationship.
[0024] In one possible implementation, when the positional relationship condition filtering includes disjoint condition filtering, the step of performing positional relationship condition filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object adopts at least one of the following methods: if the MBR of the first geometric object does not overlap with the inner block of the second approximate object and the MBR of the first geometric object does not overlap with the boundary block of the second approximate object, then the first geometric object and the second geometric object are determined to be disjoint; if the MBR of the second geometric object does not overlap with the inner block of the first approximate object and the boundary block of the first approximate object, then the first geometric object and the second geometric object are determined to be disjoint; if the inner block of the first approximate object does not overlap with the inner block of the second approximate object and the boundary block of the second approximate object, and the boundary block of the first approximate object does not overlap with the inner block of the second approximate object and the boundary block of the second approximate object, then the first geometric object and the second geometric object are determined to be disjoint.
[0025] In one possible implementation, before determining the target geometric object, the method further includes: selecting the second geometric object from the plurality of geometric objects based on the MBR of the first geometric object and the MBRs corresponding to the plurality of geometric objects respectively.
[0026] Secondly, this application provides a geometric object screening device, comprising:
[0027] A parameter determination module is used to determine a target geometric object, the target geometric object including a first geometric object representing a query range and a second geometric object to be detected as to whether it satisfies the query range;
[0028] The approximate object determination module is used to determine the approximate object corresponding to the target geometric object. The approximate object includes a first approximate object corresponding to the first geometric object and / or a second approximate object corresponding to the second geometric object. The data structure of the approximate object is a multi-branch tree, and the nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximate object.
[0029] The filtering module is used to filter the second geometric object based on the first approximate object and / or the second approximate object, so as to reduce the number of geometric objects in the second geometric object that do not meet the query range.
[0030] Thirdly, this application provides an electronic device, including: at least one processor and a memory;
[0031] The memory stores instructions that the computer executes;
[0032] At least one processor executes computer execution instructions stored in memory, causing at least one processor to perform the geometric object filtering method as provided in the first aspect above.
[0033] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the geometric object filtering method provided in the first aspect above.
[0034] Fifthly, this application provides a computer program product, which includes a computer program that, when executed by a processor, implements the geometric object filtering method as described in the first aspect above.
[0035] The geometric object filtering method, apparatus, device, and storage medium provided in this application determine a target geometric object, which includes a first geometric object representing a query range and a second geometric object to be detected as to whether it meets the query range. Based on the object parameters of the target geometric object, approximate objects corresponding to the target geometric object are determined. These approximate objects include a first approximate object corresponding to the first geometric object. The data structure of the approximate objects is a multi-branch tree, where nodes correspond to spatial blocks within the spatial range of the approximate object. This is equivalent to approximating the geometric object through a combination of multiple spatial blocks. Compared to MBR, approximate objects can more finely granularly and accurately mimic the geometric object. Therefore, filtering the second geometric object based on the first and / or second approximate objects reduces the number of geometric objects in the second geometric object that do not meet the query range, effectively improving the filtering accuracy of geometric objects. This results in fewer geometric objects entering the precise geometric calculation stage of the geometric object query process, reducing computational resource waste and improving the query efficiency of geometric objects. Attached Figure Description
[0036] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0037] Figure 1 Example diagram of MBR;
[0038] Figure 2 Here is an example diagram of the structure of an R-tree;
[0039] Figure 3 An example diagram of the spatial distribution of the MBR stored in the R-tree;
[0040] Figure 4 Example diagram of T-shaped ship tank and MBR for T-shaped ship tank;
[0041] Figure 5 This is a schematic diagram illustrating the application scenarios applicable to the embodiments of this application;
[0042] Figure 6 Flowchart of the geometric object filtering method provided in the embodiments of this application Figure 1 ;
[0043] Figure 7 Flowchart of the geometric object filtering method provided in the embodiments of this application Figure 2 ;
[0044] Figure 8 Flowchart of the geometric object filtering method provided in the embodiments of this application Figure 3 ;
[0045] Figure 9 This is a schematic diagram of the structure of the geometric object screening device provided in the embodiments of this application;
[0046] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0047] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0048] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0049] First, to facilitate understanding of this solution, some of the terms used in this application will be explained:
[0050] Geometric objects: In spatial data, geometric objects refer to terrain features, such as buildings and swimming pools. In a coordinate system, geometric objects can be represented as geometric figures of a certain shape.
[0051] Minimum Bounding Rectangle (MBR): Also known as a bounding box, the MBR is the smallest rectangle whose sides are parallel to the coordinate axes and can enclose the geometric object. This concept can be extended to three-dimensional, four-dimensional, and even higher-dimensional geometric objects. For example, Figure 1 Here is an example diagram of MBR. Figure 1 The diagram shows two geometric objects and their corresponding MBRs. The edges of the MBRs (including the length and width of the MBRs) are parallel to the coordinate axes and the MBRs enclose the geometric objects.
[0052] R-tree: A tree-like data structure that uses the Model Breakdown Framework (MBR) as an index. For example, in a 2D dataset, each leaf node of an R-tree can store the MBR of a single geometric object, while the non-leaf nodes store the MBR that encompasses the coverage of all its child nodes. Figure 2 Here is an example diagram of the structure of an R-tree. Figure 3 An example diagram of the spatial distribution of the MBR stored in the R-tree. Figure 2 and Figure 3 In this context, R1 to R19 represent different MBRs. Figure 3 The shape of the geometric object is shown in R8. Among them, according to... Figure 3 It can be seen that: R1 covers R3, R4, and R5; R3 covers R8 to R10; R4 covers R11 and R12; R5 covers R13 and R14; R2 covers R6 and R7; R6 covers R15 and R16; and R7 covers R17 to R19. Figure 2 In the R-tree, each R1 to R19 is stored, and the relationship between R1 to R19 is shown.
[0053] In related technologies, spatial data can be queried flexibly and efficiently by using the Model Boundary Restoration (MBR) of geometric objects as spatial indexes. When a spatial index exists for a geometric object, the spatial data query process can be divided into two steps: First, if a usable spatial index is found for the geometric object, this index is used for efficient initial screening. Taking an R-tree as an example, geometric objects whose MBRs do not overlap with the query range can be quickly excluded. Although not all ineligible geometric objects can be excluded, the query range can be quickly narrowed. Second, based on the initial screening results from the first step, precise geometric calculations are performed. This step is computationally expensive, but it selects geometric objects that truly meet the query conditions. To further improve the query performance of the above method, two approaches can be taken: firstly, the R-tree can be improved; secondly, a secondary filtering can be performed before the precise geometric calculations in the second step to further narrow the calculation range.
[0054] In the process of improving R-trees, many variations of R-trees have emerged:
[0055] R + Tree (R) + -tree): When splitting a node, the MBR of a cross-node geometry object (i.e., a part of the MBR corresponds to one node and another part corresponds to another node) is split to achieve the effect of non-overlapping nodes through the redundancy of the MBR of this part of the geometry object.
[0056] R * Tree (R) * -tree): Employs a "double sorting-based nodesplitting" algorithm, selecting the splitting direction and position with the least overlap to insert data, and uses a "forced re-insertion" method to avoid the quality of the spatial index degrading as data is inserted and updated.
[0057] QR tree: It uses a quadtree to divide the space into subspaces and uses many R-tree indexes in each subspace, thereby improving the overlap of spatial indexes.
[0058] SS Tree: To improve the performance of nearest neighbor queries, the minimum boundary circle is used instead of the MBR to represent the region shape, that is, the minimum boundary circle is used as the spatial index.
[0059] X-tree: A hybrid of linear arrays and layered R-trees. By introducing supernodes, X-trees significantly reduce overlap between MBRs and improve query efficiency.
[0060] A secondary filtering method can be used before performing the second step of precise geometric calculations. For example, a spatial index can be created for the constituent elements of the geometric object (such as edges), and a secondary filtering can be performed based on the spatial index to further reduce the constituent elements participating in complex geometric calculations.
[0061] In real-world spatial data, there are often situations where: in one scenario, some geometric objects are significantly larger than most others, exhibiting a large Model Boundary (MBR); in another scenario, the shapes and extension directions of displayed geometric objects are often irregular, and for ease of calculation, the edges of the MBR are parallel to the coordinate axes, resulting in large gaps between the geometric object's body and the MBR boundary. For example, Figure 4 Example diagram of T-shaped ship tank and T-shaped ship tank MBR, from Figure 4 As can be seen, the T-shaped boat pool is long and narrow, much larger than the surrounding buildings, and has a large Model Boundary (MBR), with blank areas occupying a significant proportion of this MBR. In spatial queries, such geometric objects, due to their large MBR coverage area, are highly likely to be retained in the initial screening stage, only to be discovered as not meeting query criteria in the second round of precise calculations, leading to a waste of computational resources. In particular, naturally formed terrain features often have complex and irregular boundaries; the larger these geometric objects, the more detailed their shapes, and the greater the computational load. However, neither the improvements to the R-tree nor the secondary filtering before the second-step precise geometric calculations take this situation into account.
[0062] To address the aforementioned shortcomings, this application provides a method, apparatus, device, and storage medium for filtering geometric objects. In this application, the filtering of geometric objects is achieved using approximation objects. Specifically, the approximation object is a multi-branch tree, where nodes correspond to spatial blocks within the spatial range of the approximation object. Therefore, an approximation object is a combination of multiple spatial blocks. By combining these multiple spatial blocks to approximate and simulate the geometric object, the similarity between the approximation object and the geometric object is higher, and the blank area between the boundary of the approximation object and the geometric object itself is smaller. Therefore, filtering geometric objects based on their approximation objects is more accurate than filtering based on the geometric object's MBR, allowing fewer geometric objects to enter the complex geometric calculation stage, reducing computational resources, and improving spatial query efficiency.
[0063] Figure 5 This is a schematic diagram illustrating an application scenario applicable to the embodiments of this application. For example... Figure 5As shown, the application scenario involves a spatial data query device 501 and a database 502. The database stores spatial data and spatial query conditions. The spatial data may include information about multiple geometric objects, such as the positional information of multiple constituent elements (e.g., edges) of a geometric object, or similar objects of the geometric object. The spatial data query device 501 can retrieve relevant data from the database 502. Based on the retrieved data, it queries among multiple geometric objects for geometric objects that meet the query range, including filtering geometric objects based on their approximate objects. The spatial data query device 501 can be a server or a terminal. Figure 5 Take a server as an example.
[0064] The terminal can be a personal digital assistant (PDA) device, a handheld device (such as a smartphone or tablet), a computing device (such as a personal computer (PC)), an in-vehicle device, a wearable device (such as a smartwatch or smart bracelet), or a smart home device (such as a smart display device). The server can be a distributed server, a centralized server, or a cloud server.
[0065] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0066] refer to Figure 6 , Figure 6 Flowchart of the geometric object filtering method provided in the embodiments of this application Figure 1 .like Figure 6 As shown, the geometric object filtering method provided in this embodiment includes:
[0067] S601. Determine the target geometric object, which includes a first geometric object representing the query range and a second geometric object to be checked to see if it satisfies the query range.
[0068] The first geometric object and the second geometric object can be one or more.
[0069] Filtering the second geometric object refers to selecting geometric objects from the second geometric object set that satisfy the query range. Since the first geometric object represents the query range, filtering the second geometric object can be achieved by comparing the first and second geometric objects pairwise. Specifically, by comparing the first and second geometric objects, geometric objects from the second geometric object set whose positional relationship with the first geometric object meets certain requirements are selected. These geometric objects have a higher probability of satisfying the query range. For example, if the first geometric object is city A and the second geometric object is a building, and the positional relationship requirement is inclusion, then buildings included in city A can be selected from multiple buildings.
[0070] In this embodiment, the target geometric object may contain positional information of multiple constituent elements (such as points and edges) on the target geometric object. The target geometric object may originate from a previous task; for example, the previous task performed an initial screening of geometric objects, identifying a second geometric object. If the current task determines that the second geometric object needs to be filtered using the first geometric object as the query scope, then the first and second geometric objects are passed to the current task, which is a task to filter geometric objects using approximate objects. Alternatively, the target geometric object may be input by the user. Therefore, the system can receive the target geometric object sent by the previous task, or it can obtain the target geometric object input by the user.
[0071] S602. Determine the approximate object corresponding to the target geometric object. The approximate object includes the first approximate object corresponding to the first geometric object and / or the second approximate object corresponding to the second geometric object. The data structure of the approximate object is a multi-branch tree. The nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximate object.
[0072] A multi-way tree, also known as an n-way tree, allows a parent node to have more than two child nodes. The spatial extent of an approximate object refers to the entire spatial region occupied by the approximate object, reflecting its overall shape and size. The spatial extent of an approximate object can be divided into multiple spatial blocks; that is, the approximate object is composed of multiple spatial blocks, which are analogous to rectangular tiles of different sizes. In the process of generating an approximate object, its spatial extent can be recursively divided into multiple spatial blocks, and nodes corresponding to these blocks are constructed. This generates a multi-way tree, which represents the approximate object.
[0073] In this embodiment, an approximate object corresponding to a first geometric object can be determined. For ease of distinction, the approximate object corresponding to the first geometric object is referred to as the first approximate object. And / or, an approximate object corresponding to a second geometric object can be determined. For ease of distinction, the approximate object corresponding to the second geometric object is referred to as the second approximate object. The use of "and / or" here takes into account the following situations: First, not every geometric object needs to have a corresponding approximate object. For example, approximate objects can be generated only for large, irregular geometric objects. Second, not every geometric object can have a corresponding approximate object. It is necessary to determine whether it is possible to find or generate approximate objects for geometric objects. Third, the first approximate object or the second approximate object is more accurate than MBR. When relying solely on the first approximate object or the second approximate object for geometric object screening, the accuracy of geometric object screening can still be improved.
[0074] In this embodiment, during the process of determining the approximate object corresponding to the target geometric object, the approximate object corresponding to the target geometric object can be searched or generated. Specifically, among the approximate objects corresponding to multiple geometric objects, the approximate object corresponding to the target geometric object can be searched, or the approximate object corresponding to the target geometric object can be generated based on the target geometric object.
[0075] S603. Based on the first approximate object and / or the second approximate object, filter the second geometric object to reduce the number of geometric objects in the second geometric object that do not meet the query range.
[0076] In this embodiment, in one approach, the positional relationship between the first approximation object and the MBR of the second geometric object can be determined by comparing their respective MBRs. Geometric objects within the second geometric object group whose MBRs satisfy the positional relationship condition are then selected, and these geometric objects have a higher probability of satisfying the query range. In another approach, the positional relationship between the second approximation object and the MBR of the first geometric object can be determined by comparing their respective MBRs. Geometric objects within the second geometric object group whose MBRs satisfy the positional relationship condition are then selected, and these geometric objects have a higher probability of satisfying the query range. In yet another approach, the positional relationship between the first and second approximation objects can be determined by directly comparing them. Geometric objects within the second geometric object group whose positional relationship satisfies the positional relationship condition are then selected, and these geometric objects have a higher probability of satisfying the query range. Thus, geometric objects with a high probability of satisfying the query range are selected from the second geometric object group, reducing the number of geometric objects within the second geometric object group that do not satisfy the query range.
[0077] In this embodiment, an approximate object composed of multiple spatial blocks is constructed for the geometric object, and the approximate object is represented by a multi-branch tree, with each node of the multi-branch tree corresponding to a spatial block. Compared to MBR, the similarity between the approximate object and the geometric object is higher, especially for large geometric objects, and the blank area between the boundaries of the approximate object and the geometric object is greatly reduced. By using the first approximate object corresponding to the first geometric object and / or the second approximate object corresponding to the second geometric object, the second geometric object is filtered to obtain geometric objects that meet the query range. This improves the filtering accuracy of geometric objects, allowing more accurate and fewer geometric objects to enter the complex geometric calculation stage of geometric object query (such as the precise geometric calculation in the second step mentioned above), saving computing resources and improving the efficiency of geometric object query.
[0078] refer to Figure 7 , Figure 7 Flowchart of the geometric object filtering method provided in the embodiments of this application Figure 2 .like Figure 7 As shown, the methods for filtering geometric objects include:
[0079] S701, Determine the target geometric object. The target geometric object includes a first geometric object representing the query range and a second geometric object to be checked to see if it meets the query range. The target geometric object contains the object identifier of the target geometric object.
[0080] The object identifier of a geometric object is an internal attribute within the geometric object itself, existing within the object's data content, and used to uniquely identify a specific version of a particular geometric object. Specifically, an object identifier can be added to the geometric object when it is updated or created to uniquely identify the current version. A common approach is to add a primary key corresponding to the geometric object in a table and use this primary key to uniquely identify the geometric object. However, this primary key is not internalized into the geometric object but exists as a separate column in the data table, stored separately from the geometric object. This means that when the parameters of a geometric calculation function only contain the geometric object, the primary key value cannot be read. Furthermore, if the geometric object is the result of a geometric calculation rather than originating from a data table, the geometric object may not even have a corresponding primary key, failing to uniquely identify the geometric object. This embodiment adds an object identifier to the geometric object internally, effectively solving the shortcomings of the aforementioned common approach and facilitating the caching management of geometric objects.
[0081] Furthermore, the object identifier of a geometric object may include a universally unique identifier (UUID) for the geometric object, so as to globally and uniquely identify the geometric object through the UUID and improve the accuracy of geometric object lookup based on UUID.
[0082] S702, based on the object identifier of the target geometric object, check whether the cache space stores an approximate object corresponding to the target geometric object.
[0083] Among them, the approximate objects corresponding to the target geometric object include the first approximate object corresponding to the first geometric object and / or the second approximate object corresponding to the second geometric object. The data structure of the approximate object is a multi-branch tree, and the nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximate object.
[0084] The cache space can be the shared memory space of the current system, where cached data is stored. The cached data includes key values and corresponding cache entries. Key values may include the object identifier of the geometric object, and the corresponding cache entries may include the approximate object of the geometric object.
[0085] In this embodiment, the cache space can be searched to see if a similar object corresponding to the object identifier of the target geometric object exists. If it exists, it means that the cache space stores a similar object corresponding to the target geometric object. When the object identifier of the target geometric object is used to uniquely identify the target geometric object of the current version, the cache space can be queried to see if a similar object corresponding to the target geometric object of the current version is stored, effectively improving the search efficiency of similar objects. If a similar object corresponding to the target geometric object is found in the cache space based on the object identifier of the target geometric object, then S703 is executed; otherwise, S704 is executed.
[0086] S703: The approximate object corresponding to the target geometric object is read from the cache space based on the object identifier of the target geometric object.
[0087] In this embodiment, if it is determined that the cache space stores approximate objects corresponding to the target geometric object, the approximate object corresponding to the object identifier of the target geometric object is read from the cache space. After executing S703, S705 can be executed to filter geometric objects based on the found approximate objects.
[0088] S704 generates an approximate object corresponding to the target geometric object and stores the approximate object in the cache space.
[0089] In this embodiment, if the cache space does not store an approximate object corresponding to the target geometric object, an approximate object can be generated based on the spatial location information of the target geometric object. After generating the approximate object, it can be stored in the cache space for easy retrieval from the cache space next time. Then, step S705 can be executed to filter geometric objects based on the generated approximate object.
[0090] In one possible implementation, the spatial location information of the target geometric object can be obtained from its storage location; alternatively, the spatial location information can be directly obtained from the input parameters. The spatial location information of the target geometric object may include the position information of multiple constituent elements (such as points and edges) on the target geometric object, or it may include the MBR of the target geometric object.
[0091] S705, based on the first approximate object and / or the second approximate object, the second geometric object is filtered to reduce the number of geometric objects in the second geometric object that do not meet the query range.
[0092] The implementation principle and technical effects of S705 can be referred to in the aforementioned embodiments, and will not be repeated here.
[0093] In this embodiment of the application, while filtering geometric objects based on approximate objects to improve the efficiency of geometric object filtering, the efficiency of obtaining approximate objects of geometric objects is improved by storing the approximate objects corresponding to the geometric objects and the object identifiers of the geometric objects in the cache space, thereby improving the efficiency of filtering geometric objects based on approximate objects.
[0094] Spatial indexes of geometric objects (such as spatial indexes of the constituent elements of the geometric object) and approximate objects of the geometric object require certain storage and computing resources. To weigh the pros and cons, the following measures can be taken: Measure 1: Store the spatial index or approximate object on external storage devices such as disks. This measure increases the I / O burden, especially for the spatial indexes of the constituent elements of the geometric object, whose storage requirements may be greater than the geometric object itself. Measure 2: If the spatial index or approximate object is not cached on external storage devices, then either the spatial index or approximate object should be cached in memory, or the spatial index or approximate object should be recalculated on each query. Both methods require careful consideration to avoid impacting performance.
[0095] In the embodiments of this application, the main focus is on the storage of approximate objects. Figure 7 The illustrated embodiment primarily stores the object identifier of a geometric object and its corresponding approximate object in a cache space. If the cache space does not contain an approximate object corresponding to a geometric object, then an approximate object is generated. To further reduce the storage resources occupied by approximate objects and improve spatial query efficiency, based on the characteristics of spatial data in the real world, a subset of large geometric objects can be selected for approximate object generation and long-term caching of these approximate objects. For details, please refer to... Figure 8 The illustrated embodiment.
[0096] refer to Figure 8 , Figure 8Flowchart of the geometric object filtering method provided in the embodiments of this application Figure 3 .like Figure 8 As shown, the geometric object filtering method provided in this embodiment includes:
[0097] S801, Determine the target geometric object. The target geometric object includes a first geometric object representing the query range and a second geometric object to be checked to see if it meets the query range. The target geometric object contains the object identifier of the target geometric object.
[0098] S802, based on the object identifier of the target geometric object, check whether the cache space stores an approximate object corresponding to the target geometric object.
[0099] Among them, the approximate objects corresponding to the target geometric object include the first approximate object corresponding to the first geometric object and / or the second approximate object corresponding to the second geometric object. The data structure of the approximate object is a multi-branch tree, and the nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximate object.
[0100] In this embodiment, if an approximate object corresponding to the target geometric object is found in the cache space based on the object identifier of the target geometric object, then S803 is executed; otherwise, S804 is executed.
[0101] S803: Based on the object identifier of the target geometric object, the approximate object corresponding to the target geometric object is read from the cache space.
[0102] In this embodiment, if a first approximate object corresponding to the first geometric object is found in the cache space based on the object identifier of the first geometric object, then the first approximate object is read from the cache space based on the object identifier of the first geometric object; and / or, if a second approximate object corresponding to the second geometric object is found in the cache space based on the object identifier of the second geometric object, then the second approximate object is read from the cache space based on the object identifier of the second geometric object. After executing S803, S806 can be executed.
[0103] The implementation principles and technical effects of S801 to S803 can be referred to in the aforementioned embodiments, and will not be repeated here.
[0104] S804 determines whether the target geometric object is a large geometric object.
[0105] In this embodiment, if no approximate object corresponding to the target geometric object is stored in the cache space, it can be determined whether the target geometric object belongs to a large geometric object. If the target geometric object belongs to a large geometric object, then S805 is executed to generate and store approximate objects for long-term storage; otherwise, S806 is executed.
[0106] In one possible implementation, S804 may include: determining the attribute value of the MBR of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension; comparing the attribute value of the MBR of the target geometric object in the target dimension with the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension; if the attribute value of the MBR of the target geometric object in the target dimension is greater than the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension, then the target geometric object is determined to be a large geometric object; otherwise, the target geometric object is determined not to be a large geometric object. Thus, utilizing the MBR of the target geometric object can, to a certain extent, reflect the spatial location and size characteristics of the target geometric object, and allow for the targeted design of corresponding upper limit values for the geometric object based on its object category (for example, the upper limit value of the attribute corresponding to the object category of a building is different from the upper limit value of the attribute corresponding to the object category of a river), improving the efficiency and accuracy of determining whether the target geometric object is a large geometric object.
[0107] There can be one or more target dimensions. When there are multiple target dimensions, the attribute values of the MBR of the target geometric object in each target dimension can be compared with the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in each target dimension. If the attribute value of the MBR of the target geometric object in at least one target dimension is greater than the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in that target dimension, then the target geometric object is determined to be a large geometric object; otherwise, the target geometric object is determined not to be a large geometric object.
[0108] In this implementation, the data storage location of the target geometric object can be obtained from the input parameters. Based on the data storage location, the attribute values of the MBR of the target geometric object in the target dimension can be retrieved from the database. Alternatively, the spatial location information of the target geometric object (which may include the location information of multiple constituent elements on the target geometric object) can be obtained based on the data storage location. The MBR of the target geometric object is generated based on this spatial location information, and the attribute values of the MBR in the target dimension are determined. The upper limit values of the attributes corresponding to the object category to which the target geometric object belongs in each target dimension can be pre-calculated. Based on the data storage location of the target geometric object, these upper limit values can be retrieved from the database. Then, the attribute values of the MBR in the target dimension are compared with the upper limit values of the attributes corresponding to the object category to which the target geometric object belongs in the target dimension. If the attribute value of the MBR in the target dimension is greater than the upper limit value of the attributes corresponding to the object category to which the target geometric object belongs in the target dimension, the target geometric object is determined to be a large geometric object; otherwise, it is determined that the target geometric object is not a large geometric object.
[0109] In one possible implementation, the data storage location for the target geometric object can be the geometric object column to which the target geometric object belongs in the data table. For ease of distinction, the geometric object column to which the target object belongs is called the target column. In this case, determining the attribute values of the MBR of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension can include: determining the target column to which the target geometric object belongs in the geometric object column of the data table; obtaining the attribute values of the target geometric object's MBR in the target dimension from the attribute information of the target geometric object based on the object identifier of the target geometric object; and determining the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension as the upper limit value of the attribute corresponding to the target column in the target dimension. Here, the same geometric object column in the data table contains attribute information of geometric objects of the same category, so the geometric objects in the target column have the same object category as the target geometric object. The upper limit value of the attribute corresponding to the target column in the target dimension is obtained by statistically analyzing the attribute values of the MBR of multiple geometric objects in the target column in the target dimension.
[0110] In this implementation, the data table can include multiple geometric object columns. Each geometric object column contains attribute information for multiple geometric objects of the same object type. The attribute information includes the MBR (Mean Backdrop) attribute values of the geometric objects in the target dimension. The upper limit value of the attributes in the target dimension for each geometric object column can be pre-calculated based on the MBR attributes of the multiple geometric objects in each column. When determining whether a target geometric object is a large geometric object, the attribute value of the target geometric object in the target dimension is compared with the upper limit value of the attribute in the target dimension of the target column to which the target geometric object belongs. If the attribute value of the target geometric object in the target dimension is greater than the upper limit value of the attribute in the target dimension of the target column to which the target geometric object belongs, the target geometric object is determined to be a large geometric object; otherwise, the target geometric object is determined not to be a large geometric object. Therefore, by utilizing geometric object columns, geometric objects, target dimensions, and attribute value statistics, the accuracy of determining whether a target geometric object is a large geometric object is improved.
[0111] In calculating the upper limit of attributes in the target dimension of a geometric object column based on the attribute values of the MBRs of multiple geometric objects in the target dimension, one possible implementation includes: calculating the quantiles (also known as quantile points) of the multiple geometric objects in the target dimension based on their respective MBR attribute values; and calculating the upper limit of attributes in the target dimension based on these quantiles. Thus, quantile statistics improve the accuracy of the upper limit of attributes in the target dimension. Specifically, the upper limit of attributes in the target dimension can be obtained by performing addition, subtraction, multiplication, and division operations on the quantiles of the multiple geometric objects in the target dimension. The geometric object column includes the target column.
[0112] Furthermore, based on the attribute values of the MBRs of multiple geometric objects in the geometric object column along the target dimension, the quartiles (e.g., Q1) and tertiary quartiles (e.g., Q3) of the MBRs of multiple geometric objects in the geometric object column along the target dimension can be calculated. Then, based on the quartiles and tertiary quartiles of the MBRs of multiple geometric objects in the geometric object column along the target dimension, the interquartile range of the geometric object column along the target dimension can be calculated. Based on the interquartile range of the geometric object column along the target dimension, the upper limit value of the attribute in the geometric object column along the target dimension can be determined. Thus, by using the quartiles, tertiary quartiles, and interquartile range, the accuracy of the upper limit value of the attribute can be improved.
[0113] As an example, the formula for calculating the upper limit of the attribute value of a geometric object column in the target dimension can be:
[0114] IQR=Q3-Q1, Q4=Q1+1.5×IQR
[0115] Where IQR represents the interquartile range of the geometric object column in the target dimension, and Q4 represents the upper limit of the attribute value of the geometric object column in the target dimension.
[0116] In the process of calculating the quarter quantile and third quantile, individual point objects and empty objects (empty objects have attribute values of 0 in all dimensions) in the geometric object column are ignored to avoid individual point objects and empty objects interfering with the attribute upper limit value and improve the accuracy of the attribute upper limit value.
[0117] After obtaining the upper limit values of the attributes of the geometric object column in the target dimension, these upper limit values can be saved. For example, the upper limit values of the attributes of the geometric object column in the target dimension can be saved to the statistical data table so that the upper limit values of the attributes of the geometric object column in the target dimension can be viewed at any time when determining whether a geometric object is a large geometric object.
[0118] Furthermore, the target dimension may include at least one of the following: X dimension (also known as longitude), Y dimension (also known as latitude), Z dimension (also known as elevation), and M dimension (also known as measurement dimension, the specific meaning of which is determined by the application scenario of the geometric object). Therefore, the structure of the statistical data table used to store the upper limit values of the attributes of the geometric object columns in the target dimension can be as follows:
[0119]
[0120]
[0121] Furthermore, if the geometric object has an MBR as a spatial index, such as a corresponding R-Tree to store the geometric object's MBR, then the upper limit value of the attribute of the geometric object column to which the geometric object belongs in the target dimension can be directly calculated based on the geometric object's MBR; if the geometric object does not have an MBR as a spatial index, then the geometric object's MBR can be generated based on the geometric object, and then the upper limit value of the attribute of the geometric object column to which the geometric object belongs in the target dimension can be calculated based on the geometric object's MBR.
[0122] S805 generates an approximate object corresponding to the target geometric object and stores the approximate object in the cache space.
[0123] In this embodiment, if the cache space does not store an approximate object corresponding to the target geometric object and the target geometric object is a large geometric object, an approximate object corresponding to the target geometric object can be generated and stored in the cache space. This achieves long-term storage of approximate objects for large geometric objects, avoiding the need to regenerate approximate objects for large geometric objects each time, thus improving the efficiency of geometric object filtering. Compared to storing approximate objects for each geometric object, storing approximate objects for large geometric objects can reduce the cache space occupied by approximate objects. Moreover, there are many blank areas between the MBRs of large geometric objects, which helps to improve the accuracy of geometric object filtering by generating corresponding approximate objects for large geometric objects.
[0124] In one possible implementation, S805 may include: if the target geometric object is a large geometric object, determining the spatial range of the approximate object corresponding to the target geometric object based on the MBR of the target geometric object; recursively subdividing the spatial range of the approximate object using a multi-branch tree algorithm to generate a multi-branch tree corresponding to the approximate object, the multi-branch tree being used to represent the approximate object; and storing the multi-branch tree in a cache space. Thus, by using multi-branch trees and recursive subdivision, the accuracy of approximate object generation is improved.
[0125] In this implementation, the process of obtaining the MBR of the target geometric object can be referred to the aforementioned description and will not be repeated here. After determining the MBR of the target geometric object, the spatial range of the approximate object corresponding to the target geometric object is determined using the MBR as a reference object. The spatial range of the approximate object is recursively subdivided into multiple spatial blocks through a multi-branch tree. Corresponding nodes are constructed for multiple spatial blocks, and multiple nodes form a multi-branch tree. In this way, a multi-branch tree corresponding to the approximate object of the target geometric object is generated, and the approximate object is represented by the multi-branch tree. Finally, the multi-branch tree is stored in the cache space, that is, the approximate object is stored in the cache space.
[0126] Specifically, when the target geometric object is two-dimensional data, the multi-branch tree algorithm can use the quadtree algorithm; when the target geometric object is three-dimensional data, the multi-branch tree algorithm can use the octree algorithm.
[0127] Furthermore, based on the MBR of the target geometric object, determining the spatial extent of the approximate object corresponding to the target geometric object may include: determining the geometric center of the target geometric object's MBR; determining the geometric center of the spatial extent of the approximate object corresponding to the target geometric object as the geometric center of the target geometric object's MBR; comparing the length and width of the target geometric object's MBR, and determining the side length of the spatial extent of the approximate object corresponding to the target geometric object as the maximum value between the length and width of the target geometric object's MBR. Thus, based on the target geometric object's MBR, the approximate object corresponding to the target geometric object covers the target geometric object as accurately as possible.
[0128] Assuming the lower left corner coordinates of the target geometric object's MBR are (X1, Y1) and the upper right corner coordinates are (X2, Y2), then the geometric center of the MBR can be ((X2-X1) / 2, (Y2-Y1) / 2). The geometric center of the approximate object of the target geometric object is determined to be ((X2-X1) / 2, (Y2-Y1) / 2). Compare the length (W = X2-X1) and width (H = Y2-Y1) of the target geometric object's MBR, and take the maximum value as the side length of the approximate object of the target geometric object.
[0129] Furthermore, in the process of recursively subdividing the spatial range of the approximate object using the multi-branch tree algorithm to generate the corresponding multi-branch tree, multiple subdivisions are required. The nth subdivision of the spatial range of the approximate object may include: traversing nodes in the multi-branch tree to determine the current node; dividing the spatial block corresponding to the current node into multiple sub-space blocks; determining the positional relationship between the multiple sub-space blocks and the target geometric object; and determining the block type corresponding to the current node and / or creating corresponding nodes for the sub-space blocks that meet the subdivision conditions based on the positional relationship. Thus, by further subdividing the space corresponding to the current node into sub-space blocks, recursive subdivision of the spatial range of the approximate object is achieved. By determining the block type corresponding to the current node and / or creating corresponding nodes for the sub-space blocks based on the positional relationship between the sub-space blocks and the target geometric object, the accuracy of the block type corresponding to the current node and the nodes of the multi-branch tree is improved. The process of recursively subdividing the spatial range of an approximate object is equivalent to converting a low-resolution image into a high-resolution image. Subspace blocks are equivalent to pixel regions. By continuously subdividing, the approximate object corresponding to the target geometric object can more accurately reflect the shape, size and other information of the target geometric object.
[0130] Specifically, the nodes in the multi-way tree can be traversed according to a node search method (especially a breadth-first search method). The current node is the currently traversed node, and the spatial block corresponding to the current node is the undetermined block. The spatial block corresponding to the current node can be divided into multiple sub-space blocks. A geometric object positional relationship judgment model can be used to determine the positional relationship between each sub-space block and the target geometric object. The geometric object positional relationship judgment model can be a dimensionally extended 9-intersection model (DE-9IM), or other models can be used, which are not listed here. For each sub-space block, if the positional relationship between the sub-space block and the target geometric object satisfies the subdivision condition, a corresponding node can be created for the sub-space block so that the node corresponding to the sub-space block can be traversed later to subdivide the sub-space block. If the positional relationship between all sub-space blocks of the current node and the target geometric object satisfies the target relationship, then the block type corresponding to the current node can be determined as the target type.
[0131] Furthermore, the positional relationship between a subspace block and the target geometric object can include at least one of the following: containment, overlap, contact, and separation (of course, the positional relationship between a subspace block and the target geometric object can also include at least one of these). Based on this, determining the block type corresponding to the current node and / or creating corresponding nodes for subspace blocks that meet the subdivision conditions among multiple subspace blocks, according to the positional relationships between multiple subspace blocks and the target geometric object, can include: if multiple subspace blocks are all located within the target geometric object (i.e., multiple subspaces are related to the target geometric object...), If the positional relationship between the current node and the target geometric object is one of inclusion, then the block type corresponding to the current node is determined to be an inner block. If the positional relationships between multiple subspace blocks and the target geometric object are all overlapping or touching, then the block type corresponding to the current node is determined to be a boundary block. If the positional relationships between multiple subspace blocks and the target geometric object are different, and there are subspace blocks among the multiple subspace blocks that have overlapping or touching relationships with the target geometric object, then corresponding nodes are created for the remaining subspace blocks, excluding those that have disjoint relationships with the target geometric object. Thus, different subdivision processing methods are used according to different situations, so that the shape and size of the approximate object continuously approximate the shape and size of the geometric object.
[0132] Specifically, based on the positional relationship between the spatial blocks and the target geometric object, it can be known that for the target geometric object, the spatial blocks may be internal blocks (located inside the target geometric object, and the positional relationship with the target geometric object is one of inclusion), boundary blocks (located on the boundary of the target geometric object, and the positional relationship with the target geometric object is one of overlap or contact), and disjoint blocks (the positional relationship with the target geometric object is one of disjointness, that is, they neither overlap nor contact the target geometric object, nor are they located inside the target geometric object). Of these three types of blocks: internal blocks and disjoint blocks do not contain the shape details of the target geometry (subspace blocks subdivided from internal blocks remain internal blocks, and subspace blocks subdivided from disjoint blocks remain disjoint blocks), and do not require further subdivision; boundary blocks contain the shape details of the target object. For example, taking a quadtree as an example, a boundary block may be subdivided into 3 boundary sub-blocks (i.e., subspace blocks whose positional relationship with the target geometry is overlapping or in contact with it), 1 internal sub-block (i.e., a subspace block located inside the target geometry), and 1 phase block (i.e., a phase block whose positional relationship with the target geometry is...). In different scenarios, such as subspace blocks with distance relationships and three boundary sub-blocks, further subdivision of boundary blocks can eliminate some spatial regions and improve the similarity between the boundary shape of the approximate object and the boundary shape of the target geometric object. Therefore, boundary blocks that can be subdivided into different types of sub-blocks can be further subdivided (i.e., corresponding nodes are created for the subspace blocks subdivided from the boundary block). For boundary blocks whose subdivided subspace blocks are all boundary sub-blocks, since it is impossible to distinguish between different types of subspace blocks, no further subdivision is required (i.e., no corresponding nodes are created for the subspace blocks subdivided from the boundary block).
[0133] Therefore, if all the subspace blocks obtained by the current node are located inside the target geometric object, meaning that the positional relationship between the multiple subspace blocks and the target geometric object is one of containment, then the current node does not contain the shape details of the target geometric object, and there is no need to create a lower-level node. In other words, there is no need to create corresponding nodes for each of these multiple subspace blocks, and the block type corresponding to the current node is determined to be an internal block. However, if the positional relationship between the multiple subspace blocks obtained by the current node and the target geometric object is one of overlap or contact, meaning that the multiple subspace blocks obtained by the current node are all boundary sub-blocks, then this partitioning cannot exclude any other type of subspace block. In other words, it is impossible to distinguish different types of subspace blocks from the current node, and the partitioning is not considered complete. Since the subdivision plays a relatively minor role, there's no need to create lower-level nodes; that is, there's no need to create corresponding nodes for each of the multiple subspace blocks. The current node's block type is determined to be a boundary block. If the multiple subspace blocks obtained from the current node have different positional relationships with the target geometric object, and some of these subspace blocks have overlapping or contact relationships with the target geometric object (i.e., boundary sub-blocks exist), then the current node's division can be further subdivided into boundary sub-blocks and other types of sub-blocks (such as internal sub-blocks or phase-ion blocks), providing more detailed boundary information. Therefore, corresponding nodes can be created for the remaining subspace blocks, excluding those with disjoint relationships with the target geometric object (excluding phase-ion blocks). Thus, by subdividing the spatial blocks corresponding to multiple nodes in the multi-branch tree, the proximity between the approximate object and the target geometric object is improved. Simultaneously, the above judgment avoids meaningless node subdivisions, preventing the multi-branch tree from having too many nodes, which would lead to excessive complexity and storage requirements.
[0134] Furthermore, dividing the spatial block corresponding to the current node into multiple sub-spatial blocks can include: dividing the spatial block into multiple sub-spatial blocks on an average basis according to spatial quadrants, where different sub-spatial blocks are located in different spatial quadrants. In the case where the target geometric object is two-dimensional data, there are four spatial quadrants. The spatial block corresponding to the current node can be divided into four sub-spatial blocks on an average basis according to these four spatial quadrants, thereby improving the accuracy of spatial block division by utilizing spatial quadrants.
[0135] Furthermore, after determining the block type corresponding to the current node based on positional relationships and / or creating corresponding nodes for subspace blocks that meet the subdivision conditions among multiple subspace blocks, the number of nodes in the multi-way tree can be determined. If the number of nodes in the multi-way tree is greater than the soft boundary value, the positional relationship between the leaf node at the bottom level of the multi-way tree and the target geometric object is determined; based on the positional relationship between the leaf node and the target geometric object, the block type corresponding to the leaf node is determined. Thus, the number of nodes in the multi-way tree is constrained based on the soft boundary value, avoiding an excessive number of nodes and an excessively large data volume.
[0136] Specifically, soft boundary values are used here because the number of nodes in a multi-way tree is not strictly limited to being less than or equal to the soft boundary value. After determining the block type corresponding to the current node and / or creating corresponding nodes for subspace blocks that meet the subdivision conditions among multiple subspace blocks, the number of nodes in the multi-way tree may already be greater than the soft boundary value. After completing the subdivision process for the current node, if the number of nodes in the multi-way tree is greater than the soft boundary value, it means that there is no need to further subdivide the spatial blocks corresponding to the nodes in the multi-way tree, and it is necessary to determine the block type corresponding to the leaf nodes of the multi-way tree. Therefore, the positional relationship between the leaf nodes in the multi-way tree and the target geometric object is determined; based on the positional relationship between the leaf nodes and the target geometric object, the block type corresponding to the leaf nodes is determined. Wherein, if the positional relationship between the spatial blocks corresponding to the leaf nodes and the target geometric object all satisfy the target relationship, then the block type corresponding to the leaf nodes can be determined as the target type.
[0137] Furthermore, if the spatial block corresponding to the leaf node is located inside the target geometric object, then the block type corresponding to the leaf node is determined to be an internal block; and / or, if the spatial block corresponding to the leaf node and the target geometric object are in an overlapping or contact relationship, then the block type corresponding to the leaf node is determined to be a boundary block.
[0138] As an example, the process of constructing a multi-way tree may include the following steps 1.1 to 1.3:
[0139] 1.1 Subspace partitioning;
[0140] 1.1.1 Mark the current node as "pending block";
[0141] 1.1.2 Divide the spatial range of the current node (i.e., the spatial block corresponding to the current node) into four subspace blocks by dividing them equally into four quadrants. Determine the spatial relationship (i.e., positional relationship) between each subspace block and the target geometric object based on the DE-9IM model.
[0142] 1.1.3 If all four subspace blocks are inside the target geometry object, no lower-level nodes are created, and the current node is marked as an "internal block";
[0143] 1.1.4 If the spatial relationships between the four subspace blocks and the target geometric object are all overlapping or contacting, then no lower-level nodes will be created, and the current node will be marked as a "boundary block";
[0144] 1.1.5 If the spatial relationships between the four subspace blocks and the target geometric object are different, and there are subspace blocks among the four subspace blocks that have an overlapping or contact relationship with the target geometric object, then ignore the subspace blocks among the four subspace blocks that have a disjoint relationship with the target geometric object, and create corresponding nodes for the remaining subspace blocks.
[0145] 1.2 In each round, all child nodes at the same level are traversed in a breadth-first manner, and each child node is processed according to the method in step 1.1 to generate the next level of nodes;
[0146] 1.3. Pre-set a soft boundary value for the number of blocks. When the total number of nodes in the multi-way tree exceeds this value for the first time, stop subdividing and determine the spatial relationship between each spatial block at the bottom layer (i.e., the spatial block corresponding to the leaf node at the bottom layer) and the target geometric object based on the DE-9IM model.
[0147] 1.3.1 If the spatial block is inside the target geometric object, then mark the leaf node corresponding to the spatial block as an "internal block";
[0148] 1.3.2 If the spatial relationship between the spatial block and the target geometric object is an overlapping or contact relationship, then the leaf node corresponding to the spatial block is marked as a "boundary block".
[0149] S806, determine that the first approximate object and / or the second approximate object are obtained.
[0150] If it is determined that a first approximate object and / or a second approximate object have been obtained, execute S807.
[0151] S807, based on the first approximate object and / or the second approximate object, the second geometric object is filtered to reduce the number of geometric objects in the second geometric object that do not meet the query range.
[0152] The implementation principle and technical effects of S807 can be referred to in the aforementioned embodiments, and will not be repeated here.
[0153] In one possible implementation, S807 may include: filtering the first geometric object and the second geometric object based on positional relationship conditions according to the first approximate object and / or the second approximate object, to determine the positional relationship between the first geometric object and the second geometric object; filtering the second geometric object based on the positional relationship between the first geometric object and the second geometric object to reduce the number of geometric objects in the second geometric object that do not meet the query range; wherein, the positional relationship condition filtering may include at least one of the following: inclusion condition filtering, being included condition filtering, disjoint condition filtering, overlapping or contact condition filtering, and distance range condition filtering. Therefore, based on the first approximate object and / or the second approximate object, geometric objects in the second geometric object whose positional relationship with the first geometric object satisfies at least one of the positional relationship condition filtering methods (including inclusion condition filtering, being included condition filtering, disjoint condition filtering, overlapping or contact condition filtering, and distance range condition filtering) can be filtered out, improving the efficiency, accuracy, and comprehensiveness of geometric object filtering.
[0154] In this implementation, the positional relationship between the first approximate object and the second geometric object can be determined by comparing their respective MBRs, or by comparing the MBR of the first geometric object with that of the second approximate object, or by comparing the first approximate object with that of the second approximate object. When the positional relationship filtering is an inclusion condition, geometric objects whose positional relationship with the first geometric object satisfies the inclusion condition can be selected from the second geometric objects based on their positional relationship. Positional relationship filtering can be categorized as inclusion condition filtering, disjoint condition filtering, overlapping or contact condition filtering, or distance range condition filtering, which is similar to the inclusion condition filtering and will not be described in detail here. The distance range condition filtering refers to the distance between the first and second geometric objects being within a certain range.
[0155] Furthermore, when the positional relationship filtering includes inclusion condition filtering, the positional relationship of the first geometric object and the second geometric object is filtered based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object. This includes: if the MBR of the second geometric object is located inside the inner block of the first approximate object, then the positional relationship between the first geometric object and the second geometric object is determined to be an inclusion relationship; if the MBR of the second geometric object does not overlap with the inner block of the first approximate object and does not overlap with the boundary block of the first approximate object, then the first geometric object and the second geometric object are determined to be a disjoint relationship or a non-inclusion relationship. In this method, it is assumed that the first approximate object is obtained, and the second approximate object is obtained or not obtained, so the MBR of the first approximate object is compared with that of the second geometric object. In the case where the second approximate object is obtained, and the first approximate object is obtained or not obtained, this method can be used as a reference to compare the MBR of the second approximate object with that of the first geometric object; these scenarios will not be elaborated upon here.
[0156] Furthermore, when the positional relationship filtering includes inclusion filtering, the positional relationship of the first geometric object and the second geometric object is filtered based on the first approximate object and / or the second approximate object to determine their positional relationship. This includes: if the MBR of the first geometric object is located inside the inner block of the second approximate object, then the first geometric object and the second geometric object are determined to be in an inclusion relationship; if the MBR of the first geometric object does not overlap with the inner block of the second approximate object and does not overlap with the boundary block of the second approximate object, then the first geometric object and the second geometric object are determined to be in a disjoint relationship or not in an inclusion relationship. In this method, it is assumed that the second approximate object is obtained, and the first approximate object is obtained or not obtained, so the MBR of the second approximate object is compared with that of the first geometric object. In cases where the first approximate object is obtained, and the second approximate object is obtained or not obtained, this method can be used as a reference to compare the MBR of the first approximate object with that of the second geometric object; these cases will not be elaborated upon here.
[0157] Furthermore, when the positional relationship filtering includes separation condition filtering, the positional relationship between the first geometric object and the second geometric object is determined by filtering the positional relationship conditions based on the first approximate object and / or the second approximate object. This can be achieved using at least one of the following methods: If the MBR of the first geometric object does not overlap with the internal blocks of the second approximate object and does not overlap with the boundary blocks of the second approximate object, then the first geometric object and the second geometric object are determined to be in a separation relationship; if the MBR of the second geometric object does not overlap with the internal blocks of the first approximate object and does not overlap with the boundary blocks of the first approximate object, then the first geometric object and the second geometric object are determined to be in a separation relationship; if the internal blocks of the first approximate object do not overlap with either the internal blocks or the boundary blocks of the second approximate object, and the boundary blocks of the first approximate object do not overlap with either the internal blocks or the boundary blocks of the second approximate object, then the first geometric object and the second geometric object are determined to be in a separation relationship. This method is applicable when both the first approximate object and / or the second approximate object are obtained.
[0158] Furthermore, when the positional relationship condition filtering includes overlapping or contact condition filtering, the positional relationship condition filtering is performed on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object. This includes: if the positional relationship between the first geometric object and the second geometric object is not an inclusion relationship, a containment relationship, or a disjoint relationship, then the positional relationship between the first geometric object and the second geometric object is determined to be an overlapping or contact relationship, and geometric objects with an overlapping or contact relationship with the first geometric object can be filtered from the second geometric object. The methods for determining the inclusion relationship may include: if the MBR of the first geometric object is located inside the inner block of the second approximation object, then the first geometric object and the second geometric object are determined to be in an inclusion relationship; the methods for determining the inclusion relationship may include: if the MBR of the second geometric object is located inside the inner block of the first approximation object, then the first geometric object and the second geometric object are determined to be in an inclusion relationship; the methods for determining the separation relationship may include at least one of the following: if the MBR of the second geometric object does not overlap with the inner block of the first approximation object or the boundary block of the first approximation object, then the first geometric object and the second geometric object are determined to be in a separation relationship; if the inner block of the first approximation object does not overlap with the inner block of the second approximation object or the boundary block of the second approximation object, or if the inner block of the second approximation object does not overlap with the inner block of the first approximation object or the boundary block of the first approximation object, then the first geometric object and the second geometric object are determined to be in a separation relationship.
[0159] Furthermore, when the location relationship condition filtering includes distance range condition filtering, the MBR of the first geometric object can be expanded by a preset distance. If the second approximate object overlaps with the expanded MBR of the first geometric object, then the first and second geometric objects are determined to meet the distance range condition; otherwise, they are determined not to meet the distance range condition. Alternatively, the MBR of the second geometric object can be expanded by a preset distance. If the first approximate object overlaps with the expanded MBR of the second geometric object, then the first and second geometric objects are determined to meet the distance range condition; otherwise, they are determined not to meet the distance range condition. Thus, by utilizing approximate objects and expanding the MBR by a preset distance, the accuracy of distance range condition filtering is improved.
[0160] As an example, first, select one of the two geometric objects A and B that has a similar object (if both have similar objects, calculate the MBR area of both and select the one with the larger area). The selected geometric object is called A', and the other geometric object is called B'. Before filtering, based on a given distance d, expand the MBR of B' to MBR', with a length W. B ' and width H B ' can be represented as:
[0161] W B '=W B +2×d,H B '=H B +2×d;
[0162] Among them, W B For the length of the MBR before expansion, H B The width of the MBR before expansion.
[0163] If the approximate object of A' overlaps with the bounding box MBR' of B', then the geometric calculation function performs further calculations and determinations, indicating that A and B meet the distance range condition and can proceed to the next step of more precise calculations. Otherwise, A and B are determined to be outside the distance range.
[0164] In this embodiment, after determining the object parameters of the target geometric object, if an approximate object corresponding to the target geometric object is stored in the cache space, the approximate object can be read from the cache space. If no approximate object corresponding to the target geometric object is stored in the cache space, an approximate object can be generated for the target geometric object and stored in the cache space if it is determined that the target geometric object belongs to a large geometric object. This facilitates the retrieval of approximate objects of large geometric objects at any time, improving the efficiency and accuracy of filtering large geometric objects. When a first approximate object and / or a second approximate object are determined, the second geometric object is filtered by comparing the MBR of the first approximate object and the second geometric object, or by comparing the MBR of the second approximate object and the first geometric object, or by comparing the first approximate object and the second approximate object. The use of approximate objects improves the efficiency and accuracy of filtering geometric objects that satisfy the positional relationship conditions with the first geometric object.
[0165] In some embodiments, before determining the object parameters of the target geometric object, a second geometric object can be selected from multiple geometric objects based on the MBR of the first geometric object and the MBRs corresponding to the multiple geometric objects. Thus, before selecting the second geometric object based on approximate objects, the second geometric object is first selected from multiple geometric objects based on the MBR of the geometric object. This is equivalent to the geometric object undergoing two selections. The first selection is based on the MBR of the geometric object to select the second geometric object. Considering that this selection method is not very accurate, especially for some large geometric objects that cannot be accurately excluded, the second selection uses approximate objects of the geometric object to select geometric objects from the second geometric object that satisfy the positional relationship condition with the first geometric object. Using two selections improves the accuracy of geometric object selection, reduces the number of geometric objects entering the next precise calculation, and improves the query efficiency of geometric objects.
[0166] In some embodiments, the query plan can be rewritten using a database mechanism, adding a secondary filtering step (i.e., a step of filtering geometric objects based on approximate objects) to the query plan. There are various implementation methods available in the database for adding this secondary filtering step to the query plan.
[0167] Taking PostgreSQL as an example: PostgreSQL defines a query plan support function `supportfn(internal)` that returns `internal`. This function provides a callback-based mechanism for modifying the query plan. By implementing this function and specifying it in the `SUPPORT` option when creating the geometry calculation function (a function used for precise calculation of geometric objects), nodes can be added or replaced in the query plan tree to incorporate secondary filtering of geometric objects into the query process. The nodes in the query plan tree correspond to specific operations. Depending on the geometry calculation function, different secondary filtering implementation nodes can be added to the query plan. For example, adding an index comparison expression node to the query plan tree allows access to the function, operator, and parameter nodes within the index comparison expression's subtree. The geometry calculation function or operator used in the index comparison expression will have two geometry object parameters. When the parameter comes from a table column, the corresponding table column information can be obtained through the parameter's node. All this information is then passed to the geometry object secondary filtering module (used to implement secondary filtering of geometric objects, i.e., filtering geometric objects from the second geometric object that satisfy the positional relationship condition with the first geometric object based on the first and second geometric objects).
[0168] The following are embodiments of the apparatus described in this application, which can be used to execute the corresponding method embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the corresponding method embodiments of this application.
[0169] Figure 9 This is a schematic diagram of the structure of the geometric object screening device provided in an embodiment of this application. Figure 9 As shown, the geometric object filtering device 900 provided in this embodiment includes:
[0170] The parameter determination module 901 is used to determine the target geometric object, which includes a first geometric object representing the query range and a second geometric object to be detected as to whether the query range is satisfied.
[0171] The approximate object determination module 902 is used to determine the approximate object corresponding to the target geometric object. The approximate object includes the first approximate object corresponding to the first geometric object and / or the second approximate object corresponding to the second geometric object. The data structure of the approximate object is a multi-branch tree, and the nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximate object.
[0172] The filtering module 903 is used to filter the second geometric object based on the first approximate object and / or the second approximate object, so as to reduce the number of geometric objects in the second geometric object that do not meet the query range.
[0173] In one possible implementation, the target geometric object contains an object identifier of the target geometric object, and the approximate object determination module 902 is specifically used to: if an approximate object is found in the cache space based on the object identifier, then the approximate object is read from the cache space based on the object identifier.
[0174] In one possible implementation, the approximate object determination module 902 is further configured to: if no approximate object is found in the cache space based on the object identifier, determine whether the target geometric object belongs to a large geometric object; if the target geometric object belongs to a large geometric object, generate an approximate object and store the approximate object in the cache space.
[0175] In one possible implementation, in the process of determining whether a target geometric object belongs to a large geometric object if no approximate object is found in the cache space based on the object identifier, the approximate object determination module 902 is specifically used to: determine the attribute value of the minimum boundary matrix (MBR) of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension; compare the attribute value with the upper limit value; if the attribute value is greater than the upper limit value, determine that the target geometric object belongs to a large geometric object, otherwise determine that the target geometric object does not belong to a large geometric object.
[0176] In one possible implementation, during the process of determining the attribute values of the MBR of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension, the approximate object determination module 902 is specifically used to: determine the target column to which the target geometric object belongs in the geometric object column of the data table, wherein the same geometric object column of the data table contains attribute information of geometric objects of the same category; obtain the attribute values of the MBR of the target geometric object in the target dimension from the attribute information of the target geometric object according to the object identifier; determine the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension as the upper limit value of the attribute corresponding to the target column in the target dimension, wherein the upper limit value of the attribute corresponding to the target column in the target dimension is obtained by statistical analysis based on the attribute values of the MBR of multiple geometric objects in the target column in the target dimension.
[0177] In one possible implementation, the statistical process of the upper limit value of the attribute corresponding to the target column in the target dimension includes: calculating the quantiles of the multiple geometric objects in the target dimension based on the attribute values of the MBRs of the multiple geometric objects in the target column in the target dimension; and calculating the upper limit value of the attribute corresponding to the target column in the target dimension based on the quantiles.
[0178] In one possible implementation, during the process of generating approximate objects and storing them in the cache space if the target geometric object belongs to a large geometric object, the approximate object determination module 902 is specifically used to: determine the spatial range of the approximate object based on the MBR of the target geometric object if the target geometric object belongs to a large geometric object; recursively subdivide the spatial range of the approximate object using a multi-branch tree algorithm to generate a multi-branch tree corresponding to the approximate object, the multi-branch tree being used to represent the approximate object; and store the multi-branch tree in the cache space.
[0179] In one possible implementation, during the nth subdivision of the spatial extent of the approximate object, the approximate object determination module 902 is specifically used to: traverse nodes in a multi-way tree to determine the current node; divide the spatial block corresponding to the current node into multiple subspace blocks; determine the positional relationship between the multiple subspace blocks and the target geometric object; and, based on the positional relationship, determine the block type corresponding to the current node and / or create corresponding nodes for the subspace blocks that meet the subdivision conditions among the multiple subspace blocks.
[0180] In one possible implementation, during the process of determining the block type corresponding to the current node based on the positional relationship and / or creating corresponding nodes for the subspace blocks that meet the subdivision conditions among multiple subspace blocks, the approximate object determination module 902 is specifically used to: if multiple subspace blocks are all located inside the target geometric object, then determine the block type corresponding to the current node as an internal block; if the positional relationship between multiple subspace blocks and the target geometric object is an overlapping relationship or a contact relationship, then determine the block type corresponding to the current node as a boundary block.
[0181] In one possible implementation, the approximate object determination module 902 is further configured to: if the positional relationships between multiple subspace blocks and the target geometric object are different and there are subspace blocks among the multiple subspace blocks that have an overlapping or contacting relationship with the target geometric object, then create corresponding nodes for the remaining subspace blocks among the multiple subspace blocks except for the subspace blocks that have a disjoint relationship with the target geometric object.
[0182] In one possible implementation, during the process of dividing the spatial block corresponding to the current node into multiple sub-space blocks, the approximate object determination module 902 is specifically used to: divide the spatial block into multiple sub-space blocks on an average basis according to the spatial quadrant, wherein different sub-space blocks are located in different spatial quadrants.
[0183] In one possible implementation, the approximate object determination module 902 is further configured to: determine the number of nodes in the multi-way tree after determining the block type corresponding to the current node based on the positional relationship and / or creating corresponding nodes for the subspace blocks that meet the subdivision conditions among multiple subspace blocks; if the number of nodes is greater than the soft boundary value, determine the positional relationship between the leaf node at the bottom level of the multi-way tree and the target geometric object; and determine the block type corresponding to the leaf node based on the positional relationship between the leaf node and the target geometric object.
[0184] In one possible implementation, the filtering module 903 is specifically used to: perform positional relationship filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object; and filter the second geometric object based on the positional relationship between the first geometric object and the second geometric object to reduce the number of geometric objects in the second geometric object that do not meet the query range; wherein, the positional relationship filtering may include at least one of the following: inclusion condition filtering, being included condition filtering, disjoint condition filtering, overlapping or contact condition filtering, and distance range condition filtering.
[0185] In one possible implementation, when the positional relationship condition filtering includes inclusion condition filtering, in the process of determining the positional relationship between the first geometric object and the second geometric object by performing positional relationship condition filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object, the filtering module is specifically used to: if the MBR of the second geometric object is located inside the inner block of the first approximate object, then determine that the positional relationship between the first geometric object and the second geometric object is an inclusion relationship; if the MBR of the second geometric object does not overlap with the inner block of the first approximate object and does not overlap with the boundary block of the first approximate object, then determine that the first geometric object and the second geometric object are a disjoint relationship or a non-inclusion relationship.
[0186] In one possible implementation, when the positional relationship filtering includes inclusion condition filtering, during the process of filtering the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object, the filtering module 903 is specifically used to: if the MBR of the first geometric object is located inside the inner block of the second approximate object, then determine that the first geometric object and the second geometric object are in an inclusion relationship; if the MBR of the first geometric object does not overlap with the inner block of the second approximate object and the MBR of the first geometric object does not overlap with the boundary block of the second approximate object, then determine that the first geometric object and the second geometric object are in a disjoint relationship or are not in an inclusion relationship.
[0187] In one possible implementation, when the positional relationship condition filtering includes the separation condition filtering, during the process of filtering the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object, the filtering module 903 is specifically used to perform at least one of the following: if the MBR of the first geometric object does not overlap with the inner block of the second approximate object and the MBR of the first geometric object does not overlap with the boundary block of the second approximate object, then the first geometric object and the second geometric object are determined to be in a separation relationship; if the MBR of the second geometric object does not overlap with the inner block of the first approximate object and the MBR of the second geometric object does not overlap with the boundary block of the first approximate object, then the first geometric object and the second geometric object are determined to be in a separation relationship; if the inner block of the first approximate object does not overlap with the inner block of the second approximate object and the boundary block of the second approximate object, and the boundary block of the first approximate object does not overlap with the inner block of the second approximate object and the boundary block of the second approximate object, then the first geometric object and the second geometric object are determined to be in a separation relationship.
[0188] In one possible implementation, the geometric object screening device further includes: a primary screening module (not shown in the figure), used to screen out a second geometric object from multiple geometric objects based on the MBR of the first geometric object and the MBRs corresponding to the multiple geometric objects respectively.
[0189] It is worth noting that the geometric object filtering devices provided in the above embodiments can be used to execute each step in the geometric object filtering method provided in any of the above embodiments. The specific implementation methods and technical effects are similar, and will not be repeated here.
[0190] The device embodiments provided in this application are merely illustrative, and the module division is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system. The coupling between the modules can be achieved through interfaces, which are usually electrical communication interfaces, but mechanical interfaces or other forms of interfaces are also possible. Therefore, the modules described as separate components may or may not be physically separate; they may be located in one place or distributed in different locations on the same or different devices.
[0191] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 10 As shown, the electronic device 1000 may include at least one processor 1001 and a memory 1002. Figure 10 The example shown is an electronic device using a processor.
[0192] The memory 1002 is used to store the program of the processor 1001. Specifically, the program may include program code, which includes computer operation instructions.
[0193] The memory 1002 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0194] The processor 1001 is configured to execute a computer program stored in the memory 1002 to implement the steps in the geometric object filtering method in the above method embodiments.
[0195] The processor 1001 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0196] Optionally, the memory 1002 can be either independent or integrated with the processor 1001. When the memory 1002 is a device independent of the processor 1001, the electronic device 1000 may further include a bus 1003 for connecting the processor 1001 and the memory 1002. The bus can be an industry standard architecture (ISA) bus, a peripheral component (PCI) bus, or an extended industry standard architecture (EISA) bus, etc. Buses can be classified as address buses, data buses, control buses, etc., but this does not mean that there is only one bus or one type of bus.
[0197] Optionally, in a specific implementation, if the memory 1002 and the processor 1001 are integrated on a single chip, then the memory 1002 and the processor 1001 can communicate through an internal interface.
[0198] This application also provides a computer-readable storage medium, which may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Specifically, the computer-readable storage medium stores computer-executable instructions. When at least one processor of the electronic device executes the computer-executable instructions, the electronic device executes each step of the geometric object screening method provided in the above-described embodiments.
[0199] This application also provides a computer program product comprising a computer program stored in a readable storage medium. At least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause the electronic device to perform the various steps of the geometric object screening methods provided in the various embodiments described above.
[0200] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0201] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for filtering geometric objects, characterized in that, include: Determine the target geometric object, which includes a first geometric object representing a query range and a second geometric object to be detected as to whether it satisfies the query range; Determine the approximate object corresponding to the target geometric object. The approximate object includes a first approximate object corresponding to the first geometric object and / or a second approximate object corresponding to the second geometric object. The data structure of the approximate object is a multi-branch tree, and the nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximate object. Based on the first approximate object and / or the second approximate object, the second geometric object is filtered to reduce the number of geometric objects in the second geometric object that do not meet the query range; The target geometric object contains an object identifier for the target geometric object, and determining the approximate object corresponding to the target geometric object includes: If the approximate object is found in the cache space based on the object identifier, then the approximate object is read from the cache space based on the object identifier. The step of filtering the second geometric object based on the first approximation object and / or the second approximation object includes: Based on the first approximate object and / or the second approximate object, the positional relationship between the first geometric object and the second geometric object is filtered to determine the positional relationship between the first geometric object and the second geometric object; based on the positional relationship between the first geometric object and the second geometric object, the second geometric object is filtered.
2. The geometric object filtering method according to claim 1, characterized in that, Also includes: If the approximate object is not found in the cache space according to the object identifier, it is determined whether the target geometric object belongs to a large geometric object; If the target geometric object is a large geometric object, then the approximate object is generated and stored in the cache space.
3. The geometric object filtering method according to claim 2, characterized in that, If no approximate object is found in the cache space based on the object identifier, determining whether the target geometric object belongs to a large geometric object includes: Determine the attribute values of the minimum boundary matrix (MBR) of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension; Compare the attribute value with the attribute upper limit value; If the attribute value is greater than the attribute upper limit value, the target geometric object is determined to be a large geometric object; otherwise, the target geometric object is determined not to be a large geometric object.
4. The geometric object filtering method according to claim 3, characterized in that, The step of determining the attribute values of the MBR of the target geometric object in the target dimension and the upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension includes: In the geometric object column of the data table, determine the target column to which the target geometric object belongs, and the same geometric object column of the data table contains attribute information of geometric objects of the same category; Based on the object identifier, obtain the attribute value of the MBR of the target geometric object in the target dimension from the attribute information of the target geometric object; The upper limit value of the attribute corresponding to the object category to which the target geometric object belongs in the target dimension is determined to be the upper limit value of the attribute corresponding to the target column in the target dimension. The upper limit value of the attribute corresponding to the target column in the target dimension is obtained by statistically analyzing the attribute values of the MBR of multiple geometric objects in the target column in the target dimension.
5. The geometric object filtering method according to claim 4, characterized in that, The statistical process for calculating the upper limit value of the attribute corresponding to the target dimension of the target column includes: Based on the attribute values of the MBR of multiple geometric objects in the target column on the target dimension, the quantiles of the multiple geometric objects on the target dimension are calculated. Based on the quantiles, the upper limit value of the attribute corresponding to the target column in the target dimension is calculated.
6. The geometric object screening method according to any one of claims 2 to 5, characterized in that, If the target geometric object is a large geometric object, then generating the approximate object and storing the approximate object in the cache space includes: If the target geometric object is a large geometric object, then the spatial extent of the approximate object is determined according to the MBR of the target geometric object; The spatial range of the approximate object is recursively subdivided by a multi-branch tree algorithm to generate a multi-branch tree corresponding to the approximate object, and the multi-branch tree is used to represent the approximate object. The multi-way tree is stored in the cache space.
7. The geometric object filtering method according to claim 6, characterized in that, In the process of recursively subdividing the spatial range of the approximate object using a multi-branch tree algorithm to generate the multi-branch tree corresponding to the approximate object, the nth subdivision of the spatial range of the approximate object includes: Perform node traversal in the multi-way tree to determine the current node; The spatial block corresponding to the current node is divided into multiple sub-spatial blocks; Determine the positional relationship between the plurality of subspace blocks and the target geometric object; Based on the positional relationship, determine the block type corresponding to the current node and / or create corresponding nodes for the subspace blocks that meet the subdivision conditions among the multiple subspace blocks.
8. The geometric object filtering method according to claim 7, characterized in that, The step of determining the block type corresponding to the current node based on the positional relationship and / or creating corresponding nodes for the subspace blocks that meet the subdivision conditions among the multiple subspace blocks includes: If all the multiple subspace blocks are located inside the target geometric object, then the block type corresponding to the current node is determined to be an internal block; If the positional relationship between the multiple subspace blocks and the target geometric object is an overlapping relationship or a contact relationship, then the block type corresponding to the current node is determined to be a boundary block.
9. The geometric object filtering method according to claim 8, characterized in that, Also includes: If the positional relationships between the multiple subspace blocks and the target geometric object are different, and there are subspace blocks among the multiple subspace blocks that have an overlapping or contacting relationship with the target geometric object, then corresponding nodes are created for the remaining subspace blocks among the multiple subspace blocks, excluding the subspace blocks that have a disjoint relationship with the target geometric object.
10. The geometric object filtering method according to claim 7, characterized in that, The step of dividing the spatial block corresponding to the current node into multiple sub-spatial blocks includes: The spatial block is divided into multiple sub-spatial blocks according to the spatial quadrants, wherein different sub-spatial blocks are located in different spatial quadrants.
11. The geometric object filtering method according to claim 7, characterized in that, After determining the block type corresponding to the current node based on the positional relationship and / or creating corresponding nodes for the subspace blocks that meet the subdivision conditions among the multiple subspace blocks, the method further includes: Determine the number of nodes in the multi-way tree; If the number of nodes is greater than the soft boundary value, then the positional relationship between the leaf nodes of the multi-way tree and the target geometric object is determined. The block type corresponding to the leaf node is determined based on the positional relationship between the leaf node and the target geometric object.
12. The method for screening geometric objects according to any one of claims 1 to 5, characterized in that, The step of filtering the second geometric object based on the first approximation object and / or the second approximation object to reduce the number of geometric objects in the second geometric object that do not meet the query range includes: Based on the first approximate object and / or the second approximate object, the positional relationship between the first geometric object and the second geometric object is filtered to determine the positional relationship between the first geometric object and the second geometric object; Based on the positional relationship between the first geometric object and the second geometric object, the second geometric object is filtered to reduce the number of geometric objects in the second geometric object that do not meet the query range; The location relationship filtering can include at least one of the following: inclusion filtering, being included filtering, separation filtering, overlapping or contact filtering, and distance range filtering.
13. The geometric object filtering method according to claim 12, characterized in that, When the positional relationship condition filtering includes inclusion condition filtering, the step of performing positional relationship condition filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object includes: If the MBR of the second geometric object is located inside the inner block of the first approximate object, then the positional relationship between the first geometric object and the second geometric object is determined to be an inclusion relationship; If the MBR of the second geometric object does not overlap with the inner blocks of the first approximate object and the MBR of the second geometric object does not overlap with the boundary blocks of the first approximate object, then the first geometric object and the second geometric object are determined to be either disjoint or not contained.
14. The geometric object filtering method according to claim 12, characterized in that, When the positional relationship filtering includes inclusion condition filtering, the step of performing positional relationship condition filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object includes: If the MBR of the first geometric object is located inside the inner block of the second approximate object, then the first geometric object and the second geometric object are determined to be in an inclusive relationship. If the MBR of the first geometric object does not overlap with the inner blocks of the second approximate object and the boundary blocks of the first geometric object does not overlap with the boundary blocks of the second approximate object, then the first geometric object and the second geometric object are determined to be either disjoint or not contained.
15. The geometric object filtering method according to claim 12, characterized in that, When the positional relationship filtering includes separation condition filtering, the step of performing positional relationship filtering on the first geometric object and the second geometric object based on the first approximate object and / or the second approximate object to determine the positional relationship between the first geometric object and the second geometric object adopts at least one of the following methods: If the MBR of the first geometric object does not overlap with the inner blocks of the second approximate object and the boundary blocks of the first geometric object does not overlap with the boundary blocks of the second approximate object, then the first geometric object and the second geometric object are determined to be disjoint. If the MBR of the second geometric object does not overlap with the inner blocks of the first approximate object and the MBR of the second geometric object does not overlap with the boundary blocks of the first approximate object, then the first geometric object and the second geometric object are determined to be disjoint. If the inner blocks of the first approximation object do not overlap with the inner blocks of the second approximation object or the boundary blocks of the second approximation object, and the boundary blocks of the first approximation object do not overlap with the inner blocks of the second approximation object or the boundary blocks of the second approximation object, then the first geometric object and the second geometric object are determined to be in a disjoint relationship.
16. The method for screening geometric objects according to any one of claims 1 to 5, characterized in that, Before determining the target geometric object, the process also includes: Based on the MBR of the first geometric object and the MBRs corresponding to the plurality of geometric objects, the second geometric object is selected from the plurality of geometric objects.
17. A geometric object screening device, characterized in that, include: A parameter determination module is used to determine a target geometric object, the target geometric object including a first geometric object representing a query range and a second geometric object to be detected as to whether it satisfies the query range; An approximation object determination module is used to determine the approximation object corresponding to the target geometric object. The approximation object includes a first approximation object corresponding to the first geometric object and / or a second approximation object corresponding to the second geometric object. The data structure of the approximation object is a multi-branch tree, and the nodes on the multi-branch tree correspond to the spatial blocks within the spatial range of the approximation object. The filtering module is used to filter the second geometric object based on the first approximate object and / or the second approximate object, so as to reduce the number of geometric objects in the second geometric object that do not meet the query range; The target geometric object contains an object identifier of the target geometric object. The approximate object determination module is specifically used to read the approximate object from the cache space based on the object identifier if the approximate object is found in the cache space based on the object identifier. The filtering module is specifically used to filter the first geometric object and the second geometric object based on the positional relationship conditions of the first approximate object and / or the second approximate object, and to determine the positional relationship between the first geometric object and the second geometric object; and to filter the second geometric object based on the positional relationship between the first geometric object and the second geometric object.
18. An electronic device comprising: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the geometric object filtering method as described in any one of claims 1 to 16.
19. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the geometric object screening method as described in any one of claims 1 to 16.
Citation Information
Patent Citations
GIS (Geographic Information System) spatial object storage method and system thereof
CN108090150A
A clustering and query method and system for spatial data search results
CN112765405A