CN116244338A - Geometric object screening method, device, equipment and storage medium - Google Patents

Geometric object screening method, device, equipment and storage medium Download PDF

Info

Publication number
CN116244338A
CN116244338A CN202211736744.0A CN202211736744A CN116244338A CN 116244338 A CN116244338 A CN 116244338A CN 202211736744 A CN202211736744 A CN 202211736744A CN 116244338 A CN116244338 A CN 116244338A
Authority
CN
China
Prior art keywords
geometric
geometric object
target
approximate
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211736744.0A
Other languages
Chinese (zh)
Inventor
王伟
王海燕
王建华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingbase Information Technologies Co Ltd
Original Assignee
Beijing Kingbase Information Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingbase Information Technologies Co Ltd filed Critical Beijing Kingbase Information Technologies Co Ltd
Priority to CN202211736744.0A priority Critical patent/CN116244338A/en
Publication of CN116244338A publication Critical patent/CN116244338A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/29Geographical information databases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Remote Sensing (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a geometric object screening method, a geometric object screening device, geometric object screening equipment and a storage medium, and relates to the technical field of data processing. The method comprises the steps of determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met; determining an approximate object corresponding to the target geometric object, wherein the approximate object comprises 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-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object; and screening the second geometric objects according to the first approximate object and/or the second approximate object to reduce geometric objects which do not meet the query range in the second geometric objects. Therefore, the screening of the geometric objects is realized by using the approximate objects, and the accuracy of the screening of the geometric objects is improved.

Description

Geometric object screening method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a geometric object screening method, device, apparatus, and storage medium.
Background
The spatial data used by the geographic information system (Geographic Information System, GIS) is multi-dimensional data, typically consisting of multi-dimensional coordinates or a sequence of coordinates consisting of multi-dimensional coordinates.
For such multidimensional data, a minimum boundary matrix (Minimum Bounding Rectangle, MBR) of a geometric object (i.e., a geometric shape corresponding to the spatial data) may be used as a spatial index of the geometric object (i.e., the spatial data), and the query of the spatial data is implemented based on the spatial index: firstly, if the available spatial index exists in the geometric objects, performing efficient preliminary screening on the geometric objects by utilizing the spatial index, for example, rapidly eliminating the geometric objects which are not overlapped with the query range by MBR (membrane bioreactor) so as to reduce the query range; and secondly, carrying out accurate geometric calculation aiming at the result of the primary screening in the first step, and accurately selecting the geometric object which really meets the query condition.
However, the accuracy of the geometric object screening in the first step is lower, so that more geometric objects are reserved to the second step for accurate calculation, and further, the calculation resource waste and the query efficiency are reduced.
Disclosure of Invention
The application provides a geometric object screening method, a device, equipment and a storage medium, which are used for solving the problems of low computational resource waste and low query efficiency of geometric object query caused by low geometric object screening precision.
In a first aspect, the present application provides a geometric object screening method, including:
determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met;
determining an approximate object corresponding to the target geometric object, wherein the approximate object comprises 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-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object;
and screening the second geometric objects according to the first approximate objects and/or the second approximate objects to reduce geometric objects which do not meet the query range in the second geometric objects.
In one possible implementation manner, the target geometric object includes an object identifier of the target geometric object, and the determining the approximate object corresponding to the target geometric object includes: and if the approximate object is found in the cache space according to the object identification, reading the approximate object from the cache space according to the object identification.
In one possible implementation, the method further includes: if the approximate object is not found in the cache space according to the object identification, determining whether the target geometric object belongs to a large geometric object; and if the target geometric object belongs to a large geometric object, generating the approximate object and storing the approximate object into the cache space.
In a possible implementation manner, if the approximate object is not found in the cache space according to the object identifier, determining whether the target geometric object belongs to a large geometric object includes: determining an attribute value of a minimum boundary matrix MBR of the target geometric object in a target dimension and an attribute upper limit value of an object class of the target geometric object in the target dimension; comparing the attribute value with the attribute upper limit value; and if the attribute value is larger than the attribute 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 the large geometric object.
In one possible implementation manner, the determining the attribute value of the MBR of the target geometric object in the target dimension and the attribute upper limit value of the object class to which the target geometric object belongs in the target dimension includes: determining a target column to which the target geometric object belongs in a geometric object column of a data table, wherein the same geometric object column of the data table contains attribute information of geometric objects of the same category; according to the object identification, acquiring an attribute value of the MBR of the target geometric object in the target dimension from the attribute information of the target geometric object; and determining the attribute upper limit value of the object class of the target geometric object corresponding to the target dimension as the attribute upper limit value of the target column corresponding to the target dimension, wherein the attribute upper limit value of the target column corresponding to the target dimension is obtained by statistics according to the attribute values of MBRs of a plurality of geometric objects in the target column in the target dimension.
In one possible implementation manner, the statistical process of the attribute upper limit value corresponding to the target dimension by the target column includes: according to the attribute values of MBRs of a plurality of geometric objects in the target column on the target dimension, respectively, counting the quantiles of the geometric objects on the target dimension; and counting the attribute upper limit value corresponding to the target dimension of the target column according to the quantile.
In one possible implementation manner, if the target geometric object belongs to a large geometric object, generating the approximate object and storing the approximate object in the cache space 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 space range of the approximate object through a multi-way tree algorithm to generate a multi-way tree corresponding to the approximate object, wherein the multi-way tree is used for representing the approximate object; and storing the multi-way tree into the cache space.
In one possible implementation manner, in a process of recursively subdividing a spatial range of the approximate object through a multi-tree algorithm to generate a multi-tree corresponding to the approximate object, an nth subdivision of the spatial range of the approximate object includes: traversing nodes in the multi-way tree, and determining the current node; dividing the space block corresponding to the current node into a plurality of subspace blocks; determining the position relation between the subspace partitions and the target geometric object; and determining the partition type corresponding to the current node and/or creating a corresponding node for the subspace partition meeting the subdivision condition in the subspace partitions according to the position relation.
In a possible implementation manner, the determining, according to the location relationship, a partition type corresponding to the current node and/or creating a corresponding node for a subspace partition that satisfies a subdivision condition in the plurality of subspace partitions includes: if the subspace partitions are all located in the target geometric object, determining that the partition type corresponding to the current node is an inner partition; and if the position relations of the subspace partitions and the target geometric object all belong to an overlapping relation or a contact relation, determining the partition type corresponding to the current node as a boundary partition.
In one possible implementation, the method further includes: if the position relations between the subspace blocks and the target geometric object are different, and subspace blocks with the position relation of the target geometric object being in an overlapping relation or a contact relation exist in the subspace blocks, corresponding nodes are created for the rest subspace blocks except for the subspace blocks with the position relation of the target geometric object being in a separation relation.
In one possible implementation manner, the dividing the spatial block corresponding to the current node into a plurality of subspace blocks includes: and dividing the space block into a plurality of subspace blocks on average according to the space quadrant, wherein different subspace blocks are positioned in different space quadrants.
In a possible implementation manner, after determining, according to the location relationship, a partition type corresponding to the current node and/or creating a corresponding node for a subspace partition that satisfies a subdivision condition in the plurality of subspace partitions, the method further includes: determining the node number of the multi-way tree; if the number of the nodes is larger than a soft boundary value, determining the position relation between the leaf nodes of the multi-way tree and the target geometric object; and determining the block type corresponding to the leaf node according to the position relation between the leaf node and the target geometric object.
In one possible implementation manner, the filtering the second geometric objects according to the first approximate object and/or the second approximate object to reduce geometric objects that do not meet the query scope in the second geometric objects includes: according to the first approximate object and/or the second approximate object, carrying out position relation condition screening on the first geometric object and the second geometric object, and determining the position relation between the first geometric object and the second geometric object; screening the second geometric objects according to the position relation between the first geometric objects and the second geometric objects so as to reduce geometric objects which do not meet the query range in the second geometric objects; wherein, the position relation condition screening can comprise at least one of the following: inclusion condition screening, separation condition screening, overlap or contact condition screening, and distance range condition screening.
In a possible implementation manner, in a case that the positional relationship condition filtering includes inclusion condition filtering, the performing, according to the first approximate object and/or the second approximate object, positional relationship condition filtering on the first geometric object and the second geometric object, to determine a positional relationship between the first geometric object and the second geometric object includes: if the MBR of the second geometric object is positioned inside the inner partition of the first approximate object, determining that the position 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 partition of the first approximate object and the MBR of the second geometric object does not overlap with the boundary partition of the first approximate object, determining that the first geometric object is in a disjoint relationship or not in an inclusive relationship with the second geometric object.
In a possible implementation manner, in a case that the positional relationship condition filtering includes inclusion condition filtering, the performing, according to the first approximate object and/or the second approximate object, positional relationship condition filtering on the first geometric object and the second geometric object, to determine a positional relationship between the first geometric object and the second geometric object includes: if the MBR of the first geometric object is positioned inside the inner partition of the second approximate object, determining that the first geometric object and the second geometric object are in a contained relation; if the MBR of the first geometric object does not overlap with the inner partition of the second approximate object and the MBR of the first geometric object does not overlap with the boundary partition of the second approximate object, determining that the first geometric object is in a disjoint relationship or not contained relationship with the second geometric object.
In a possible implementation manner, in a case that the positional relationship condition filtering includes a separation condition filtering, the positional relationship condition filtering is performed on the first geometric object and the second geometric object according to the first approximate object and/or the second approximate object, and a positional relationship between the first geometric object and the second geometric object is determined, where at least one of the following manners is adopted: determining that the first geometric object is in a disjoint relationship with the second geometric object if the MBR of the first geometric object does not overlap with an inner partition of the second approximate object and the MBR of the first geometric object does not overlap with a boundary partition of the second approximate object; determining that the first geometric object is in a disjoint relationship with the second geometric object if the MBR of the second geometric object does not overlap with the inner partition of the first approximation object and the MBR of the second geometric object does not overlap with the boundary partition of the first approximation object; and if the inner partition of the first approximate object is not overlapped with the inner partition of the second approximate object and the boundary partition of the second approximate object are not overlapped, determining that the first geometric object and the second geometric object are in a separation relation.
In one possible implementation manner, before the determining the target geometric object, the method further includes: and screening the second geometric objects from the plurality of geometric objects according to the MBRs of the first geometric objects and the MBRs respectively corresponding to the plurality of geometric objects.
In a second aspect, the present application provides a geometric object screening device, including:
the parameter determining module is used for determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met;
the approximate object determining module is used for determining an approximate object corresponding to the target geometric object, wherein the approximate object comprises 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-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object;
and the screening module is used for screening the second geometric objects according to the first approximate objects and/or the second approximate objects so as to reduce geometric objects which do not meet the query range in the second geometric objects.
In a third aspect, the present application provides an electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes the computer-executable instructions stored in the memory to cause the at least one processor to perform the geometric object screening method as provided in the first aspect above.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, are configured to implement the geometric object screening method as provided in the first aspect above.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements a geometric object screening method as in the first aspect described above.
The geometric object screening method, the geometric object screening device, the geometric object screening equipment and the storage medium are used for determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met; according to object parameters of the target geometric object, determining an approximate object corresponding to the target geometric object, wherein the approximate object comprises a first approximate object corresponding to the first geometric object, a data structure of the approximate object is a multi-way tree, nodes on the multi-way tree correspond to space blocks in a space range of the approximate object, and the approximate object is similar to the geometric object through combination of a plurality of space blocks, and compared with MBR, the approximate object can simulate the geometric object more accurately in fine granularity. Therefore, the second geometric objects are screened according to the first approximate objects and/or the second approximate objects, so that geometric objects which do not meet the query range in the second geometric objects are reduced, the screening precision of the geometric objects can be effectively improved, fewer geometric objects enter into the accurate geometric calculation stage of the geometric object query process, the waste of calculation resources is reduced, and the query efficiency of the geometric objects is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is an exemplary diagram of an MBR;
FIG. 2 is a diagram showing an example of the structure of an R tree;
FIG. 3 is a diagram showing an example spatial distribution of MBRs stored in an R tree;
FIG. 4 is an exemplary diagram of a T-shaped tank and an MBR of the T-shaped tank;
fig. 5 is a schematic diagram of an application scenario applicable to the embodiment of the present application;
fig. 6 is a flowchart of a geometric object screening method according to an embodiment of the present application;
fig. 7 is a second flowchart of a geometric object screening method according to an embodiment of the present application;
fig. 8 is a flowchart of a geometric object screening method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a geometric object screening device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments thereof have been shown by way of example in the drawings and will herein be described in more detail. These drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
First, in order to facilitate understanding of the present solution, part of terms of the present application will be explained:
geometric objects: in spatial data, a geometric object refers to a topographical feature, such as a building, swimming pool, etc., in a coordinate system, the geometric object may appear as a shaped geometric figure.
Minimum boundary matrix (Minimum Bounding Rectangle, MBR) of geometric objects: also called Bounding Box (MBR), each side of the MBR is parallel to a coordinate axis and can enclose a minimum rectangle of a geometric object, which concept can be extended to three-dimensional, four-dimensional or even higher dimensional geometric objects. For example, fig. 1 is an exemplary diagram of an MBR, in fig. 1, two geometric objects and MBRs corresponding to the two geometric objects, respectively, are shown, with sides of the MBR (including a length of the MBR and a width of the MBR) parallel to the coordinate axes and the MBR surrounding the geometric objects.
R tree (R-tree): a tree-like data structure, R tree can use MBR as index item. For example, taking a two-dimensional dataset as an example, each leaf node of the R tree may hold the MBRs of one geometric object, respectively, and the non-leaf nodes of the R tree hold the MBRs that can contain the coverage of all the lower nodes. For example, fig. 2 is a structural example diagram of an R tree, fig. 3 is a spatial distribution example diagram of MBRs stored in the R tree, in fig. 2 and 3, R1 to R19 are different MBRs, and in fig. 3, the shape of a geometric object is shown in R8. As can be seen from fig. 3, among others: 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. In fig. 2, R1 to R19 are each stored in the form of an R tree, and the relationship between R1 to R19 is represented.
In the related art, by taking the MBR of the geometric object as the spatial index of the geometric object, flexible and efficient query of the spatial data is realized. In the case that the geometric object has a spatial index, the query process of the spatial data can be divided into the following two steps: firstly, if the available space index exists in the geometric objects, introducing high-efficiency preliminary screening by utilizing the space index, taking an R tree as an example, and rapidly eliminating the geometric objects which are not overlapped with the query range by MBR in the R tree, wherein although all the geometric objects which do not meet the conditions cannot be eliminated, the query range can be rapidly reduced; and secondly, carrying out accurate geometric calculation aiming at the primary screening result of the first step, wherein the calculation cost of the step is high, but the geometric object which really accords with the query condition can be selected. To further improve the query effect of the above approach, one can proceed from two aspects: in one aspect, an improvement is made to the R tree; on the other hand, a secondary filtering is performed before performing the second-step exact geometric calculation to further narrow the calculation range of the second step.
In a way of improving R trees, many varieties of R trees are derived:
R + tree (R) + -tree): and when the nodes are split, the MBR of the cross-node geometric object (namely, one part of the MBR corresponds to one node and the other part of the MBR corresponds to the other node) is segmented, so that the effect of mutual non-overlapping among the nodes is achieved through the redundancy of the MBR of the part of the geometric object.
R * Tree (R) * -tree): selecting overlapping by adopting a double sequencing node splitting (double sequencing-based node splitting) algorithmThe data is inserted with a minimum of slicing directions and positions, and the quality of the spatial index is prevented from being reduced along with the insertion and updating of the data by a method of 'forced reinsertion'.
QR tree: the space is divided into subspaces using quadtrees, and a number of R-tree indices are used in each subspace, thereby improving the overlap of the spatial indices.
SS tree: to improve the performance of nearest neighbor queries, the shape of the region is represented by a minimum bounding circle instead of MBR, i.e., the minimum bounding circle is used as a spatial index.
X tree: linear arrays and layered R-tree hybrids. By introducing super nodes, the overlap among MBRs is greatly reduced, and the query efficiency is improved.
The manner of performing the secondary filtering prior to performing the second step of exact geometric calculations is as follows: a spatial index is established for constituent elements (such as edges) of the geometric objects, and a secondary filtering is performed based on the spatial index so as to further reduce constituent elements participating in complex geometric calculations.
In actual spatial data, there are often cases where: in one case, some geometric objects are significantly larger in size than most other geometric objects, with a large MBR; in another case, the shape and extension direction of the geometric objects in the display are often irregular, and for ease of calculation, each side of the MBR is parallel to the coordinate axes, resulting in a large area of empty space between the body of the geometric objects and the boundary of the MBR. For example, FIG. 4 is an exemplary illustration of a T-shaped tank and an MBR of the T-shaped tank, and it can be seen from FIG. 4 that the T-shaped tank is elongated in shape, is much larger in size than the surrounding building, has a large MBR, and occupies a large percentage of the hollow white area of the MBR. In space query, due to the large coverage area of MBR, the geometric objects have higher probability of being reserved in the first step of preliminary screening, and then are found to be inconsistent with query conditions in the second round of accurate calculation, so that the waste of calculation resources is caused, in particular, the naturally formed terrain and ground features are generally provided with complex and irregular boundaries, and the larger the geometric objects are, the more the shape details are, and the larger the calculation amount is. However, neither the improvement described above for the R tree nor the manner in which the secondary filtering is performed prior to the second step of accurate geometric computation takes this into account.
In order to solve the above disadvantages, the present application provides a geometric object screening method, device, apparatus and storage medium. In the present application, screening of geometric objects is achieved using approximation objects of the geometric objects. The approximate object of the geometric object is a multi-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object, so that the approximate object is embodied as a combination of a plurality of space blocks, the geometric object is approximated and simulated through the combination of the plurality of space blocks, compared with the MBR of the geometric object, the similarity degree of the approximate object and the geometric object is higher, and the blank area between the boundary of the approximate object and the geometric object body is less. Therefore, the screening of the geometric objects is performed according to the approximate objects of the geometric objects, and compared with the screening of the geometric objects based on the MBR of the geometric objects, the screening accuracy is higher, so that fewer geometric objects can enter a complex geometric calculation stage, the calculation resources are reduced, and the space query efficiency is improved.
Fig. 5 is a schematic diagram of an application scenario applicable to the embodiment of the present application. As shown in fig. 5, the apparatus related to the application scenario includes a spatial data query apparatus 501 and a database 502, where spatial data and spatial query conditions are stored, where the spatial data may include information related to a plurality of geometric objects, for example, location information of a plurality of constituent elements (such as edges) on the geometric objects, and, for example, similar objects of the geometric objects. The spatial data query device 501 may obtain corresponding data from the database 502, and query a plurality of geometric objects for geometric objects satisfying a query scope based on the obtained data, where the method includes filtering the geometric objects based on approximate objects of the geometric objects. The spatial data query device 501 may be a server or a terminal, and fig. 5 illustrates the server as an example.
The terminal may be a personal digital processing (personal digital assistant, PDA for short), a handheld device (e.g., a smart phone, a tablet computer), a computing device (e.g., a personal computer (personal computer, PC for short)), a vehicle-mounted device, a wearable device (e.g., a smart watch, a smart bracelet), a smart home device (e.g., a smart display device), etc. The servers may be distributed servers, centralized servers, cloud servers, and the like.
The following describes the technical solution of the present application and how the technical solution of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Referring to fig. 6, fig. 6 is a flowchart illustrating a geometric object screening method according to an embodiment of the present application. As shown in fig. 6, the geometric object screening method provided in this embodiment includes:
s601, determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met.
Wherein the first geometric object and the second geometric object may be one or more.
Screening the second geometric objects refers to screening the geometric objects meeting the query range from the second geometric objects. Since the first geometric object represents the query scope, the filtering of the second geometric object can be achieved by comparing the first geometric object with the second geometric object in pairs. Specifically, by comparing the first geometric object with the second geometric object, the geometric object meeting the requirement of a certain position relation with the position relation of the first geometric object can be screened out from the second geometric object, and the probability that the geometric object meets the query range is higher. For example, if the first geometric object is a city a, the second geometric object is a building, and the positional relationship is required to be an inclusion relationship, the building included in the city a may be screened out from a plurality of buildings.
In this embodiment, the target geometric object may include location information of a plurality of constituent elements (such as points and edges) on the target geometric object. The target geometric object may be from a previous task, for example, the previous task performs preliminary screening of geometric objects, screens out a second geometric object, and determines that the current task needs to screen the second geometric object by taking the first geometric object as a query range, so that the first geometric object and the second geometric object are transferred to the current task, and the current task is a task for realizing geometric object screening by using an approximate object. Alternatively, the target geometric object may be entered by a user. Thus, the target geometric object transmitted by the last task may be received, or the target geometric object input by the user may be acquired.
S602, determining an approximate object corresponding to the target geometric object, wherein the approximate object comprises 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-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object.
In which a multi-way tree, also called an n-way tree, may allow more than two child nodes of a parent node. The space range of the approximate object refers to the space area occupied by the whole approximate object, and represents the whole shape and the size of the approximate object. The spatial range of the approximation object may be divided into a plurality of spatial partitions, i.e. the approximation object is composed of a plurality of spatial partitions, which correspond to rectangular tiles (tiles) of different sizes. In the process of generating the approximate object, the spatial range of the approximate object can be divided into a plurality of spatial blocks in a recursive manner, and the multi-way tree is generated by constructing nodes corresponding to the spatial blocks, so that the approximate object is represented by the multi-way tree.
In this embodiment, an approximate object corresponding to the first geometric object may be determined, and for convenience of distinction, the approximate object corresponding to the first geometric object is referred to as a first approximate object; and/or, an approximate object corresponding to the second geometric object may be determined, and for convenience of distinction, the approximate object corresponding to the second geometric object is referred to as a second approximate object. "and/or" is used herein to take into account the following: first, not every geometric object need have a corresponding approximation object, e.g., an approximation object may be generated for only large irregular geometric objects; second, not every geometric object can have a corresponding approximate object, and it is necessary to determine whether an approximate object of the geometric object can be found or generated; third, the first approximation object or the second approximation object is more accurate than the MBR, and the geometric object screening accuracy can be improved still in the case of performing geometric object screening by only relying on the first approximation object or the second approximation object.
In this embodiment, in the process of determining the approximate object corresponding to the target geometric object, the approximate object corresponding to the target geometric object may be searched or generated. Specifically, the approximate object corresponding to the target geometric object is searched in the approximate objects corresponding to the geometric objects, or the approximate object corresponding to the target geometric object is generated according to the target geometric object.
S603, screening the second geometric objects according to the first approximate objects and/or the second approximate objects to reduce geometric objects which do not meet the query range in the second geometric objects.
In this embodiment, in one manner, the MBRs of the first approximate object and the second geometric object may be compared to determine the positional relationship between the MBRs of the first approximate object and the second geometric object, and the geometric object whose positional relationship between the MBRs and the first approximate object satisfies the positional relationship condition is screened out from the second geometric object, where the probability that the geometric object satisfies the query range is higher; in yet another manner, the MBR of the first geometric object may be compared with the second approximate object to determine a positional relationship between the second approximate object and the MBR of the first geometric object, and a geometric object whose positional relationship between the second approximate object and the MBR of the first geometric object satisfies the positional relationship condition may be selected from the second geometric object, where the probability that the geometric object satisfies the query range is higher. In still another mode, the position relation between the first approximate object and the second approximate object can be determined by directly comparing the first approximate object with the second approximate object, and the geometric object, the position relation of which meets the position relation condition, is screened out from the second geometric object, wherein the probability that the geometric object meets the query range is higher. Therefore, the geometric objects which have higher probability of meeting the query range are screened from the second geometric objects, and the geometric objects which do not meet the query range in the second geometric objects are reduced.
In the embodiment of the application, an approximate object composed of a plurality of space blocks is constructed for a geometric object, the approximate object is represented by a multi-way tree, and nodes of the multi-way tree correspond to the space blocks. Compared to MBRs, the similarity of the approximated objects to the geometric objects is higher, especially for large geometric objects, the empty area between the boundaries of the approximated objects and the geometric objects is greatly reduced. And screening the second geometric object by using the first approximate object corresponding to the first geometric object and/or the second approximate object corresponding to the second geometric object to obtain the geometric object conforming to the query range, so that the screening precision of the geometric object is improved, more accurate and fewer geometric objects enter a complex geometric calculation stage (the precise geometric calculation of the second step mentioned in the previous content) in the geometric object query, the calculation resources are saved, and the efficiency of the geometric object query is improved.
Referring to fig. 7, fig. 7 is a second flowchart of a geometric object screening method according to an embodiment of the present application. As shown in fig. 7, the geometric object screening method includes:
s701, determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met or not, and the target geometric object comprises an object identifier of the target geometric object.
Wherein the object identification of the geometric object is an internal attribute in the geometric object, present in the data content of the geometric object itself, for uniquely identifying a specific version of a specific geometric object. In particular, an object identification may be added to the geometric object at the time of update or creation of the geometric object to uniquely identify the current version of the geometric object. A more common way is to add a primary key corresponding to a geometric object in a table and uniquely identify the geometric object by the primary key, where the primary key is not internalized into the geometric object, but is a separate data table column, stored separately from the geometric object, which results in that the parameters of the geometric computation function cannot be read to the value of the primary key when the geometric object only contains the geometric object, and in the case that the geometric object is the result of a certain geometric computation and not from the data table, the geometric object does not even have a corresponding primary key, and cannot uniquely identify the geometric object. In the embodiment, the object identifier of the geometric object is added in the geometric object, so that the defect of the common mode is effectively overcome, and convenience is provided for cache management of the geometric object.
Further, the object identification of the geometric object may include a universal unique identifier (Universally Unique Identifier, UUID) of the geometric object, so as to globally identify the geometric object by the UUID, thereby improving accuracy of searching the geometric object based on the UUID.
S702, searching whether the buffer space stores the approximate object corresponding to the target geometric object according to the object identification of the target geometric object.
The data structure of the approximate object is a multi-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object.
The cache space may be a shared memory space of the current system, cache data is stored in the shared memory space, the cache data includes a key value and a cache entry corresponding to the key value, the key value may include an object identifier of a geometric object, and the cache entry corresponding to the key value may include an approximate object corresponding to the geometric object.
In this embodiment, whether an approximate object corresponding to the object identifier of the target geometric object exists or not may be searched in the cache space, if so, it is described that the approximate object corresponding to the target geometric object is stored in the cache space, and if the object identifier of the target geometric object is used to uniquely identify the target geometric object of the current version, whether the approximate object corresponding to the target geometric object of the current version exists or not may be searched through the object identifier of the target geometric object, so that the searching efficiency of the approximate object is effectively improved. If it is found that the buffer space stores the approximate object corresponding to the target geometric object according to the object identification of the target geometric object, S703 is executed, otherwise S704 is executed.
S703, reading the approximate object corresponding to the target geometric object from the cache space according to the object identification of the target geometric object.
In this embodiment, when it is determined that the buffer space stores the approximate object corresponding to the target geometric object, the approximate object corresponding to the object identifier of the target geometric object is read from the buffer space. After S703 is performed, S705 may be performed to perform a filtering of geometric objects based on the found approximate objects.
S704, generating an approximate object corresponding to the target geometric object and storing the approximate object in a cache space.
In this embodiment, when the buffer space does not store the approximate object corresponding to the target geometric object, the approximate object corresponding to the target geometric object may be generated according to the spatial position information of the target geometric object, and after the approximate object corresponding to the target geometric object is generated, the approximate object corresponding to the target geometric object may be stored in the buffer space, so that the approximate object corresponding to the target geometric object may be read directly from the buffer space next time. S705 may then be performed to filter geometric objects based on the generated approximation objects.
In one possible implementation manner, a storage position of the spatial position information of the target geometric object may be acquired, and the spatial position information of the target geometric object may be read from the storage position; alternatively, the spatial location information of the target geometric object may be obtained directly from the input parameters. The spatial location information of the target geometric object may include location information of a plurality of constituent elements (such as points and edges) on the target geometric object, or the spatial location information of the target geometric object may include an MBR of the target geometric object.
S705, screening the second geometric objects according to the first approximate object and/or the second approximate object to reduce the geometric objects which do not meet the query range in the second geometric objects.
The implementation principle and technical effect of S705 may refer to the foregoing embodiments, and will not be described herein.
In the embodiment of the application, when the geometric objects are screened based on the approximate objects, the efficiency of screening the geometric objects is improved, and meanwhile, the efficiency of obtaining the approximate objects of the geometric objects is improved by storing the approximate objects corresponding to the geometric objects and the object identifiers of the geometric objects in a cache space correspondingly, so that the efficiency of screening the geometric objects based on the approximate objects is improved.
The space index of the geometric object (such as the space index of the constituent elements of the geometric object) and the approximate object of the geometric object need to occupy certain storage resources and computing resources, and the following measures are weighed: firstly, storing a spatial index or an approximate object into external memory equipment such as a magnetic disk, wherein the measure can increase I/O burden, especially the spatial index of constituent elements of a geometric object, and the storage capacity setting of the spatial index or the approximate object can be larger than that of the geometric object; and secondly, if the spatial index or the similar object is not cached in the external memory device, the spatial index or the similar object is cached in the internal memory, or the spatial index or the similar object is recalculated when inquiring each time, and the two modes need to grasp the degree of preference, otherwise, the performance is also influenced.
In the embodiment of the present application, the storage of the approximate object is mainly related, in the embodiment shown in fig. 7, the object identifier of the geometric object and the approximate object corresponding to the geometric object are mainly stored in the cache space, and if the approximate object corresponding to the geometric object is not stored in the cache space, the approximate object corresponding to the geometric object is generated. In order to further reduce storage resources occupied by the approximate objects and improve space query efficiency, a part of large geometric objects can be selected to generate the approximate objects and perform long-acting caching of the approximate objects based on characteristics of space data in the real world. Reference is made in particular to the embodiment shown in fig. 8.
Referring to fig. 8, fig. 8 is a flowchart illustrating a geometric object screening method according to an embodiment of the present application. As shown in fig. 8, the geometric object screening method provided in this embodiment includes:
s801, determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met or not, and the target geometric object comprises an object identifier of the target geometric object.
S802, searching whether the buffer space stores the approximate object corresponding to the target geometric object according to the object identification of the target geometric object.
The data structure of the approximate object is a multi-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object.
In this embodiment, if the approximate object corresponding to the target geometric object is stored in the cache space according to the object identifier of the target geometric object, S803 is executed, otherwise S804 is executed.
S803, reading the approximate object corresponding to the target geometric object from the cache space according to the object identification of the target geometric object.
In this embodiment, if a first approximate object corresponding to the first geometric object is stored in the cache space according to the object identifier of the first geometric object, the first approximate object is read from the cache space according to the object identifier of the first geometric object; and/or if the second approximate object corresponding to the second geometric object is stored in the cache space according to the object identification of the second geometric object, reading the second approximate object from the cache space according to the object identification of the second geometric object. After S803 is performed, S806 may be performed.
The implementation principles and technical effects of S801 to S803 may refer to the foregoing embodiments, and are not described herein.
S804, determining whether the target geometric object belongs to a large geometric object.
In this embodiment, in the case where the approximate object corresponding to the target geometric object is not stored in the cache space, it may be determined whether the target geometric object belongs to a large geometric object. If the target geometric object belongs to a large geometric object, S805 is performed to generate and store the approximation object for the large geometric object for a long time, otherwise S806 is performed.
In one possible implementation, S804 may include: determining an attribute value of MBR of the target geometric object in a target dimension and an attribute upper limit value of an object class of the target geometric object corresponding to the target dimension; comparing the attribute value of the MBR of the target geometric object in the target dimension with the attribute upper limit value of the object class of the target geometric object corresponding to the target dimension; if the attribute value of the MBR of the target geometric object in the target dimension is larger than the corresponding attribute upper limit value of the object class of the target geometric object in the target dimension, determining that the target geometric object belongs to the large geometric object, otherwise, determining that the target geometric object does not belong to the large geometric object. Therefore, the MBR of the target geometric object can reflect the characteristics of the spatial position and the size of the target geometric object to a certain extent, and the object class suitable for the geometric object is used for purposefully designing the corresponding attribute upper limit value for the geometric object (for example, the object class of the geometric object is different from the attribute upper limit value corresponding to the case that the object class of the geometric object is a river), so that the efficiency and the accuracy for judging whether the target geometric object is a large geometric object are improved.
Wherein the target dimension may be one or more. And under the condition that the target dimensions are multiple, respectively comparing the attribute value of the MBR of the target geometric object in each target dimension with the attribute upper limit value of the object class of the target geometric object corresponding to each target dimension, if the attribute value of the MBR of the target geometric object in at least one target dimension is larger than the attribute upper limit value of the object class of the target geometric object corresponding to the target dimension, determining that the target geometric object belongs to the large geometric object, and otherwise, determining that the target geometric object does not belong to the large geometric object.
In the implementation manner, the data storage position of the target geometric object can be obtained from the input parameters, and the attribute value of the MBR of the target geometric object in the target dimension can be obtained from the database according to the data storage position of the target geometric object; alternatively, the spatial position information of the target geometric object (which may include the position information of a plurality of constituent elements on the target geometric object) may be obtained according to the data storage position of the target geometric object, the MBR of the target geometric object may be generated based on the spatial position information of the target geometric object, and the attribute value of the MBR of the target geometric object in the target dimension may be determined. The attribute upper limit value of the object class to which the target geometric object belongs in each target dimension can be obtained through statistics in advance, and the attribute upper limit value of the object class to which the target geometric object belongs in each target dimension can be obtained from a database according to the data storage position of the target geometric object. Then, comparing the attribute value of the MBR of the target geometric object in the target dimension with the attribute upper limit value of the object class of the target geometric object corresponding to the target dimension; if the attribute value of the MBR of the target geometric object in the target dimension is larger than the corresponding attribute upper limit value of the object class of the target geometric object in the target dimension, determining that the target geometric object belongs to the large geometric object, otherwise, determining that the target geometric object does not belong to the large geometric object.
In one possible implementation, the data storage location of the target geometric object may be a geometric object column in the data table to which the target geometric object belongs, and for convenience of distinction, the geometric object column to which the target geometric object belongs is referred to as a target column. At this time, determining the attribute value of the MBR of the target geometric object in the target dimension and the attribute upper limit value of the object class to which the target geometric object belongs in the target dimension may include: determining a target column to which a target geometric object belongs in geometric object columns of a data table, and acquiring an attribute value of an MBR (membrane biological reactor) of the target geometric object in a target dimension in attribute information of the target geometric object according to an object identifier of the target geometric object; and determining the attribute upper limit value corresponding to the object class of the target geometric object in the target dimension as the attribute upper limit value corresponding to the target column in the target dimension. The same geometric object column of the data table contains attribute information of geometric objects of the same class, so that the geometric objects in the target column are consistent with the object class of the target geometric objects, and the attribute upper limit value corresponding to the target column in the target dimension is obtained by statistics according to the attribute values of MBRs of a plurality of geometric objects in the target column in the target dimension.
In this implementation, a plurality of geometric object columns may be included in the data table, and for each geometric object column, attribute information of a plurality of geometric objects belonging to the same object type is included in one geometric object column, where the attribute information of the geometric object includes an attribute value of an MBR of the geometric object in a target dimension. The attribute upper limit value of each geometric object column in the target dimension can be obtained through statistics according to the attribute of MBRs of a plurality of geometric objects in each geometric object column in the target dimension. In the process of judging whether the target geometric object is a large geometric object, comparing the attribute value of the target geometric object in the target dimension with the attribute upper limit value of the target column of the target geometric object in the target dimension, if the attribute value of the target geometric object in the target dimension is larger than the attribute upper limit value of the target column of the target geometric object in the target dimension, determining that the target geometric object is the large geometric object, otherwise, determining that the target geometric object is not the large geometric object. Therefore, the accuracy of judging whether the target geometric object is a large geometric object is improved by utilizing the geometric object column, the geometric object, the target dimension and the attribute value statistics.
In the process of counting the attribute upper limit value of the geometric object column in the target dimension according to the attribute values of the MBRs of a plurality of geometric objects in the geometric object column in the target dimension, one possible implementation may include: counting quantiles (quantiles) of the plurality of geometric objects in the geometric object column in the target dimension according to attribute values of MBRs of the plurality of geometric objects in the geometric object column in the target dimension respectively; and counting the attribute upper limit value of the geometric object column in the target dimension according to the fractional numbers of the geometric objects in the geometric object column in the target dimension. Therefore, the accuracy of the attribute upper limit value of the geometric object column in the target dimension is improved by using quantile statistics. The attribute upper limit value of the geometric object column in the target dimension can be obtained by carrying out addition, subtraction, multiplication and division operation on the quantiles of the geometric objects in the geometric object column in the target dimension. Wherein the geometric object column comprises a target column.
Further, based on the attribute values of the MBRs of the plurality of geometric objects in the geometric object column in the target dimension, a quarter of the MBRs of the plurality of geometric objects in the geometric object column in the target dimension (e.g., denoted as Q1) and a three-quarter of the MBRs of the plurality of geometric objects in the geometric object column in the target dimension (e.g., denoted as Q3) may be counted; then, according to the quartile and the tertile of the MBRs of the geometric objects in the geometric object column in the target dimension, calculating to obtain the quartile interval of the geometric object column in the target dimension; and determining the attribute upper limit value of the geometric object column in the target dimension according to the quartile range of the geometric object column in the target dimension. Thus, the accuracy of the attribute upper limit value is improved by the quarter-bit number, the three-quarter-bit number, and the quarter-bit pitch.
As an example, the calculation formula of the attribute upper limit value of the geometric object column in the target dimension may be:
IQR=Q3-Q1,Q4=Q1+1.5×IQR
where IQR represents the quartile range of the geometric object column in the target dimension, and Q4 represents the upper limit of the attribute of the geometric object column in the target dimension.
In the process of counting the quarter-bit number and the three-quarter-bit number, single point objects and empty objects (the attribute value of the empty objects in each dimension is 0) in the geometric object column are ignored, so that the single point objects and the empty objects are prevented from interfering with the attribute upper limit value, and the accuracy of the attribute upper limit value is improved.
After the attribute upper limit value of the geometric object column in the target dimension is obtained through statistics, the attribute upper limit value of the geometric object column in the target dimension can be saved, for example, the attribute upper limit value of the geometric object column in the target dimension can be saved into a statistics data table, so that the attribute upper limit value of the geometric object column in the target dimension can be checked at any time when judging whether the geometric object is a large geometric object or not.
Further, the target dimension may include at least one of: x-dimension (also called longitude), Y-dimension (also called latitude), Z-dimension (also called elevation), M-dimension (also called measured value latitude, the specific meaning being determined by the application scenario in which the geometric object is located). Thus, the structure of the statistics table for holding the upper limit value of the attribute of the geometric object column in the target dimension may be as follows:
Figure BDA0004032832990000121
/>
Figure BDA0004032832990000131
Further, if the MBR exists as the spatial index, for example, a corresponding R-Tree exists to store the MBR of the geometric object, the attribute upper limit value of the geometric object column of the geometric object in the target dimension can be counted directly according to the MBR of the geometric object; if the MBR does not exist as the spatial index, generating the MBR of the geometric object according to the geometric object, and counting the attribute upper limit value of the geometric object column of the geometric object in the target dimension according to the MBR of the geometric object.
S805, generating an approximate object corresponding to the target geometric object and storing the approximate object in the cache space.
In this embodiment, if the approximate object corresponding to the target geometric object is not stored in the cache space and the target geometric object belongs to the large geometric object, the approximate object corresponding to the target geometric object can be generated, and the approximate object corresponding to the target geometric object is stored in the cache space, so that the long-term storage of the approximate object of the large geometric object is realized, the need of regenerating the approximate object of the large geometric object each time is avoided, the geometric object screening efficiency is improved, compared with the storage of the approximate object of each geometric object, the storage of the approximate object of the large geometric object can reduce the cache space occupied by the approximate object, and more blank areas exist between the large geometric object and the MBR of the large geometric object, so that the corresponding approximate object is generated for the large geometric object, and the geometric object screening accuracy is improved.
In one possible implementation, S805 may include: if the target geometric object belongs to a large geometric object, determining the space range of an approximate object corresponding to the target geometric object according to the MBR of the target geometric object; recursively subdividing the space range of the approximate object through a multi-way tree algorithm to generate a multi-way tree corresponding to the approximate object, wherein the multi-way tree is used for representing the approximate object; the multi-way tree is stored into the cache space. Therefore, the accuracy of the generation of the approximate object is improved in a multi-way tree and recursion subdivision mode.
In this implementation, the process of obtaining the MBR of the target geometric object may refer to the foregoing related description, which is not repeated here. After determining the MBR of the target geometric object, determining the space range of the approximate object corresponding to the target geometric object by taking the MBR as a reference object; the space range of the approximate object is recursively subdivided through the multi-way tree, a plurality of space blocks can be obtained through segmentation, corresponding nodes are built for the plurality of space blocks, and the multi-way tree is formed by the plurality of nodes. In this way, a multi-way tree corresponding to the approximate object of the target geometric object is generated, and the approximate object is represented by the multi-way tree. Finally, the multi-way tree is stored in the cache space, i.e. the approximated object is stored in the cache space.
When the target geometric object is two-dimensional data, the multi-tree algorithm can adopt a quadtree algorithm; when the target geometric object is three-dimensional data, the multi-tree algorithm can adopt an octree algorithm.
Further, according to the MBR of the target geometric object, determining the spatial range of the approximate object corresponding to the target geometric object may include: determining the geometric center of the MBR of the target geometric object; determining the geometric center of the spatial range of the approximate object corresponding to the target geometric object as the geometric center of the MBR of the target geometric object; comparing the length of the MBR of the target geometric object with the width of the MBR of the target geometric object, and determining the side length of the spatial range of the approximate object corresponding to the target geometric object as the maximum value of the length of the MBR of the target geometric object and the width of the MBR of the target geometric object. Therefore, based on the MBR of the target geometric object, the approximate object corresponding to the target geometric object covers the target geometric object as accurately as possible.
Assume that the lower left corner coordinate of MBR of the target geometric object is (X 1 ,Y 1 ) And the upper right corner coordinates of MBR of the target geometric object are (X 2 ,Y 2 ) The geometric center of the MBR may be ((X) 2 -X 1 )/2,(Y 2 -Y 1 ) 2) determining the geometric center of the approximate object of the target geometric object as ((X) 2 -X 1 )/2,(Y 2 -Y 1 ) 2); MBR for comparing target geometric objectsLong (w=x) 2 -X 1 ) Sum width (h=y) 2 -Y 1 ) Taking the maximum value as the side length of the approximate object of the target geometric object.
Further, in the process of recursively subdividing the spatial range of the approximate object through the multi-tree algorithm to generate the multi-tree corresponding to the approximate object, multiple subdivision is needed, where the nth subdivision of the spatial range of the approximate object may include: traversing nodes in the multi-way tree, and determining the current node; dividing a space block corresponding to a current node into a plurality of subspace blocks; determining the position relation between a plurality of subspace partitions and a target geometric object; and determining the type of the block corresponding to the current node and/or creating the corresponding node for the subspace block meeting the subdivision condition in the subspace blocks according to the position relation. Therefore, the space corresponding to the current node is further subdivided into subspace blocks, recursive subdivision of the space range of the approximate object is achieved, and the accuracy of the block types corresponding to the current node and the nodes of the multi-way tree is improved by determining the block types corresponding to the current node and/or creating the corresponding nodes for the subspace blocks based on the position relation between the subspace blocks and the target geometric object. The process of recursively subdividing the spatial range of the approximate object is equivalent to the process of converting the low-resolution image into the high-resolution image, the subspace partition is equivalent to a pixel region, and the approximate object corresponding to the target geometric object can more accurately embody the shape, the size and other information of the target geometric object through continuous subdivision.
Specifically, the nodes in the multi-way tree can be traversed according to a node searching mode (in particular, a breadth-first searching mode), the current node is the currently traversed node, and the space block corresponding to the current node is the undetermined block. The space block corresponding to the current node can be divided into a plurality of subspace blocks on average; the position relation between each subspace partition and the target geometric object can be determined by adopting a geometric object position relation judging model, wherein the geometric object position relation judging model can be a 9-intersection model (Dimensionally Extended-Intersection Model, DE-9 IM) with expanded dimensions, and other models can be adopted, and are not listed here. For each subspace partition, if the position relation between the subspace partition and the target geometric object meets the subdivision condition, the corresponding node can be created for the subspace partition, so that the subspace partition can be subdivided by traversing to the corresponding node of the subspace partition; if the position relations between all subspace partitions of the current node and the target geometric objects meet the target relation, determining the partition type corresponding to the current node as the target type.
Further, the positional relationship between the subspace partition and the target geometric object may include at least one of a containment relationship, an overlapping relationship, a contact relationship, and a separation relationship (of course, the positional relationship between the space partition and the target geometric object may also include at least one of a containment relationship, an overlapping relationship, a contact relationship, and a separation relationship), based on which, according to the positional relationship between the plurality of subspace partitions and the target geometric object, determining a partition type corresponding to the current node and/or creating a corresponding node for a subspace partition satisfying a subdivision condition in the plurality of subspace partitions may include: if the subspace partitions are all located in the interior (Within) of the target geometric object (namely, the position relationship between the subspace relationships and the target geometric object is the contained relationship), determining the partition type corresponding to the current node as an inner partition; if the position relations of the subspace partitions and the target geometric objects all belong to an overlapping (overlay) relation or a contact (Touch) relation, determining the partition type corresponding to the current node as a boundary partition; if the position relations between the subspace blocks and the target geometric object are different, and subspace blocks with overlapping relation or contact relation with the position relation of the target geometric object exist in the subspace blocks, corresponding nodes are created for the rest subspace blocks except the subspace blocks with the position relation of the target geometric object being the separation relation. Therefore, different subdivision processing modes are adopted according to different situations, so that the shape and the size of the approximate object are continuously approximate to those of the geometric object.
Specifically, according to the positional relationship between the spatial partition and the target geometric object, it is known that, for the target geometric object, the spatial partition may be an internal partition (located inside the target geometric object, the positional relationship with the target geometric object is an inclusion relationship), a boundary partition (located at the boundary of the target geometric object, the positional relationship with the target geometric object is an overlapping relationship or a contact relationship), or a separate partition (located in a separate relationship with the target geometric object, that is, not overlapping or contacting the target geometric object, or located inside the target geometric object). Among the three partitions: the inner partition and the phase partition do not contain the shape details of the target geometric object (the subspace partition subdivided by the inner partition is still the inner partition, and the subspace partition subdivided by the phase partition is still the phase partition), so that subdivision is not needed; the boundary blocks include shape details of the target object, for example, taking a quadtree as an example, one boundary block may be subdivided into 3 boundary sub-blocks (i.e., sub-space blocks in an overlapping relationship or a contact relationship with the position relationship of the target geometric object) and 1 internal sub-block (i.e., sub-space blocks located inside the target geometric object), 1 phase sub-block (i.e., sub-space blocks in a separating relationship with the position relationship of the target geometric object), 3 boundary sub-blocks, and other different situations, by subdividing the boundary blocks, some space regions can be further eliminated, and the similarity between the boundary shape of the approximate object and the boundary shape of the target geometric object can be improved, so that for the boundary blocks capable of subdividing different types of sub-blocks (i.e., creating corresponding nodes for the sub-space blocks subdivided by the boundary sub-blocks), for the subdivided sub-space blocks, no further subdivision (i.e., no nodes for the sub-space blocks corresponding to the sub-space blocks subdivided by the boundary sub-blocks need to be created from the sub-space blocks that are not needed.
Therefore, if the subspace partitions obtained by dividing the current node are all located in the target geometric object, that is, the position relations between the subspace partitions and the target geometric object are all contained relations, the current node does not contain the shape details of the target geometric object, a lower node is not required to be established, that is, corresponding nodes are not required to be established for the subspace partitions, and the partition type corresponding to the current node is determined to be an internal partition; if the position relations between the subspace partitions obtained by the current node division and the target geometric objects all belong to an overlapping relation or a contact relation, namely the subspace partitions obtained by the current node division are boundary subspaces, the division cannot exclude any other type subspace partition, namely the subspace partitions of different types cannot be distinguished from the current node, the division has smaller effect, so that a lower node is not required to be established, namely corresponding nodes are not required to be established for the subspace partitions respectively, and the partition type corresponding to the current node is determined to be the boundary partition; if the multiple subspace partitions obtained by dividing the current node are different in the position relation between the multiple subspace partitions and the target geometric object, and the subspace partitions (namely, the boundary sub-blocks) with the position relation between the multiple subspace partitions and the target geometric object being in the overlapping relation and the contact relation exist in the multiple subspace partitions, the division of the current node is described as being capable of subdividing the boundary sub-blocks and other types of sub-blocks (such as internal sub-blocks and phase sub-blocks) so as to obtain more detailed boundary information, and therefore, corresponding nodes can be created for the rest subspace partitions except the subspace partitions with the position relation between the subspace partitions and the target geometric object being in the separation relation (excluding the phase sub-blocks). Therefore, the approach degree of the approximate object and the target geometric object is improved through layer-by-layer subdivision of the space blocks corresponding to the nodes of the multi-way tree; meanwhile, meaningless node subdivision is avoided through the judgment, and excessive nodes of the multi-way tree are avoided, so that complexity of the multi-way tree and excessive occupied storage capacity are avoided.
Further, dividing the spatial partition corresponding to the current node into a plurality of subspace partitions may include: the spatial division is divided into a plurality of subspace divisions on average according to the spatial quadrant, wherein different subspace divisions are located in different spatial quadrants. Under the condition that the target geometric object is two-dimensional data, 4 space quadrants are provided, and the space blocks corresponding to the current node can be divided into 4 subspace blocks according to the 4 space quadrants, so that the accuracy of space block division is improved by using the space quadrants.
Further, after determining the block type corresponding to the current node and/or creating corresponding nodes for subspace blocks meeting subdivision conditions in a plurality of subspace blocks according to the position relation, determining the node number of the multi-way tree, and if the node number of the multi-way tree is greater than a soft boundary value, determining the position relation between a leaf node positioned at the bottommost layer of the multi-way tree and a target geometric object; and determining the block type corresponding to the leaf node according to the position relation between the leaf node and the target geometric object. Therefore, the node number of the multi-way tree is constrained based on the soft boundary value, and excessive node number and excessive data volume of the multi-way tree are avoided.
Specifically, the soft boundary value is used herein because the number of nodes of the multi-way tree is not strictly limited to be less than or equal to the soft boundary value, and after determining the block type corresponding to the current node and/or creating the corresponding node for the subspace partition satisfying the subdivision condition among the plurality of subspace partitions, the number of nodes of the multi-way tree may already be greater than the soft boundary value. After the subdivision process of the current node is completed, if the node number of the multi-way tree is larger than the soft boundary value, the method indicates that space blocks corresponding to the nodes in the multi-way tree do not need to be further subdivided, and the leaf node corresponding block type of the multi-way tree needs to be determined. Thus, determining the positional relationship between leaf nodes located in the multi-way tree and the target geometric object; and determining the block type corresponding to the leaf node according to the position relation between the leaf node and the target geometric object. If the position relations between the space blocks corresponding to the leaf nodes and the target geometric objects all meet the target relation, the block types corresponding to the leaf nodes can be determined to be target types.
Further, if the space block corresponding to the leaf node is located in the target geometric object, determining the block type corresponding to the leaf node as an inner block; and/or if the position relations of the space blocks corresponding to the leaf nodes and the target geometric objects all belong to an overlapping relation or a contact relation, determining the block types corresponding to the leaf nodes as boundary blocks.
By way of example, the process of building a multi-drop tree may include 1.1-1.3 as follows:
1.1, subspace segmentation;
1.1.1, marking the current node as a 'pending block';
1.1.2, dividing the space range of the current node (namely the space block corresponding to the current node) according to 4 quadrants averagely to obtain 4 subspace blocks, and judging the space relation (namely the position relation) between each subspace block and the target geometric object based on the DE-9IM model;
1.1.3 if all 4 subspace partitions are inside the target geometry object, then no subordinate node is created and the current node is marked as an "inner partition";
1.1.4, if the spatial relationship between the 4 subspace partitions and the target geometric object all belong to an overlapping relationship or a contact relationship, not creating a lower node, and marking the current node as a boundary partition;
1.1.5, if the spatial relationship between the 4 subspace partitions and the target geometric object is different and subspace partitions which belong to overlapping relationship or contact relationship with the spatial relationship of the target geometric object exist in the 4 subspace partitions, ignoring the subspace partitions which have the spatial relationship of the target geometric object as a separation relationship in the 4 subspace partitions, and creating corresponding nodes for the rest subspace partitions;
1.2, traversing all child nodes of the same layer in a breadth-first mode, and processing each child node according to the method in the step 1.1 to generate a node of the next layer;
1.3, presetting a soft boundary value of the block number, stopping subdivision when the total number of nodes of the multi-way tree exceeds the value for the first time, and judging the spatial relationship between each spatial block of the lowest layer (namely, the spatial block corresponding to the leaf node of the lowest layer) and the target geometric object based on the DE-9IM model;
1.3.1, if the space block is inside the target geometric object, marking the leaf node corresponding to the space block as an 'inner block';
1.3.2, if the spatial relationship between the spatial partition and the target geometric object is an overlapping relationship or a contact relationship, marking the leaf node corresponding to the spatial partition as a boundary partition.
S806, determining to obtain a first approximate object and/or a second approximate object.
In the case where it is determined that the first approximation object and/or the second approximation object are obtained, S807 is performed.
S807, screening the second geometric objects according to the first approximate object and/or the second approximate object to reduce geometric objects which do not meet the query scope in the second geometric objects.
The implementation principle and technical effect of S807 may refer to the foregoing embodiments, and will not be described herein.
In one possible implementation, S807 may include: according to the first approximate object and/or the second approximate object, carrying out position relation condition screening on the first geometric object and the second geometric object, and determining the position relation between the first geometric object and the second geometric object; screening the second geometric objects according to the position relation between the first geometric objects and the second geometric objects so as to reduce the geometric objects which do not meet the query range in the second geometric objects; wherein, the position relation condition screening can comprise at least one of the following: inclusion condition screening, separation condition screening, overlap or contact condition screening, and distance range condition screening. Therefore, based on the first approximate object and/or the second approximate object, the geometric objects which have the position relation with the first geometric objects and meet at least one position relation condition screening selected from the group consisting of the inclusion condition screening, the separated condition screening, the overlapping or contact condition screening and the distance range condition screening can be screened from the second geometric objects, so that the efficiency, the accuracy and the comprehensiveness of the geometric object screening are improved.
In this implementation, the MBR of the first geometric object may be compared with the MBR of the second geometric object, or the MBR of the first geometric object may be compared with the second geometric object, or the first geometric object may be compared with the second geometric object, to determine the positional relationship between the first geometric object and the second geometric object. Under the condition that the position relation condition screening is inclusion condition screening, the geometric objects meeting the inclusion condition with the position relation of the first geometric objects can be screened out from the second geometric objects according to the position relation of the first geometric objects and the second geometric objects; positional relationship condition screening is inclusion condition screening, separation condition screening, overlap or contact condition screening, distance range condition screening, and is similar to the case where positional relationship condition screening includes inclusion condition screening, and is not described here. The distance range condition screening refers to that the distance between the first geometric object and the second geometric object is within a certain distance range.
Further, in the case that the positional relationship condition filtering includes inclusion condition filtering, performing positional relationship condition filtering on the first geometric object and the second geometric object according to the first approximate object and/or the second approximate object, and determining a positional relationship between the first geometric object and the second geometric object, including: if the MBR of the second geometric object is positioned in the inner part of the inner partition block of the first approximate object, determining the position relationship between the first geometric object and the second geometric object as an inclusion relationship; if the MBR of the second geometric object does not overlap with the inner partition of the first approximation object and the MBR of the second geometric object does not overlap with the boundary partition of the first approximation object, then the first geometric object and the second geometric object are determined to be in a disjoint relationship or not include a relationship. In this embodiment, it is assumed that the first approximation object is obtained and the second approximation object is obtained or not, so that the MBR of the first approximation object and the MBR of the second geometric object are compared; the second approximation object is obtained, and the first approximation object is obtained or not obtained, and the MBR of the second approximation object and the MBR of the first geometric object may be compared in this manner, which is not described in detail herein.
Further, in the case that the positional relationship condition filtering includes the inclusion condition filtering, performing positional relationship condition filtering on the first geometric object and the second geometric object according to the first approximate object and/or the second approximate object, and determining a positional relationship between the first geometric object and the second geometric object, including: if the MBR of the first geometric object is positioned in the inner part of the inner partition block of the second approximate object, determining that the first geometric object and the second geometric object are in a contained relation; if the MBR of the first geometric object does not overlap with the inner partition of the second approximate object and the MBR of the first geometric object does not overlap with the boundary partition 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 contained relationship. In this embodiment, it is assumed that the second approximation object is obtained and the first approximation object is obtained or not, so that the second approximation object is compared with the MBR of the first geometric object; the first approximation object is obtained, and the second approximation object is obtained or not obtained, and the MBR of the first approximation object and the MBR of the second geometric object may be compared in this manner, which is not described in detail herein.
Further, in the case that the positional relationship condition filtering includes a separation condition filtering, according to the first approximate object and/or the second approximate object, the positional relationship condition filtering is performed on the first geometric object and the second geometric object, so as to determine the positional relationship between the first geometric object and the second geometric object, which may be at least one of the following manners: if the MBR of the first geometric object is not overlapped with the inner partition of the second approximate object and the MBR of the first geometric object is not overlapped with the boundary partition of the second approximate object, determining that the first geometric object and the second geometric object are in a separation relation; if the MBR of the second geometric object is not overlapped with the inner partition of the first approximate object and the MBR of the second geometric object is not overlapped with the boundary partition of the first approximate object, determining that the first geometric object and the second geometric object are in a separation relation; and if the inner partition of the first approximate object is not overlapped with the inner partition of the second approximate object and the boundary partition of the second approximate object, and the boundary partition of the first approximate object is not overlapped with the inner partition of the second approximate object and the boundary partition of the second approximate object, determining that the first geometric object and the second geometric object are in a separation relation. The method can be applied to a case where the first approximation object and/or the second approximation object are obtained.
Further, in the case that the positional relationship condition filtering includes overlapping or contact condition filtering, according to the first approximate object and/or the second approximate object, performing positional relationship condition filtering on the first geometric object and the second geometric object, to determine a positional relationship between the first geometric object and the second geometric object, including: if the positional relationship between the first geometric object and the second geometric object is not the inclusion relationship, the inclusion relationship or the separation relationship, determining that the positional relationship between the first geometric object and the second geometric object is the overlapping or contact relationship, and screening the geometric object which is the overlapping or contact relationship with the positional relationship of the first geometric object from the second geometric object. The judging method of the contained relation can include: if the MBR of the first geometric object is positioned in the inner part of the inner partition block of the second approximate object, determining that the first geometric object and the second geometric object are in a contained relation; the judging method of the inclusion relation can comprise the following steps: if the MBR of the second geometric object is positioned in the inner part of the inner partition block of the first approximate object, determining that the first geometric object and the second geometric object are in an inclusion relationship; the judging manner of the separation relation may include at least one of the following: if MBR of the second geometric object is not overlapped with the inner partition block of the first approximate object and the boundary partition block of the first approximate object, determining that the first geometric object and the second geometric object are in a separation relation; if the MBR of the first geometric object is not overlapped with the inner partition block of the second approximate object and the boundary partition block of the second approximate object, determining that the first geometric object and the second geometric object are in a separation relation; and if the inner partition of the first approximate object is not overlapped with the inner partition of the second approximate object and the boundary partition of the second approximate object, or if the inner partition of the second approximate object is not overlapped with the inner partition of the first approximate object and the boundary partition of the first approximate object, determining that the first geometric object and the second geometric object are in a separation relation.
Further, in the case that the position relation condition screening includes distance range condition screening, the MBR of the first geometric object may be enlarged by a preset distance, if the second approximate object overlaps the enlarged MBR of the first geometric object, it is determined that the first geometric object and the second geometric object satisfy the distance range condition, otherwise, it is determined that the first geometric object and the second geometric object do not satisfy the distance range condition; or, the MBR of the second geometric object may be enlarged by a preset distance, if the first approximate object overlaps with the enlarged MBR of the second geometric object, it is determined that the first geometric object and the second geometric object satisfy the distance range condition, otherwise, it is determined that the first geometric object and the second geometric object do not satisfy the distance range condition. Therefore, the approximate object is utilized, the preset distance is enlarged for the MBR, and the accuracy of the distance range condition screening is improved.
As an example, first one of the two geometric objects having an approximate object is selected from A, B (if both are present, the MBR area of both is calculated, the selected area is larger), the selected geometric object is referred to as a ', and the other geometric object is referred to as B'. Before screening, the MBR of the enlarged B 'is MBR' with the length W according to the given distance d B ' He Wide H B ' can be expressed as:
W B '=W B +2×d,H B '=H B +2×d;
wherein W is B To enlarge the MBR length before B To expand the width of the pre-MBR.
If the approximate object of A ' overlaps with the boundary frame MBR ' of B ', the approximate object is given to a geometric calculation function for further calculation and judgment, namely the approximate object A and B meet the distance range condition, and the approximate object A and B can enter the next more accurate calculation. Otherwise, judging that the A and the B are not in the distance range;
in the embodiment of the application, after determining the object parameters of the target geometric object, if the buffer space stores the approximate object corresponding to the target geometric object, the approximate object may be read from the buffer space; if the approximate object corresponding to the target geometric object is not stored in the cache space, the approximate object can be generated for the target geometric object and stored in the cache space under the condition that the target geometric object is determined to belong to the large geometric object, so that the approximate object of the large geometric object can be conveniently obtained at any time, and the efficiency and the accuracy of screening the large geometric object are improved. Under the condition that the first approximate object and/or the second approximate object are obtained, screening of the second geometric object is achieved by comparing MBRs of the first approximate object and the second geometric object or comparing MBRs of the second approximate object and the first geometric object or comparing the first approximate object and the second approximate object, and efficiency and accuracy of screening geometric objects meeting the position relation condition with the first geometric object are improved by utilizing the approximate objects.
In some embodiments, before determining the object parameters of the target geometric object, the second geometric object may be selected from the plurality of geometric objects according to the MBR of the first geometric object and the MBR respectively corresponding to the plurality of geometric objects. Therefore, before screening the second geometric objects based on the approximate objects, firstly screening the second geometric objects from the plurality of geometric objects based on the MBRs of the geometric objects, wherein the geometric objects are equivalent to being screened twice, the first screening is to screen the second geometric objects from the plurality of geometric objects according to the MBRs of the geometric objects, and considering that the accuracy of the screening mode is not high, especially for some large geometric objects, the geometric objects meeting the position relation condition with the first geometric objects are screened from the second geometric objects by using the approximate objects of the geometric objects in the second screening, the accuracy of the screening of the geometric objects is improved by using the twice screening, the number of the geometric objects entering the next accurate calculation is reduced, and the query efficiency of the geometric objects is improved.
In some embodiments, the rewrite of the query plan may be implemented using a database mechanism, with the addition of a secondary screening element (i.e., an element that performs geometric object screening based on an approximation of the geometric object) to the query plan. There are various implementations in the database that can be used to implement adding a secondary screening link to the query plan.
Taking the PostgreSQL database as an example: a plan SUPPORT function supportfn (internal) return interface is defined in PostgreSQL that provides a mechanism for modifying a query plan in the form of a callback by implementing the function and specifying the function in the SUPPORT option when creating a geometric computation function (a function for the exact computation of geometric objects). Nodes can be added or replaced in the query plan tree, and secondary filtering of geometric objects can be added into the query process, wherein the nodes in the query plan tree correspond to corresponding operations. According to the difference of the geometric calculation functions, different secondary screening realization nodes can be selected to be added into the query plan, such as index comparison expression nodes added in a query plan tree, and in subtrees of the nodes, functions, operators and parameter nodes in the index comparison expression can be obtained. The geometric computation function or operator used in the index comparison expression will have 2 geometric object parameters. When a parameter comes from a list, the node through the parameter can obtain the corresponding list information. All the information is transmitted to a geometric object secondary screening module (used for realizing secondary screening of geometric objects, namely, screening geometric objects meeting the position relation condition with the first geometric object from the second geometric objects according to the first geometric objects and the second geometric objects).
The following are embodiments of the apparatus of the present application, which may be used to execute the corresponding method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the corresponding method embodiments of the present application.
Fig. 9 is a schematic structural diagram of a geometric object screening device according to an embodiment of the present application. As shown in fig. 9, the geometric object screening device 900 provided in this embodiment includes:
a parameter determining module 901, configured to determine a target geometric object, where the target geometric object includes a first geometric object that represents a query range and a second geometric object that is to be detected whether the query range is satisfied;
the approximate object determining module 902 is configured to determine an approximate object corresponding to the target geometric object, where 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, and a data structure of the approximate object is a multi-way tree, and nodes on the multi-way tree correspond to spatial blocks in a spatial range of the approximate object;
the filtering module 903 is configured to filter the second geometric object according to the first approximate object and/or the second approximate object, so as to reduce that the geometric object satisfying the query scope cannot be found in the second geometric object.
In one possible implementation, the object identifier of the target geometric object is included in the target geometric object, and the approximate object determining module 902 is specifically configured to: if the approximate object is found in the cache space according to the object identification, the approximate object is read from the cache space according to the object identification.
In one possible implementation, the approximated object determination module 902 is further configured to: if the approximate object is not found in the cache space according to the object identification, determining whether the target geometric object belongs to a large geometric object; if the target geometric object belongs to a large geometric object, an approximation object is generated and stored to the cache space.
In one possible implementation, in determining whether the target geometric object belongs to a large geometric object if the approximate object is not found in the cache space according to the object identification, the approximate object determination module 902 is specifically configured to: determining an attribute value of a minimum boundary matrix MBR of the target geometric object in a target dimension and an attribute upper limit value corresponding to an object class of the target geometric object in the target dimension; comparing the attribute value with an attribute upper limit value; and if the attribute value is larger than the attribute upper limit value, determining that the target geometric object belongs to the large geometric object, otherwise, determining that the target geometric object does not belong to the large geometric object.
In one possible implementation manner, in determining the attribute value of the MBR of the target geometric object in the target dimension and the attribute upper limit value of the object class to which the target geometric object belongs in the target dimension, the approximate object determining module 902 is specifically configured to: determining a target column to which a target geometric object belongs in a geometric object column of a data table, wherein the same geometric object column of the data table contains attribute information of geometric objects of the same category; according to the object identification, acquiring an attribute value of the MBR of the target geometric object in the target dimension from the attribute information of the target geometric object; and determining the attribute upper limit value of the object class of the target geometric object in the target dimension as the attribute upper limit value of the target column in the target dimension, wherein the attribute upper limit value of the target column in the target dimension is obtained by statistics according to the attribute values of the MBRs of a plurality of geometric objects in the target column in the target dimension.
In one possible implementation, the statistical process of the attribute upper limit value corresponding to the target column in the target dimension includes: according to the attribute values of MBRs of a plurality of geometric objects in a target column in a target dimension, counting the quantiles of the geometric objects in the target dimension; and counting the attribute upper limit value corresponding to the object column in the object dimension according to the quantile.
In one possible implementation, in generating the approximated object and storing the approximated object in the cache space if the target geometric object belongs to a large geometric object, the approximated object determination module 902 is specifically configured to: if the target geometric object belongs to a large geometric object, determining the space range of the approximate object according to the MBR of the target geometric object; recursively subdividing the space range of the approximate object through a multi-way tree algorithm to generate a multi-way tree corresponding to the approximate object, wherein the multi-way tree is used for representing the approximate object; the multi-way tree is stored into the cache space.
In one possible implementation, during the nth subdivision of the spatial extent of the approximated object, the approximated object determination module 902 is specifically configured to: traversing nodes in the multi-way tree, and determining the current node; dividing a space block corresponding to a current node into a plurality of subspace blocks; determining the position relation between a plurality of subspace partitions and a target geometric object; and determining the type of the block corresponding to the current node and/or creating the corresponding node for the subspace block meeting the subdivision condition in the subspace blocks according to the position relation.
In one possible implementation manner, in determining, according to the location relationship, a block type corresponding to the current node and/or creating a corresponding node for a subspace block that satisfies a subdivision condition in the multiple subspace blocks, the approximate object determining module 902 is specifically configured to: if the subspace partitions are all located in the target geometric object, determining the partition type corresponding to the current node as an inner partition; and if the position relations of the subspace partitions and the target geometric object all belong to the overlapping relation or the contact relation, determining the partition type corresponding to the current node as the boundary partition.
In one possible implementation, the approximated object determination module 902 is further configured to: if the position relations between the subspace blocks and the target geometric objects are different, and subspace blocks with overlapping relation or contact relation with the position relations of the target geometric objects exist in the subspace blocks, corresponding nodes are created for the rest subspace blocks except the subspace blocks with the position relations of the target geometric objects being separated relation in the subspace blocks.
In one possible implementation, in the process of dividing the spatial partition corresponding to the current node into a plurality of subspace partitions, the approximate object determining module 902 is specifically configured to: the spatial division is divided into a plurality of subspace divisions on average according to the spatial quadrant, wherein different subspace divisions are located in different spatial quadrants.
In one possible implementation, the approximated object determination module 902 is further configured to: determining the node number of the multi-way tree after determining the block type corresponding to the current node and/or creating the corresponding node for the subspace block meeting the subdivision condition in the subspace blocks according to the position relation; if the number of the nodes is larger than the soft boundary value, determining the position relation between the leaf node positioned at the bottommost layer of the multi-way tree and the target geometric object; and determining the block type corresponding to the leaf node according to the position relation between the leaf node and the target geometric object.
In one possible implementation, the screening module 903 is specifically configured to: according to the first approximate object and/or the second approximate object, carrying out position relation condition screening on the first geometric object and the second geometric object, and determining the position relation between the first geometric object and the second geometric object; screening the second geometric objects according to the position relation between the first geometric objects and the second geometric objects so as to reduce the geometric objects which do not meet the query range in the second geometric objects; wherein, the position relation condition screening can comprise at least one of the following: inclusion condition screening, separation condition screening, overlap or contact condition screening, and distance range condition screening.
In a possible implementation manner, in a case that the positional relationship condition filtering includes including condition filtering, in a process of performing positional relationship condition filtering on the first geometric object and the second geometric object according to the first approximate object and/or the second approximate object, determining a positional relationship between the first geometric object and the second geometric object, a filtering module is specifically configured to: if the MBR of the second geometric object is positioned in the inner part of the inner partition block of the first approximate object, determining the position relationship between the first geometric object and the second geometric object as an inclusion relationship; if the MBR of the second geometric object does not overlap with the inner partition of the first approximation object and the MBR of the second geometric object does not overlap with the boundary partition of the first approximation object, then the first geometric object and the second geometric object are determined to be in a disjoint relationship or not include a relationship.
In a possible implementation manner, in the case that the positional relationship condition filtering includes the inclusion condition filtering, in the process of performing the positional relationship condition filtering on the first geometric object and the second geometric object according to the first approximate object and/or the second approximate object, the filtering module 903 is specifically configured to: if the MBR of the first geometric object is positioned in the inner part of the inner partition block of the second approximate object, determining that the first geometric object and the second geometric object are in a contained relation; if the MBR of the first geometric object does not overlap with the inner partition of the second approximate object and the MBR of the first geometric object does not overlap with the boundary partition 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 contained relationship.
In a possible implementation manner, in the case that the positional relationship condition filtering includes a separate condition filtering, in the process of performing the positional relationship condition filtering on the first geometric object and the second geometric object according to the first approximate object and/or the second approximate object, the filtering module 903 is specifically configured to perform at least one of the following: if the MBR of the first geometric object is not overlapped with the inner partition of the second approximate object and the MBR of the first geometric object is not overlapped with the boundary partition of the second approximate object, determining that the first geometric object and the second geometric object are in a separation relation; if the MBR of the second geometric object is not overlapped with the inner partition of the first approximate object and the MBR of the second geometric object is not overlapped with the boundary partition of the first approximate object, determining that the first geometric object and the second geometric object are in a separation relation; and if the inner partition of the first approximate object is not overlapped with the inner partition of the second approximate object and the boundary partition of the second approximate object, and the boundary partition of the first approximate object is not overlapped with the inner partition of the second approximate object and the boundary partition of the second approximate object, determining that the first geometric object and the second geometric object are in a separation relation.
In one possible implementation manner, the geometric object screening device further includes: and the primary screening module (not shown in the figure) is used for screening the second geometric objects from the plurality of geometric objects according to the MBRs of the first geometric objects and the MBRs respectively corresponding to the plurality of geometric objects.
It should be noted that, the geometric object screening device provided in the foregoing embodiments may be used to execute each step in the geometric object screening method provided in any one of the foregoing embodiments, and the specific implementation manner and technical effect are similar, and are not repeated herein.
The above embodiments of the apparatus provided in the present application are merely illustrative, where the module division is merely a logic function division, and other division manners may be implemented in practice. For example, multiple modules may be combined or may be integrated into another system. The coupling of the modules to each other may be through interfaces that are typically electrical communication interfaces, but are not exclusive of being mechanical or other forms of interfaces. Thus, the modules illustrated as separate components may or may not be physically separate, may be located in one place, or may be distributed in different locations on the same or different devices.
Fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 10, the electronic device 1000 may include: at least one processor 1001 and memory 1002. Fig. 10 shows an electronic device using one processor as an example.
A memory 1002 for storing programs of the processor 1001. In particular, the program may include program code including computer-operating instructions.
The memory 1002 may include high-speed RAM memory or may further include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 1001 is configured for executing a computer program stored in the memory 1002 to implement the steps in the geometric object screening method in the above method embodiments.
The processor 1001 may be a central processing unit (central processing unit, abbreviated as CPU), or an application specific integrated circuit (application specific integrated circuit, abbreviated as ASIC), or one or more integrated circuits configured to implement embodiments of the present application.
Alternatively, the memory 1002 may be separate or integrated with the processor 1001. When the memory 1002 is a device separate from the processor 1001, the electronic apparatus 1000 may further include: bus 1003 is used to connect processor 1001 and memory 1002. The bus may be an industry standard architecture (industry standard architecture, abbreviated ISA) bus, an external device interconnect (peripheral component, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. Buses may be divided into address buses, data buses, control buses, etc., but do not represent only one bus or one type of bus.
Alternatively, in a specific implementation, if the memory 1002 and the processor 1001 are integrated on a chip, the memory 1002 and the processor 1001 may complete communication through an internal interface.
The present application also provides a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, and specifically, the computer-readable storage medium stores computer-executable instructions, which when executed by at least one processor of the electronic device, the electronic device performs the steps of the geometric object screening method provided in the various embodiments described above.
Embodiments of the present application also provide a computer program product comprising a computer program stored in a readable storage medium. The computer program may be readable from a readable storage medium by at least one processor of an electronic device, the at least one processor executing the computer program to cause the electronic device to perform the steps of the geometric object screening method provided by the various embodiments described above.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the present application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (20)

1. A geometric object screening method, comprising:
determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met;
determining an approximate object corresponding to the target geometric object, wherein the approximate object comprises 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-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object;
And screening the second geometric objects according to the first approximate objects and/or the second approximate objects to reduce geometric objects which do not meet the query range in the second geometric objects.
2. The geometric object screening method according to claim 1, wherein the target geometric object includes an object identifier of the target geometric object, and the determining the approximate object corresponding to the target geometric object includes:
and if the approximate object is found in the cache space according to the object identification, reading the approximate object from the cache space according to the object identification.
3. The geometric object screening method according to claim 2, further comprising:
if the approximate object is not found in the cache space according to the object identification, determining whether the target geometric object belongs to a large geometric object;
and if the target geometric object belongs to a large geometric object, generating the approximate object and storing the approximate object into the cache space.
4. A geometric object screening method according to claim 3, wherein said determining whether said target geometric object belongs to a large geometric object if said approximate object is not found in said cache space according to said object identification comprises:
Determining an attribute value of a minimum boundary matrix MBR of the target geometric object in a target dimension and an attribute upper limit value of an object class of the target geometric object corresponding to the target dimension;
comparing the attribute value with the attribute upper limit value;
and if the attribute value is larger than the attribute 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 the large geometric object.
5. The geometric object screening method according to claim 4, wherein the determining the attribute value of the MBR of the target geometric object in the target dimension and the attribute upper limit value of the object class to which the target geometric object belongs in the target dimension includes:
determining a target column to which the target geometric object belongs in a geometric object column of a data table, wherein the same geometric object column of the data table contains attribute information of geometric objects of the same category;
according to the object identification, acquiring an attribute value of the MBR of the target geometric object in the target dimension from the attribute information of the target geometric object;
and determining the attribute upper limit value of the object class of the target geometric object corresponding to the target dimension as the attribute upper limit value of the target column corresponding to the target dimension, wherein the attribute upper limit value of the target column corresponding to the target dimension is obtained by statistics according to the attribute values of MBRs of a plurality of geometric objects in the target column in the target dimension.
6. The geometric object screening method according to claim 5, wherein the statistical process of the attribute upper limit value corresponding to the target dimension by the target column includes:
according to the attribute values of MBRs of a plurality of geometric objects in the target column on the target dimension, respectively, counting the quantiles of the geometric objects on the target dimension;
and counting the attribute upper limit value corresponding to the target dimension of the target column according to the quantile.
7. A geometric object screening method according to any one of claims 3 to 6, wherein said generating and storing said approximated objects to said cache space if said target geometric object belongs to a large geometric object comprises:
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 space range of the approximate object through a multi-way tree algorithm to generate a multi-way tree corresponding to the approximate object, wherein the multi-way tree is used for representing the approximate object;
and storing the multi-way tree into the cache space.
8. The geometric object screening method according to claim 7, wherein in recursively subdividing the spatial range of the approximate object by a multi-way tree algorithm to generate a multi-way tree corresponding to the approximate object, an nth subdivision of the spatial range of the approximate object includes:
Traversing nodes in the multi-way tree, and determining the current node;
dividing the space block corresponding to the current node into a plurality of subspace blocks;
determining the position relation between the subspace partitions and the target geometric object;
and determining the partition type corresponding to the current node and/or creating a corresponding node for the subspace partition meeting the subdivision condition in the subspace partitions according to the position relation.
9. The geometric object screening method according to claim 8, wherein determining the partition type corresponding to the current node and/or creating a corresponding node for a subspace partition satisfying a subdivision condition among the plurality of subspace partitions according to the positional relationship comprises:
if the subspace partitions are all located in the target geometric object, determining that the partition type corresponding to the current node is an inner partition;
and if the position relations of the subspace partitions and the target geometric object all belong to an overlapping relation or a contact relation, determining the partition type corresponding to the current node as a boundary partition.
10. A geometric object screening method according to claim 9, further comprising:
If the position relations between the subspace blocks and the target geometric object are different, and subspace blocks with the position relation of the target geometric object being in an overlapping relation or a contact relation exist in the subspace blocks, corresponding nodes are created for the rest subspace blocks except for the subspace blocks with the position relation of the target geometric object being in a separation relation.
11. The geometric object screening method according to claim 8, wherein the dividing the spatial partition corresponding to the current node into a plurality of subspace partitions includes:
and dividing the space block into a plurality of subspace blocks on average according to the space quadrant, wherein different subspace blocks are positioned in different space quadrants.
12. The geometric object screening method according to claim 8, wherein after determining the partition type corresponding to the current node and/or creating a corresponding node for a subspace partition satisfying a subdivision condition among the plurality of subspace partitions according to the location relationship, further comprises:
determining the node number of the multi-way tree;
if the number of the nodes is larger than a soft boundary value, determining the position relation between the leaf nodes of the multi-way tree and the target geometric object;
And determining the block type corresponding to the leaf node according to the position relation between the leaf node and the target geometric object.
13. A geometric object screening method according to any one of claims 1 to 6, wherein the screening the second geometric object according to the first approximate object and/or the second approximate object to reduce geometric objects in the second geometric object that do not satisfy the query scope includes:
according to the first approximate object and/or the second approximate object, carrying out position relation condition screening on the first geometric object and the second geometric object, and determining the position relation between the first geometric object and the second geometric object;
screening the second geometric objects according to the position relation between the first geometric objects and the second geometric objects so as to reduce geometric objects which do not meet the query range in the second geometric objects;
wherein, the position relation condition screening can comprise at least one of the following: inclusion condition screening, separation condition screening, overlap or contact condition screening, and distance range condition screening.
14. The geometric object screening method according to claim 13, wherein, in the case where the positional relationship condition screening includes inclusion condition screening, the performing positional relationship condition screening on the first geometric object and the second geometric object according to the first approximation object and/or the second approximation object, determining the positional relationship between the first geometric object and the second geometric object includes:
if the MBR of the second geometric object is positioned inside the inner partition of the first approximate object, determining that the position 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 partition of the first approximate object and the MBR of the second geometric object does not overlap with the boundary partition of the first approximate object, determining that the first geometric object is in a disjoint relationship or not in an inclusive relationship with the second geometric object.
15. The geometric object screening method according to claim 13, wherein in the case where the positional relationship condition screening includes inclusion condition screening, the performing positional relationship condition screening on the first geometric object and the second geometric object according to the first approximation object and/or the second approximation object, determining a positional relationship between the first geometric object and the second geometric object includes:
If the MBR of the first geometric object is positioned inside the inner partition of the second approximate object, determining that the first geometric object and the second geometric object are in a contained relation;
if the MBR of the first geometric object does not overlap with the inner partition of the second approximate object and the MBR of the first geometric object does not overlap with the boundary partition of the second approximate object, determining that the first geometric object is in a disjoint relationship or not contained relationship with the second geometric object.
16. The geometric object screening method according to claim 13, wherein, in the case that the positional relationship condition screening includes a separation condition screening, the positional relationship between the first geometric object and the second geometric object is determined by performing positional relationship condition screening on the first geometric object and the second geometric object according to the first approximate object and/or the second approximate object, by at least one of:
determining that the first geometric object is in a disjoint relationship with the second geometric object if the MBR of the first geometric object does not overlap with an inner partition of the second approximate object and the MBR of the first geometric object does not overlap with a boundary partition of the second approximate object;
Determining that the first geometric object is in a disjoint relationship with the second geometric object if the MBR of the second geometric object does not overlap with the inner partition of the first approximation object and the MBR of the second geometric object does not overlap with the boundary partition of the first approximation object;
and if the inner partition of the first approximate object is not overlapped with the inner partition of the second approximate object and the boundary partition of the second approximate object are not overlapped, determining that the first geometric object and the second geometric object are in a separation relation.
17. A geometric object screening method according to any one of claims 1 to 6, further comprising, prior to said determining the target geometric object:
and screening the second geometric objects from the plurality of geometric objects according to the MBRs of the first geometric objects and the MBRs respectively corresponding to the plurality of geometric objects.
18. A geometric object screening apparatus, comprising:
the parameter determining module is used for determining a target geometric object, wherein the target geometric object comprises a first geometric object representing a query range and a second geometric object to be detected whether the query range is met;
The approximate object determining module is used for determining an approximate object corresponding to the target geometric object, wherein the approximate object comprises 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-way tree, and nodes on the multi-way tree correspond to space blocks in the space range of the approximate object;
and the screening module is used for screening the second geometric objects according to the first approximate objects and/or the second approximate objects so as to reduce geometric objects which do not meet the query range in the second geometric objects.
19. An electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing computer-executable instructions stored in the memory causes the at least one processor to perform the geometric object screening method of any one of claims 1 to 17.
20. A computer readable storage medium having stored therein computer executable instructions which, when executed by a processor, implement a geometric object screening method as claimed in any one of claims 1 to 17.
CN202211736744.0A 2022-12-30 2022-12-30 Geometric object screening method, device, equipment and storage medium Pending CN116244338A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211736744.0A CN116244338A (en) 2022-12-30 2022-12-30 Geometric object screening method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211736744.0A CN116244338A (en) 2022-12-30 2022-12-30 Geometric object screening method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116244338A true CN116244338A (en) 2023-06-09

Family

ID=86626968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211736744.0A Pending CN116244338A (en) 2022-12-30 2022-12-30 Geometric object screening method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116244338A (en)

Similar Documents

Publication Publication Date Title
JP4372477B2 (en) Method and system for traversing a binary tree
US11704537B2 (en) Octree-based convolutional neural network
CN112669463B (en) Method for reconstructing curved surface of three-dimensional point cloud, computer device and computer-readable storage medium
CN108733780B (en) Picture searching method and device
CN110633262B (en) Spark-based map intersection area calculation method and system
Tao et al. Analysis of predictive spatio-temporal queries
CN111090712A (en) Data processing method, device and equipment and computer storage medium
WO2021232278A1 (en) Map acquisition method and apparatus, computer device, and storage medium
CN116227209A (en) Multi-dimensional linear difference method for point cloud data, terminal equipment and storage medium
CN112486987A (en) City inquiry method, device, equipment and storage medium based on longitude and latitude
CN112825199A (en) Collision detection method, device, equipment and storage medium
Jaillet et al. Fast Quadtree/Octree adaptive meshing and re-meshing with linear mixed elements
CN111507430B (en) Feature coding method, device, equipment and medium based on matrix multiplication
CN117009411A (en) Method, device and computer readable storage medium for meshing space storage and indexing based on point cloud data
CN116630912A (en) Three-dimensional semantic occupation prediction method, system, equipment, medium and product
CN115952252A (en) Data processing method, device, electronic equipment and medium
CN116244338A (en) Geometric object screening method, device, equipment and storage medium
CN113722415B (en) Point cloud data processing method and device, electronic equipment and storage medium
Jonathan et al. Stella: geotagging images via crowdsourcing
CN115796111A (en) File processing method suitable for agf, computer equipment and readable storage medium
CN115481592A (en) Data processing method, data structure generation method and query method
Tang et al. Hexagon-based generalized Voronoi diagrams generation for path planning of intelligent agents
CN113806601A (en) Peripheral interest point retrieval method and storage medium
CN110945499B (en) Method and system for real-time three-dimensional space search and point cloud registration by applying dimension shuffling transformation
KR20000007169A (en) Method of managing database by using divided minimum bounding rectangle

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination