Grid-based spatial object topological relation calculation method and system

Through the adaptive segmentation and filtering and refinement processing method based on grid, the problem of low computing efficiency of spatial object topology relationships in the prior art is solved, and a more efficient computing process is realized.

CN119441668APending Publication Date: 2025-02-14WUHAN UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411433983.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the calculation efficiency of spatial object topological relationships is low and the complexity of traditional methods is high, resulting in huge challenges in timeliness and large-scale promotion.

Method used

The topological relationship calculation method of spatial object based on grid is adopted, and spatial objects are approximated into multi-level grid sets through adaptive segmentation, filtering and refining are performed, and the computing efficiency is significantly improved by using the characteristics of grids.

Benefits of technology

It significantly improves the efficiency of topological relationship calculation of spatial objects, reduces the computational complexity, reduces candidates entering the refinement stage, and improves the computational timeliness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441668A_ABST
    Figure CN119441668A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of spatial big data processing, and discloses a grid-based spatial object topological relation calculation method and system. According to the grid-based spatial object topological relation calculation method provided by the invention, firstly, adaptive subdivision is performed on a spatial object which is a point object or a non-point object, and each point object is adaptively subdivided into a fixed-level grid; and adaptively dividing each non-point object into a set of multi-level grid units according to a set division threshold, and then filtering and solving based on an adaptive grid. The computing system provided by the invention comprises a self-adaptive subdivision module, a filtering module and a refinement module. According to the method, the calculation efficiency of the spatial object topological relation can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of spatial big data processing, and more specifically, relates to a method and system for calculating the topological relationship of spatial objects based on a grid. Background Art

[0002] In recent years, with the development of technologies such as the Global Positioning System and the Internet of Things, spatial data has shown explosive growth. For example, in the fourth quarter of 2021, a travel service company had 118 million monthly active users worldwide, generating an average of 19 million travel records per day. Mining valuable information from these massive amounts of spatial data can be applied to various fields such as urban planning, crime data analysis, and epidemiological analysis. Spatial data mining relies on basic spatial relationship calculations, especially topological relationship calculations. For example, researchers often count which points of interest are contained in each administrative district. However, traditional topological relationship calculation methods are highly complex, which poses a huge challenge to the timeliness and large-scale promotion of upper-level applications.

[0003] Traditional topological relationship calculation mainly includes two steps: filtering and refinement. In the filtering process, the minimum bounding rectangle (MBR) of the spatial object is usually used as input to roughly judge the topological relationship between spatial objects. However, since MBR is a rough approximation of spatial objects, the filtering process that relies solely on MBR often leads to a large number of unmatched candidate objects entering the time-consuming refinement stage. In the refinement process, geometric operations are performed using precise spatial coordinates to determine their topological relationships, which is very time-consuming. In order to alleviate this problem, researchers have proposed various spatial object approximation models. For example, some researchers have proposed a solution in which polygons are rasterized into a set of grid cells, and for another example, some researchers use tile-MBR to approximate polygons. However, most of the existing solutions focus on improving the efficiency of the filtering stage, rarely optimize the refinement process, and have low computational efficiency. In addition, the existing technical solutions usually do not consider how to balance the filtering and refinement costs. Summary of the invention

[0004] The present invention solves the problem of low efficiency in calculating the topological relationship of spatial objects in the prior art by providing a grid-based method and system for calculating the topological relationship of spatial objects.

[0005] The present invention provides a method for calculating the topological relationship of spatial objects based on a grid, comprising the following steps:

[0006] S1: Adaptive segmentation of spatial objects;

[0007] The spatial object is a point object or a non-point object, each of the point objects is adaptively divided into a fixed-level grid, each of the non-point objects is adaptively divided into a set of multi-level grid units according to a set segmentation threshold, and a grid set is obtained after adaptive segmentation of all spatial objects;

[0008] S2: Filtering based on adaptive grid;

[0009] Using the grid set obtained in S1 to roughly judge the topological relationship between spatial objects, and calculate the overlapping grid set;

[0010] S3: Refinement processing based on adaptive grid;

[0011] For candidate pairs whose topological relationships cannot be determined after filtering, the coordinate fragments recorded in the overlapping grid set obtained in S2 are used to determine the precise topological relationship between the spatial objects.

[0012] Preferably, in S1, the optimal SEG is obtained by cost analysis of the filtering and refinement process, and the value of SEG is determined according to the optimal SEG; or, the value of SEG is determined by selecting within the recommended value range of SEG obtained in advance, and the recommended value range of SEG is 5 to 15;

[0013] After determining the value of SEG, the segmentation threshold of the non-point object is calculated in combination with the number of points contained in the spatial object. The calculation formula is as follows:

[0014] N g =N p / SEG

[0015] Where N g is the threshold number of grid cells, N g As the segmentation threshold for non-point objects; N p is the number of points contained in the spatial object, and SEG is the number of line segments contained in each grid unit.

[0016] Preferably, when performing cost analysis on the filtering and refinement process, the total time required for calculating the topological relationship of spatial objects based on the adaptive grid is recorded as cost, and the total time cost is the time cost of the filtering process. f The time cost of the refinement process r The sum is expressed as follows:

[0017]

[0018] Where, t f is the time consumed for calculating each grid topological relationship in the adaptive grid filtering process, t ris the time consumption of each intersection test in the refinement process based on adaptive grids, and p is the proportion of overlapping grids;

[0019] The optimal SEG is obtained by calculating the derivative of cost with respect to SEG, which is expressed as follows:

[0020]

[0021] when When f′ (SEG) =0, the total time cost reaches the minimum value.

[0022] Preferably, in S1, the specific implementation method of adaptively dividing each of the non-point objects into a set of multi-level grid units according to a set dividing threshold includes:

[0023] Calculating an initial subdivision level according to the size of the minimum enclosing rectangle of the non-point object; calculating an initial subdivision grid according to the coordinates of the four corner points of the minimum enclosing rectangle of the non-point object and the initial subdivision level;

[0024] The initial grid of the non-point object is added to the candidate queue, and the grid cells in the candidate queue are recursively split; the non-point object is divided in a top-down manner, including: if the spatial object does not intersect with the grid obtained by the division, the grid is discarded; if the spatial object completely contains the grid obtained by the division, the grid is recorded as an internal grid and directly added to the internal grid set; if the spatial object intersects with the grid obtained by the division, the grid is recorded as an edge grid and added to the candidate queue;

[0025] Repeat the above splitting and partitioning operations until the number of grids in the candidate queue reaches the partitioning threshold, merge the internal grid set and the grids in the candidate queue to obtain a result set, and complete the gridding;

[0026] The grids in the result set are sorted in ascending order according to the grid codes, and the coordinate segments where the non-point objects intersect with each grid cell are calculated and recorded in the grid cell.

[0027] Preferably, in S1, the specific implementation method of adaptively dividing each point object into a fixed-level grid includes: calculating the row number and column number of the grid unit where the point object is located according to the longitude and latitude of the point object and the given grid level; and calculating the Z-Order code of the point object in a bit-cross coding manner.

[0028] Preferably, S2 comprises the following sub-steps:

[0029] S201: Determine whether the minimum enclosing rectangles of two spatial objects intersect; if not, the two spatial objects are in a separated relationship; if intersecting, proceed to S202;

[0030] S202: Determine whether the coding intervals of the grid sets of the two spatial objects intersect; if not, the two spatial objects are in a separated relationship; if intersecting, proceed to S203;

[0031] S203: sequentially traverse the grid sets of the two spatial objects, calculate the overlapping grid sets of the grid sets of the two spatial objects, and complete filtering processing based on the overlapping grid sets.

[0032] Preferably, in S203, the results of the filtering process include the following situations:

[0033] If the overlapping grid set is empty, the two spatial objects are in a separated relationship;

[0034] If the overlapping grid set is not empty and there are internal grids in the overlapping grid set, the two spatial objects are in an intersection relationship;

[0035] If the overlapping grid set is not empty, and all the overlapping grid sets are edge grids, then the candidate pair needs to be further refined and transferred to S3.

[0036] Preferably, S3 comprises the following sub-steps:

[0037] S301: taking out the coordinate segments of two spatial objects in the overlapping grid set to form a line segment set;

[0038] S302: Use the scan line index algorithm to determine whether the two spatial objects intersect; if there is an intersecting line segment, the two spatial objects are in an intersecting relationship; otherwise, proceed to S303;

[0039] S303: roughly judging whether there is a containment relationship based on the minimum enclosing rectangle; if the minimum enclosing rectangles of the two spatial objects do not have a containment or being contained relationship, the two spatial objects are in a separated relationship; otherwise, proceed to S304;

[0040] S304: Use the ray method to further determine whether there is a containment relationship between the two spatial objects. Select a point from the spatial object with the smaller minimum enclosing rectangle, and use the ray method to determine whether the other spatial object contains the point. If so, the two objects are in a containment relationship; otherwise, the two spatial objects are in a separation relationship.

[0041] In another aspect, the present invention provides a grid-based spatial object topological relationship calculation system, comprising:

[0042] An adaptive partitioning module is used to adaptively partition space objects;

[0043] A filtering module, used for filtering based on an adaptive grid;

[0044] Refinement module, used for refinement processing based on adaptive grid;

[0045] The grid-based spatial object topological relationship calculation system is used to execute the steps in the above-mentioned grid-based spatial object topological relationship calculation method.

[0046] Preferably, the grid-based spatial object topological relationship calculation system further includes:

[0047] The cost analysis module is used to perform cost analysis on the filtering and refinement process to obtain the optimal SEG.

[0048] One or more technical solutions provided in the present invention have at least the following technical effects or advantages:

[0049] (1) The present invention provides a grid-based spatial object topological relationship calculation method, which first adaptively divides the spatial object, and then performs filtering and solving based on the adaptive grid. Specifically, the spatial object is a point object or a non-point object. The present invention adaptively divides each point object into a fixed-level grid, and adaptively divides each non-point object into a set of multi-level grid units according to a set division threshold, and obtains a grid set after adaptively dividing all spatial objects. The grid set is used to roughly judge the topological relationship between spatial objects, and an overlapping grid set is calculated; for candidate pairs whose topological relationship cannot be determined after filtering, the coordinate fragments recorded in the overlapping grid set are used to judge the precise topological relationship between spatial objects. That is, the present invention approximates and expresses spatial objects based on adaptively divided grids, adaptively expresses spatial objects as multi-level grid sets, and adaptively approximates spatial objects as grid unit sets, thereby converting the topological relationship calculation between spatial objects into a topological relationship calculation based on grid units, and utilizing the characteristics of grids that are easy to encode and fast to calculate to significantly improve the efficiency of spatial object topological relationship calculation. Compared with the existing methods for calculating the topological relationship of spatial objects, the present invention can greatly improve the efficiency of calculating the topological relationship of spatial objects in a distributed environment, and provide a basis for the retrieval and analysis of massive spatiotemporal data. Compared with the traditional MBR, the approximation of the geometric shape of the present invention is more accurate. For the filtering process in the subsequent spatial relationship calculation, the grid-based filtering is more effective and can greatly reduce the candidate objects entering the refinement stage. In addition, the present invention pre-sorts the grids in the result set in the adaptive segmentation stage, which can effectively reduce the time complexity of the filtering stage. The present invention can calculate the topological relationship of spatial objects using partial coordinate fragments in overlapping grids in the refinement stage. Compared with the refinement process based on the complete object coordinates, the grid-based refinement calculation complexity of the present invention is greatly reduced, which improves the calculation efficiency.

[0050] (2) The present invention also obtains the optimal SEG by performing a cost analysis on the filtering and refinement process, and then calculates the segmentation threshold of non-point objects. That is, the present invention can estimate the approximate expression granularity of spatial objects through a cost model, and can balance the cost of filtering and refinement based on the adaptive grid, thereby optimizing the calculation efficiency of the topological relationship based on the adaptive grid, while also avoiding a large amount of parameter adjustment work and lowering the user's usage threshold. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a flowchart of gridding non-point objects in a grid-based spatial object topological relationship calculation method provided in Example 1 of the present invention.

[0052] Figure 2 is an example diagram of the gridding of spatial objects in a grid-based spatial object topological relationship calculation method provided in Example 1 of the present invention. Figure 2 (a) in the figure is the gridding of point objects. Figure 2 (b) in the figure is the gridding of line objects. Figure 2 (c) in the figure is the gridding of the surface object. Figure 2 (d) in the figure is a grid unit.

[0053] Figure 3 It is a flowchart of the filtering process in a grid-based spatial object topological relationship calculation method provided in Example 1 of the present invention.

[0054] Figure 4 Schematic diagram of the filtering process in a grid-based spatial object topological relationship calculation method provided in Example 1 of the present invention. Figure 4 (a) in the figure is based on MBR filtering. Figure 4 (b) in the figure is grid-based filtering.

[0055] Figure 5 It is a flowchart of the refinement process in a grid-based spatial object topological relationship calculation method provided in Example 1 of the present invention.

[0056] Figure 6 Schematic diagram of the refinement process in a grid-based spatial object topological relationship calculation method provided in Embodiment 1 of the present invention. Figure 6 (a) is a schematic diagram of the scanning line algorithm to determine whether there is an intersection. Figure 6 (b) is a schematic diagram of the MBR inclusion test and the ray method to determine whether it is included.

[0057] Figure 7 This is a result diagram of the impact of different grid granularity SEG on topological relationship calculation.

[0058] Figure 8It is a performance comparison chart of topology relationship calculation between the present invention and JTS. DETAILED DESCRIPTION

[0059] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0060] Embodiment 1:

[0061] Embodiment 1 provides a method for calculating the topological relationship of spatial objects based on a grid, comprising the following steps:

[0062] S1: Adaptive segmentation of spatial objects.

[0063] According to the size and shape of the spatial object, an adaptive grid approximation model is used to approximate the spatial object and adaptively divide the spatial object into a multi-level grid unit set.

[0064] Among them, the spatial object is a point object or a non-point object, and the approximation methods of point objects and non-point objects are different. Each point object is approximated as a fixed-level grid, that is, each point object is adaptively divided into a fixed-level grid; and the non-point object is approximated as a multi-level grid set according to a set division threshold, that is, each non-point object is adaptively divided into a set of multi-level grid units according to a set division threshold; after adaptively dividing all spatial objects, a grid set is obtained to complete gridding.

[0065] The following describes point objects and non-point objects separately.

[0066] (1) Gridding of point objects.

[0067] For a point object, first calculate the row and column number of the grid cell where the point is located according to the latitude and longitude of the point and the given grid level. Then calculate the Z-Order code of the point in a bit-cross coding manner.

[0068] (2) Gridding of non-point objects.

[0069] The process of gridding non-point objects can be found in Figure 1 , mainly includes the following parts:

[0070] (2.1) Determination of non-point object segmentation threshold.

[0071] That is, set the segmentation threshold for non-point objects.

[0072] The non-point object segmentation threshold can be determined and set in a variety of ways. For example, a recommended threshold can be obtained based on theoretical derivation or experiment. Figure 7) The recommended threshold value obtained by adjusting the parameter verification ranges from 5 to 15.

[0073] (2.2) Initial grid calculation for non-point objects.

[0074] First, the initial subdivision level L is calculated according to the size of the minimum bounding rectangle MBR of the non-point object; then, the initial subdivision grid is calculated according to the coordinates of the four corner points of the non-point object MBR and the initial subdivision level L.

[0075] (2.3) Adaptive segmentation of non-point objects.

[0076] The initial grid of the non-point object is added to the candidate queue, and then the grid cells in the queue are recursively split. The non-point object is split in a top-down manner, including: if the spatial object does not intersect with the grid obtained by the split (which can be recorded as a subgrid), the subgrid is discarded; if the spatial object completely contains the subgrid, the subgrid is marked as an internal grid and directly added to the internal grid set; if the spatial object intersects with the subgrid, the subgrid is recorded as an edge grid and continues to be added to the candidate queue.

[0077] (2.4) Repeat the splitting and partitioning operations described in (2.3) until the number of grids in the candidate queue reaches the partitioning threshold, and merge the internal grid set and the grids in the candidate queue as the result set. At this point, the gridding is completed.

[0078] Preferably, it may also include: the sorting operation of (2.5).

[0079] (2.5) Use quick sort to sort the grids in the result set in ascending order according to the grid code, and calculate the coordinate fragments where the non-point object intersects with each grid cell and record them in the grid cell. By pre-quick sorting the grid set, the time complexity of the subsequent S2 grid filtering process can be effectively reduced.

[0080] S2: Filtering process based on adaptive grid.

[0081] The grid set obtained in S1 is used to roughly judge the topological relationship between spatial objects, and the overlapping grid set is calculated.

[0082] Since the opinions in S1 pre-sort the grids in the result set, the topological relationship between spatial objects can be quickly and roughly determined in S2 with a time complexity of O(n), where n is the total number of grids in the spatial object grid set.

[0083] For example, if we take the spatial connection of two spatial data sets as an example, we use the pre-quickly sorted grid set of spatial objects to roughly determine the topological relationship between the spatial objects. The time complexity is O(M+N), where M and N are the number of grids of the two spatial objects respectively.

[0084] Specifically, filtering based on the adaptive grid includes the following sub-steps:

[0085] S201: Determine whether the MBRs of two spatial objects intersect; if not, the two spatial objects are in a separated relationship; if intersecting, proceed to S202.

[0086] S202: Determine whether the coding intervals of the grid sets (respectively denoted as M and N) of two spatial objects intersect; if they do not intersect (i.e., the smallest grid code in M ​​is greater than the largest grid code in N or vice versa), the two spatial objects are in a separated relationship; if they intersect, proceed to S203.

[0087] S203: Sequentially traverse the grid sets M and N of the two spatial objects, and calculate the overlapping grid sets of M and N, recorded as overlappingGrids. Since M and N have been sorted in S106, when determining the topological relationship between the grid sets, only one traversal of the two grid sets is required, so its time complexity is O(M+N). The filtering results are as follows:

[0088] (1) If overlappingGrids is empty, the two spatial objects are in a separated relationship.

[0089] (2) If overlappingGrids is not empty and there are internal grids in overlappingGrids, the two spatial objects are in an intersecting relationship.

[0090] (3) If overlappingGrids is not empty and all grids are edge grids, the candidate pair needs to be further refined and transferred to S3.

[0091] That is, when overlappingGrids is not empty, it is determined whether there is an internal grid in overlappingGrids; if there is an internal grid, the two spatial objects intersect; otherwise, the process enters pending.

[0092] S3: Refinement processing based on adaptive grid.

[0093] For candidate pairs whose topological relationships cannot be determined in the filtering process, the coordinate fragments recorded in the overlapping grid set obtained by S2 are further used to determine the precise topological relationship between spatial objects.

[0094] Specifically, the refinement process based on the adaptive grid includes the following sub-steps:

[0095] S301: Taking out the coordinate segments of two spatial objects in the overlapping grid set to form a line segment set.

[0096] S302: Use the scan line index algorithm to determine whether the spatial objects intersect; if there are intersecting line segments, the two spatial objects are in an intersecting relationship; if there are no intersecting line segments, the topological relationship of the spatial objects cannot be determined, and then proceed to S303.

[0097] S303: Roughly determine whether there is a containment relationship based on the MBR; when the MBRs of the two objects do not have a containment / being contained relationship, the spatial objects are in a separate relationship; otherwise, the spatial objects may have a containment relationship, and proceed to S304.

[0098] S304: Use the ray method to further determine whether there is a containment relationship. Select any point from the object with a smaller MBR and use the ray method to determine whether another spatial object contains the point. If so, the two objects are in a containment relationship; otherwise, they are in a separation relationship.

[0099] In general, S1 divides the grid into internal grids and edge grids during grid division, which makes it possible to determine the intersection of spatial objects when the overlapping grids are internal grids during the S2 filtering process, reducing the candidate pairs entering the refinement stage. S3 only uses a small number of coordinate fragments in the overlapping grid set to calculate the topological relationship, reducing the complexity of the refinement stage.

[0100] In the process of calculating topological relationships in the scheme provided in Example 1, the grid granularity of spatial objects directly affects the calculation performance of spatial relationships. The coarser the grid granularity, the fewer grids are needed to express spatial objects, and the less time-consuming the grid-based filtering phase is; correspondingly, the coarser-grained grid contains more coordinate points, resulting in an increased time consumption in the grid-based refinement phase. Therefore, there is an optimal grid granularity that can balance the grid-based filtering and refinement processes. Based on this, the present invention is further optimized on the basis of Example 1, and a grid granularity optimization scheme including cost analysis is proposed, which is specifically illustrated in Example 2.

[0101] Embodiment 2:

[0102] Embodiment 2 provides a method for calculating the topological relationship of spatial objects based on a grid. The difference between Embodiment 2 and Embodiment 1 is that Embodiment 2 is optimized on the basis of Embodiment 1. By performing a cost analysis on the filtering and refinement process, the optimal grid granularity can be estimated according to the size and shape of the spatial object, and the spatial object can be adaptively approximated as a multi-level grid set. That is, Embodiment 2 adds the content of optimizing the grid granularity.

[0103] The estimated optimal gridding granularity (i.e., optimized gridding granularity) is described in detail below.

[0104] First, the definition of gridding granularity is explained.

[0105] In the present invention, the key factor affecting the performance of topological relationship calculation is the number of line segments (hereinafter referred to as SEG) contained in each grid unit after the spatial object is gridded. When the same spatial object is gridded, the smaller the SEG setting is, the fewer the number of line segments contained in each grid, the more grids are generated, and the more refined the approximate expression of the spatial object. Therefore, the smaller the SEG is, the lower the mismatch rate of the adaptive grid-based filtering, but the time consumption increases. Correspondingly, the smaller the SEG is, the lower the complexity of the adaptive grid-based refinement and the less time consumption. Therefore, a suitable SEG can balance the two processes of adaptive grid-based filtering and refinement, so that the overall time consumption of topological relationship calculation is minimized. Therefore, the optimal gridding granularity can be characterized by the optimal SEG.

[0106] We use the generated grid level as the grid granularity of point objects, usually set level = 31. To facilitate grid programming, we use the number of generated grid cells as the grid granularity of non-point objects, and further as the segmentation threshold of non-point objects, specifically: N g =N p / SEG. Where, N g is the number threshold of grid cells, N g As the segmentation threshold for non-point objects; N p is the number of points contained in the spatial object, and SEG is the number of line segments contained in each grid unit.

[0107] Next, the costs of the adaptive grid-based filtering and refinement processes are analyzed.

[0108] (1) Cost analysis of the filtering process based on adaptive grid.

[0109] Assume that each spatial object contains N p coordinate points, and the coordinate points are evenly distributed. A non-point object is approximated as N g =N p / SEG grid cells. In the adaptive grid filtering process, a maximum of 2N g Sub-grid topology relationship calculation, assuming that each grid topology relationship calculation takes time t f Therefore, the total time of the filtering process is: cost f =2N g t f .

[0110] (2) Cost analysis of the refinement process based on the adaptive grid.

[0111] After the adaptive grid-based filtering process, the two spatial objects are assumed to have pN gOverlapping grids, where p is the ratio of overlapping grids. In the adaptive grid-based refinement process, each overlapping grid needs to perform (2SEG)log(2SEG) line segment intersection tests. Assume that each intersection test takes t r In addition, if necessary, the refinement process will also perform a point-surface inclusion test, which takes N time. p t r In summary, the time consumption of the refinement process is: cost r =pN g (2SEG)log(2SEG)t r +N p t r .

[0112] Finally, based on the above cost analysis, the optimal gridding granularity is solved.

[0113] The total time cost of calculating the topological relationship of spatial objects based on the adaptive grid is cost f and cost r The sum is as follows:

[0114]

[0115] In a given computing environment, t f , t r and p are considered constants. To solve the optimal SEG and minimize the total time cost, we calculate the derivative of cost with respect to SEG, as shown in the following formula:

[0116]

[0117] When SEG = t f / (pt r ), f′(SEG)=0, and cost reaches its minimum value, that is, the total time consumption reaches the optimal value. f , t r Values ​​such as and p can be statistically obtained through a simple pre-experimental process, thereby estimating the optimal SEG.

[0118] In summary, Example 2 proposes a grid granularity optimization scheme with added cost analysis, which uses cost analysis to guide the approximate granularity of spatial objects and can balance the cost of filtering and refinement. The grid subdivision granularity of spatial objects directly affects the efficiency of filtering and refinement based on adaptive grids. Through the cost analysis of the filtering and refinement process, the optimal subdivision granularity can be estimated to balance the filtering and refinement processes, thereby minimizing the total time consumption.

[0119] The following takes the spatial connection of two spatial data sets as an example, and further illustrates the grid-based spatial object topological relationship calculation method proposed by the present invention in combination with parameters and drawings.

[0120] The present invention comprises the following steps:

[0121] S1: Each spatial object is approximately expressed as a set of grids using adaptive grid approximation.

[0122] S101: Setting the gridding granularity of the spatial object according to the grid granularity optimization model.

[0123] For point objects, we use the generated grid level as the gridding granularity, usually setting level=31.

[0124] For non-point objects, we use the number of generated grid cells as the gridding granularity. Specifically, the optimal SEG can be estimated by the cost analysis method provided by the present invention. The threshold value N of the number of generated grids is g The calculation formula is: N g =N p / SEG. In addition, according to our theoretical derivation and attached Figure 7 The recommended threshold range obtained from the experimental results in determines the value of SEG, and the recommended value range of SEG is 5 to 15.

[0125] S102: Determine the type of the spatial object. If the spatial object is a point object, execute S103; if the spatial object is a non-point object, execute S104.

[0126] S103: Gridding point objects.

[0127] The grid row number (Col) and column number (Row) of the point object are calculated based on the latitude and longitude coordinates (Lon, Lat) of the point object and the given grid level, and the grid code of the point object is calculated according to the Z-Order row and column number cross coding method. The specific calculation formula is as follows:

[0128]

[0129]

[0130] S104: Calculate the initial subdivision level L of the non-point object so that the spatial range of the grid unit at this level can just accommodate the spatial object.

[0131] L is calculated according to the following formula:

[0132]

[0133] Where Floor represents the function being rounded down, Max represents the function taking its maximum value, 360 is the maximum span of longitude, and dlon and dlat are the spans of the spatial object in longitude and latitude, respectively.

[0134] S105: Determine an L-level initial grid intersecting with the non-point object.

[0135] According to the calculation starting subdivision level L, the grids where the four corner points of the non-point object MBR are located are calculated in turn, and the calculation method is consistent with S103, and it is determined whether the grid intersects with the object. If so, the grid is added to the candidate grid queue CandidateGrids.

[0136] S106: Determine whether the number of grids in CandidateGrids is less than the threshold N g (Right now Figure 1 N grid ), if it is less than the threshold, a grid is taken out from CandidateGrids, its four subgrids are obtained according to its grid code, and the four subgrids are traversed in turn. If the subgrid does not intersect with the spatial object, it is discarded; if it intersects, it is further determined whether the spatial object completely contains the subgrid. If it does, the subgrid is marked as an internal grid and directly added to the interior grid InteriorGrids, otherwise it is added to the candidate queue CandidateGrids.

[0137] S107: Execute S206 repeatedly until the number of grids in CandidateGrids is not less than N. g ; Merge all grids in CandidateGrids with the interior grid set InteriorGrids as the result set ResultGrids, and sort the grids in ResultGrids in ascending order according to the grid code.

[0138] S108: After the gridding is completed, the coordinate segments where the non-point object intersects with each grid are calculated and recorded in the "segments" attribute of the grid.

[0139] Figure 2 The gridding results of point, line, and surface objects and the properties of the grid are shown in Figure 1. Figure 2 (a) shows the gridding of point objects. Figure 2 (b) shows the gridding of line objects. Figure 2 (c) in the figure shows the gridding of the surface object. Figure 2(d) in the figure shows the grid unit. Specifically, a point object is represented by a grid, a line object is represented by a set of uniform edge grids, and a surface object is represented by a set of multi-level grids, which are divided into internal grids and edge grids. A grid has four attributes: level represents the grid level, zid represents the grid code, isInterior represents whether the grid is an internal grid, and segments represents the coordinate segments where non-point objects intersect with the grid.

[0140] In the present invention, each spatial object is approximately expressed as a multi-level grid set. Accordingly, the object-based topological relationship is converted into a grid-based topological relationship, and the specific calculation process can be divided into S2, a filtering process based on an adaptive grid, and S3, a refinement process based on an adaptive grid.

[0141] S2: Filtering process based on adaptive grid. Figure 3 The flowchart of the filtering process is shown in Figure 2. Figure 4 For a schematic diagram of the filtration process, see Figure 3 , the specific steps of the filtering process are as follows:

[0142] S201: First, compare whether the MBRs of two spatial objects (which can be respectively recorded as spatial objects A and B) intersect. If not, the two spatial objects are in a separated relationship. If the MBRs intersect, execute S202.

[0143] For example, Figure 4 The MBR of the line object "road2" in (a) does not intersect with the MBR of the surface object "region1", so "road2" does not intersect with "region1". Specifically, Figure 4 (a) in the figure is based on MBR filtering, and the filtering results include: separation: road2; candidates: road1, road3, road4, road5, road6, road7.

[0144] S202: Compare whether the grid set code intervals of the grid sets M and N of the two spatial objects intersect. If they do not intersect (ie, the smallest grid code in M ​​is greater than the largest grid code in N or vice versa), the two spatial objects do not intersect. If the grid set code intervals intersect, execute S203.

[0145] For example, Figure 4 In (b), the grid set ["0000"] of "road5" does not intersect with the grid set interval ["0001", "1110"] of "region1", so it can be directly judged that "road5" and "region1" do not intersect. Specifically, Figure 4(b) in the figure is grid-based filtering, and the filtering results include: separated: road1, road5; intersecting: road4; candidates: road3, road6, road7.

[0146] S203: sequentially traverse the grid sets M and N, and calculate the overlapping grid sets overlappingGrids of M and N. There are the following situations:

[0147] (1) If overlappingGrids is empty, the two objects are separated. For example, Figure 6 The line object "road1" in (b) and the surface object "region1" do not overlap, so the two do not intersect.

[0148] (2) If overlappingGrids is not empty and there are internal grids in overlappingGrids, then the two spatial objects must intersect. For example, Figure 4 In (b), the overlapping grid sets of the line object "road4" and the surface object "region1" are {"1001", "1011"}, where the grid "1001" is the internal grid of the surface object "region1", so the two must intersect.

[0149] (3) If overlappingGrids is not empty and all grids are edge grids, the candidate pair needs to be further refined and S3 is executed.

[0150] After the spatial vector object grid is expressed, the present invention uses quick sorting to sort the grid set in advance. When filtering based on the adaptive grid, only one traversal of the two grid sets is required at most, and the time complexity is O(n), where n is the total number of grids in the two grid sets.

[0151] S3: Refinement process based on adaptive grid. Figure 5 Flowchart of the refinement process. Figure 6 For an example diagram of the refinement process, see Figure 5 , the specific steps of the refinement process are as follows:

[0152] S301: Take out the coordinate segments of two spatial objects in the overlapping grid set to form a line segment set. For example, Figure 6 In (a), the overlapping grid set of the line object "road7" and the area object "region1" is {"0010"}, and the coordinate fragment of "road7" in the overlapping grid set is "r 0 r 1 r 2 r 3 ", and the coordinate fragment of "region1" in the overlapping grid set is "p 0 p1 p 2 p 3 p 4 ”.

[0153] S302: Use a scan line index algorithm to determine whether the spatial objects intersect.

[0154] First, the scan line index is constructed based on the coordinate fragment. Each line segment in the coordinate fragment forms a coordinate interval [X min , X max ], in the process of scanning the vertical scan line from left to right, it will contain two events, namely, the scan line intersects with the beginning of the interval and the scan line intersects with the end of the interval. Insert the two events into the scan line index, starting with X min Coordinates as insert event E insert , X max Coordinates for deletion event E delete . Sort the events according to the X coordinate, and for each insertion event, record the index subscript of the corresponding deletion event. The event records the spatial object and coordinate value to which the line segment belongs. Then, traverse the scan line event set. For each start event, the subscript in the event set is i, find the index subscript j of the corresponding deletion event, traverse inside the [i, j] interval, and for the line segments that do not belong to the same spatial object as the line segment of the start event, use the inner product of the line segment vector to determine whether they intersect. During the traversal process, as long as there are intersecting line segments, the two spatial objects intersect. When the scan line index algorithm does not find the intersecting line segments, the topological relationship of the spatial objects cannot be determined, and S303 needs to be further executed.

[0155] Specifically, Figure 6 (a) in the figure is the scanning line algorithm used to determine whether they intersect. The determination results include: intersection: road7; candidates: road3, road6.

[0156] S303: Roughly determine whether there is an inclusion relationship based on the MBR.

[0157] When the MBRs of the two objects do not have a containment / included relationship, the spatial objects are separated. When the MBRs of the two objects have a containment / included relationship, the spatial objects may have a containment relationship, and S304 needs to be further executed.

[0158] For example, Figure 6 In (b), “region1” is separated from “road3”.

[0159] S304: The ray method is used to further determine whether there is a containment relationship.

[0160] When the MBRs of two spatial objects are in a containment relationship, randomly select a point from the object with a smaller MBR, draw a horizontal ray outward, and determine the number of intersections between the ray and the other object. If the number of intersections is an odd number, the two objects are in a containment relationship.

[0161] For example, Figure 6 In (b), "region1" and "road6" are in an inclusion relationship.

[0162] Combining the above two steps, Figure 6 (b) in the figure is the MBR inclusion test and the ray method to determine whether it is included. The judgment results include: separation: road3; inclusion: road6.

[0163] The present invention records the coordinate fragments intersecting with the grids during the gridding process, and only uses the coordinate fragments in the overlapping grids output in S2 during the refinement based on the adaptive grid, thereby simplifying the computational complexity of the refinement stage. The time complexity of the process is O(N·(2SEG)log(2SEG)), where N represents the number of overlapping grids and SEG represents the number of line segments in each grid.

[0164] According to the process of the technical solution, we experimented with the method of calculating the topological relationship of spatial objects based on the adaptive grid approximation model on a real data set.

[0165] Figure 7 This is a result diagram of the preliminary verification experiment of the present invention showing the effect of different SEG values ​​on the efficiency of topological relationship calculation. Figure 7 It can be seen that when the SEG value range is 5 to 15, the total time consumption for topological relationship calculation is low and the fluctuation is small; when the SEG value is greater than 15, the total time consumption has an upward trend. Therefore, the recommended value range of SEG in the present invention is 5 to 15.

[0166] Figure 8 The efficiency comparison result of the method of the present invention and JTS is shown in Figure 2. JTS is a commonly used topology calculation library. Figure 8 It can be seen that when a complex surface dataset (administrative district data) is spatially connected with a surface dataset (building) and a line dataset (road), the topological relationship calculation performance of the method of the present invention is improved by an order of magnitude compared with JTS; when a complex surface dataset (administrative district data) is spatially connected with a point dataset (trajectory points), the calculation performance of the method of the present invention is improved by dozens of times compared with the efficiency of the classic JTS spatial relationship calculation algorithm, which verifies the effectiveness of the method of the present invention.

[0167] Embodiment 3:

[0168] Embodiment 3 provides a grid-based spatial object topological relationship calculation system, and the calculation system provided by Embodiment 3 corresponds to the calculation method provided by Embodiment 1. Specifically, the grid-based spatial object topological relationship calculation system provided by Embodiment 3 includes:

[0169] An adaptive partitioning module is used to adaptively partition the spatial object; specifically, the adaptive partitioning module adaptively partitions the spatial object using a custom SEG parameter; the SEG value is determined by selecting within a recommended value range of the SEG obtained in advance, and the determined SEG value is used as the custom SEG parameter, and the recommended value range of the SEG is 5 to 15;

[0170] A filtering module, used for filtering based on an adaptive grid;

[0171] Refinement module, used for refinement processing based on adaptive grid;

[0172] The grid-based spatial object topological relationship calculation system is used to execute the steps in the grid-based spatial object topological relationship calculation method as described in Example 1.

[0173] Since the functions of the modules in the computing system provided in Example 3 correspond to the steps in the computing method provided in Example 1, they can be understood by referring to the description of Example 1 and will not be repeated here.

[0174] Embodiment 4:

[0175] Embodiment 4 provides a grid-based spatial object topological relationship calculation system. The calculation system provided by Embodiment 4 corresponds to the calculation method provided by Embodiment 2. Therefore, it can also be understood that the grid-based spatial object topological relationship calculation system provided by Embodiment 4 is based on the calculation system provided by Embodiment 3, and a cost analysis module is added to further optimize the calculation system. Specifically, the grid-based spatial object topological relationship calculation system provided by Embodiment 3 includes:

[0176] Cost analysis module, used to perform cost analysis on the filtering and refinement process to obtain the optimal SEG;

[0177] An adaptive segmentation module is used to adaptively segment the spatial object; specifically, the adaptive segmentation module uses the optimal SEG obtained by the cost analysis module to adaptively segment the spatial object;

[0178] A filtering module, used for filtering based on an adaptive grid;

[0179] Refinement module, used for refinement processing based on adaptive grid;

[0180] The grid-based spatial object topological relationship calculation system is used to execute the steps in the grid-based spatial object topological relationship calculation method as described in Example 2.

[0181] Since the functions of each module in the computing system provided in Example 4 correspond to the steps in the computing method provided in Example 2, they can be understood by referring to the description of Example 2 and will not be repeated here.

[0182] Finally, it should be noted that the above specific implementation methods are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to examples, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A grid-based spatial object topological relationship calculation method, characterized in that: The following steps are involved: S1: Adaptive segmentation of spatial objects; The spatial object is a point object or a non-point object, each of the point objects is adaptively divided into a fixed-level grid, each of the non-point objects is adaptively divided into a set of multi-level grid units according to a set segmentation threshold, and a grid set is obtained after adaptive segmentation of all spatial objects; S2: Filtering based on adaptive grid; Using the grid set obtained in S1 to roughly judge the topological relationship between spatial objects, and calculate the overlapping grid set; S3: Refinement processing based on adaptive grid; For candidate pairs whose topological relationships cannot be determined after filtering, the coordinate fragments recorded in the overlapping grid set obtained in S2 are used to determine the precise topological relationship between the spatial objects.

2. The grid-based spatial object topological relationship calculation method according to claim 1, characterized in that: In S1, the optimal SEG is obtained by cost analysis of the filtering and refinement process, and the value of SEG is determined according to the optimal SEG; or the value of SEG is determined by selecting within the recommended value range of SEG obtained in advance, and the recommended value range of SEG is 5 to 15; After determining the value of SEG, the segmentation threshold of the non-point object is calculated in combination with the number of points contained in the spatial object. The calculation formula is as follows: N g =N p / SEG Where N g is the number threshold of grid cells, N g As the segmentation threshold for non-point objects; N p is the number of points contained in the spatial object, and SEG is the number of line segments contained in each grid unit.

3. The grid-based spatial object topological relationship calculation method according to claim 2, characterized in that: When performing cost analysis on the filtering and refinement process, the total time required to calculate the topological relationship of spatial objects based on the adaptive grid is recorded as cost. The total time cost is the time cost of the filtering process. f The time cost of the refinement process r The sum is expressed as follows: In the formula, t f is the time consumed for calculating each grid topological relationship in the adaptive grid filtering process, t r is the time consumption of each intersection test in the refinement process based on adaptive grids, and p is the proportion of overlapping grids; The optimal SEG is obtained by calculating the derivative of cost with respect to SEG, which is expressed as follows: when When f ′(SEG) =0, the total time cost reaches the minimum value.

4. The grid-based spatial object topological relationship calculation method according to claim 1, characterized in that: In S1, the specific implementation method of adaptively dividing each non-point object into a set of multi-level grid units according to the set dividing threshold includes: Calculating an initial subdivision level according to the size of the minimum enclosing rectangle of the non-point object; calculating an initial subdivision grid according to the coordinates of the four corner points of the minimum enclosing rectangle of the non-point object and the initial subdivision level; The initial grid of the non-point object is added to the candidate queue, and the grid cells in the candidate queue are recursively split; the non-point object is divided in a top-down manner, including: if the spatial object does not intersect with the grid obtained by the division, the grid is discarded; if the spatial object completely contains the grid obtained by the division, the grid is recorded as an internal grid and directly added to the internal grid set; if the spatial object intersects with the grid obtained by the division, the grid is recorded as an edge grid and added to the candidate queue; Repeat the above splitting and partitioning operations until the number of grids in the candidate queue reaches the partitioning threshold, merge the internal grid set and the grids in the candidate queue to obtain a result set, and complete the gridding; The grids in the result set are sorted in ascending order according to the grid codes, and the coordinate segments where the non-point objects intersect with each grid cell are calculated and recorded in the grid cell.

5. The grid-based spatial object topological relationship calculation method according to claim 1, characterized in that: In S1, the specific implementation method of adaptively dividing each point object into a fixed-level grid includes: calculating the row number and column number of the grid unit where the point object is located according to the longitude and latitude of the point object and the given grid level; and calculating the Z-Order code of the point object in a bit-cross coding manner.

6. The grid-based spatial object topological relationship calculation method according to claim 4, characterized in that: The S2 comprises the following sub-steps: S201: Determine whether the minimum enclosing rectangles of two spatial objects intersect; if not, the two spatial objects are in a separated relationship; if intersecting, proceed to S202; S202: Determine whether the coding intervals of the grid sets of the two spatial objects intersect; if not, the two spatial objects are in a separated relationship; If they intersect, go to S203; S203: sequentially traverse the grid sets of the two spatial objects, calculate the overlapping grid sets of the grid sets of the two spatial objects, and complete filtering processing based on the overlapping grid sets.

7. The grid-based spatial object topological relationship calculation method according to claim 6, characterized in that: In S203, the results of the filtering process include the following situations: If the overlapping grid set is empty, the two spatial objects are in a separated relationship; If the overlapping grid set is not empty and there are internal grids in the overlapping grid set, the two spatial objects are in an intersection relationship; If the overlapping grid set is not empty, and all the overlapping grid sets are edge grids, then the candidate pair needs to be further refined and transferred to S3.

8. The grid-based spatial object topological relationship calculation method according to claim 6, characterized in that: The S3 comprises the following sub-steps: S301: taking out the coordinate segments of two spatial objects in the overlapping grid set to form a line segment set; S302: Use the scan line index algorithm to determine whether the two spatial objects intersect; if there is an intersecting line segment, the two spatial objects are in an intersecting relationship; otherwise, proceed to S303; S303: roughly judging whether there is a containment relationship based on the minimum enclosing rectangle; if the minimum enclosing rectangles of the two spatial objects do not have a containment or being contained relationship, the two spatial objects are in a separated relationship; otherwise, proceed to S304; S304: Use the ray method to further determine whether there is a containment relationship between the two spatial objects. Select a point from the spatial object with the smaller minimum enclosing rectangle, and use the ray method to determine whether the other spatial object contains the point. If so, the two objects are in a containment relationship; otherwise, the two spatial objects are in a separation relationship.

9. A grid-based spatial object topological relationship calculation system, characterized in that: include: An adaptive partitioning module is used to adaptively partition space objects; A filtering module, used for filtering based on an adaptive grid; Refinement module, used for refinement processing based on adaptive grid; The grid-based spatial object topological relationship calculation system is used to execute the steps in the grid-based spatial object topological relationship calculation method according to any one of claims 1-8.

10. The grid-based spatial object topological relationship calculation system according to claim 9, characterized in that: Also includes: The cost analysis module is used to perform cost analysis on the filtering and refinement process to obtain the optimal SEG.

Citation Information

Patent Citations

  • Space object topological relation judgment method based on global dimension subdivision face piece

    CN103345505A

  • Topology maintenance method based on three-dimensional geometric body combination

    CN105809735A

  • Method for parallel space query based on grid division and system of same

    CN106055563A

  • Method for calculating topological relation between building and green land based on V-TMM

    CN114756932A

  • Multi-granularity grid generation method for territorial space planning data and application

    CN118052944A