Vector data statistical information query method, device, equipment and storage medium

By determining the statistical scope and establishing spatial indexes, querying the initial grid scale and merging cached data, the problem of low efficiency in vector data query in traditional technology is solved, and efficient cache hits and fast response is achieved.

CN114490748BActive Publication Date: 2024-12-10BEIJING GEOWAY INFORMATION TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111617879.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2024-12-10
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

Traditional vector data statistical information query technology is inefficient, has a low cache hit rate and a long calculation time, so it cannot flexibly adapt to the size of the statistical range, resulting in weak response capabilities.

Method used

By receiving user query instructions, determining the statistical scope, establishing a spatial index, querying the initial grid scale, and combining cached data based on the statistical scope and grid scale, obtaining query results, flexibly hitting cached data, and improving query efficiency.

Benefits of technology

It improves the cache hit rate and response speed of vector data queries, adapts to query needs of different statistical ranges, and improves query efficiency and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490748B_ABST
    Figure CN114490748B_ABST
Patent Text Reader

Abstract

The present invention discloses a vector data statistical information query method, device, equipment and storage medium, and belongs to the technical field of vector data query. The present invention determines the statistical range according to the query instruction when receiving the query instruction of the user; determines the corresponding spatial index according to the statistical range; queries the database based on the corresponding spatial index to determine the initial grid scale; queries the cached data based on the initial grid scale and the statistical range to obtain the query result; determines the statistical range of the user query through the user's query instruction, and determines the corresponding spatial index according to the statistical range, queries the database through the spatial index to determine the initial grid scale, queries the database based on the initial grid scale, obtains effective cached data, can flexibly hit more cached data effectively according to the size of the statistical range, and improves the efficiency of querying cached data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of vector data query, and in particular to a vector data statistical information query method, device, equipment and storage medium. Background Art

[0002] Traditional vector data statistical information caching technology generally uses designated administrative divisions for unit division. The division scale is relatively rigid, the unit graphics are complex and irregular, and it is not possible to flexibly hit more caches according to the size of the statistical range. The cache hit rate is low, the calculation time is long, and the concurrent response capability is weak.

[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of the present invention is to provide a vector data statistical information query method, device, equipment and storage medium, aiming to solve the technical problem of low efficiency of querying vector data in the prior art.

[0005] To achieve the above object, the present invention provides a method for querying vector data statistical information, the method comprising the following steps:

[0006] Upon receiving a query instruction from a user, determining a statistical range according to the query instruction;

[0007] Determine a corresponding spatial index according to the statistical range;

[0008] Querying a database based on the corresponding spatial index to determine an initial grid scale;

[0009] The cached data is queried based on the initial grid scale and the statistical range to obtain a query result.

[0010] Optionally, querying cached data based on the initial grid scale and the statistical range to obtain a query result includes:

[0011] When the statistical range is completely covered by the initial grid scale, the cached data of the initial grid scale is used as the query result.

[0012] Optionally, querying cached data based on the initial grid scale and the statistical range to obtain a query result includes:

[0013] When the statistical range is not completely covered by the initial grid scale, counting the cache data covered by the initial grid scale as the first cache data;

[0014] Determining a target grid scale according to the initial grid scale;

[0015] When the statistical range is completely covered by the target grid scale, obtaining second cache data based on the statistical range and the target grid scale;

[0016] The first cache data and the second cache data are merged to obtain a query result.

[0017] Optionally, querying cached data based on the initial grid scale and the statistical range to obtain a query result includes:

[0018] When the statistical range is not completely covered by any grid scale, statistical data within the statistical range is calculated according to the database;

[0019] The statistical data is combined with the cached data to obtain a query result.

[0020] Optionally, before determining the corresponding spatial index according to the statistical range, the method further includes:

[0021] Get the spatial information of the original vector data;

[0022] Classifying the original vector data according to the spatial information to obtain statistical information of the vector data at each grid scale and the level of each grid scale;

[0023] The statistical information of the vector data of each grid scale is stored in a database, and a spatial index is established according to the level of each grid scale.

[0024] Optionally, the level division of the original vector data according to the spatial information to obtain statistical information of the vector data of each grid scale and the level of each grid scale includes:

[0025] Obtaining a minimum bounding rectangle of the original vector data based on the spatial information;

[0026] Obtaining a target number of grids and target vector data corresponding to the target number of grids according to the minimum circumscribed rectangle;

[0027] The grid scale whose granularity and proportion meet the preset requirements in the target number of grids is taken as the initial grid scale, and the statistical information of the vector data corresponding to the initial grid scale is obtained;

[0028] Based on the initial grid scale and the statistical information of the vector data corresponding to the initial grid scale, the scale is reduced level by level to generate the statistical information of the vector data of each grid scale and the level of each grid scale.

[0029] Optionally, after the statistical information of the vector data corresponding to the initial grid scale and the vector data corresponding to the initial grid scale is reduced level by level to generate the statistical information of the vector data of each grid scale and the level of each grid scale, the method further includes:

[0030] Obtaining a grid of associated vector data based on the vector data of each grid scale;

[0031] Get the grid level of the associated vector data and establish the parent-child relationship;

[0032] The statistical information of the associated vector data is stored in a database, and a spatial index is established based on the grid level.

[0033] In addition, to achieve the above-mentioned purpose, the present invention also proposes a vector data statistical information query device, the vector data statistical information query device comprising:

[0034] A receiving module, configured to determine a statistical range according to a query instruction received from a user;

[0035] A determination module, used to determine a corresponding spatial index according to the statistical range;

[0036] The determination module is further used to query the database based on the corresponding spatial index to determine the initial grid scale;

[0037] The query module is used to query cache data based on the initial grid scale and the statistical range to obtain query results.

[0038] In addition, to achieve the above-mentioned purpose, the present invention also proposes a vector data statistical information query device, which includes: a memory, a processor, and a vector data statistical information query program stored in the memory and executable on the processor, and the vector data statistical information query program is configured to implement the steps of the vector data statistical information query method described above.

[0039] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a vector data statistical information query program is stored, and when the vector data statistical information query program is executed by a processor, the steps of the vector data statistical information query method described above are implemented.

[0040] The present invention determines a statistical range according to a query instruction of a user upon receiving the query instruction; determines a corresponding spatial index according to the statistical range; queries a database based on the corresponding spatial index to determine an initial grid scale; queries cached data based on the initial grid scale and the statistical range to obtain a query result; determines the statistical range of the user's query through the user's query instruction, determines a corresponding spatial index according to the statistical range, queries the database through the spatial index to determine an initial grid scale, queries the database based on the initial grid scale to obtain effective cached data, can flexibly hit more cached data effectively according to the size of the statistical range, and improves the efficiency of querying cached data. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a structural diagram of a vector data statistical information query device in a hardware operating environment involved in an embodiment of the present invention;

[0042] Figure 2 It is a flowchart of the first embodiment of the vector data statistical information query method of the present invention;

[0043] Figure 3 It is a flowchart of the second embodiment of the vector data statistical information query method of the present invention;

[0044] Figure 4 It is a flowchart of a third embodiment of a vector data statistical information query method of the present invention;

[0045] Figure 5 is a query flow chart of the third embodiment of the vector data statistical information query method of the present invention;

[0046] Figure 6 It is a flowchart of a fourth embodiment of a method for querying vector data statistical information according to the present invention;

[0047] Figure 7 This is a schematic diagram of the overall process of querying vector data in the fourth embodiment of the vector data statistical information query method of the present invention;

[0048] Figure 8 It is a structural block diagram of the first embodiment of the vector data statistical information query device of the present invention.

[0049] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0051] Reference Figure 1 , Figure 1The present invention is a schematic diagram of the structure of a vector data statistical information query device in a hardware operating environment according to an embodiment of the present invention.

[0052] like Figure 1 As shown, the vector data statistical information query device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0053] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the vector data statistical information query device, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.

[0054] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a vector data statistical information query program.

[0055] exist Figure 1 In the vector data statistical information query device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the vector data statistical information query device of the present invention can be set in the vector data statistical information query device, and the vector data statistical information query device calls the vector data statistical information query program stored in the memory 1005 through the processor 1001, and executes the vector data statistical information query method provided by the embodiment of the present invention.

[0056] The embodiment of the present invention provides a method for querying vector data statistical information. Figure 2 , Figure 2It is a flowchart diagram of the first embodiment of the vector data statistical information query method of the present invention.

[0057] In this embodiment, the vector data statistical information query method includes the following steps:

[0058] Step S10: upon receiving a query instruction from a user, determining a statistical range according to the query instruction.

[0059] It should be noted that the execution subject of this embodiment may be software or platform for querying vector data statistical information, or other devices that can query vector data statistical information, and this embodiment does not limit this. The query instruction may include the vector data that the user needs to query, and the vector data may include coordinate data, such as two-dimensional coordinates and three-dimensional coordinates. The statistical range includes the range of the vector data to be queried, which may be a specific range or a range larger than the specific range, so as to cover all the queried vector data, and may include spatial data of the shape and position of the vector data, such as spatial range and spatial reference information.

[0060] In a specific implementation, by parsing the user's query instruction, the vector data that the user wants to query is obtained, and the statistical range of the vector data is obtained, so that a quick search can be performed according to the statistical range of the vector data that the user needs to query.

[0061] Step S20: determining a corresponding spatial index according to the statistical range.

[0062] It should be understood that a spatial index refers to a data structure that is arranged in a certain order according to the position and shape of a spatial object or a certain spatial relationship between spatial objects. In this embodiment, corresponding statistics are performed based on the spatial information of the vector data and a corresponding spatial index is established. When a user needs to query, the corresponding spatial index is searched based on the relevant features of the vector data, which is equivalent to a dictionary establishing a corresponding directory based on the characteristics and corresponding relationships of the text. When a specific text needs to be queried, the text is searched based on the directory. The spatial index can be used to filter unimportant data and quickly find information related to the vector data that the user needs to query.

[0063] Step S30: querying a database based on the corresponding spatial index to determine an initial grid scale.

[0064] It should be noted that the database is a vector data database used to store pre-cached vector data, and may include one or more of a mysql database, a sqlserver database, a postgreSQL database, a Kingbase database, a higo database, and an oracle database, or may be other databases that can store cached vector data, which is not limited in this embodiment.

[0065] It should be understood that the initial grid scale is the first-level grid scale determined after division according to the user's statistical range, which can be the smallest range in the statistical range. For example, if the user's statistical range is 500m, and 500m is divided into 10 grids, the initial grid scale is 50m.

[0066] Step S40: query cache data based on the initial grid scale and the statistical range to obtain query results.

[0067] In this embodiment, the cache data includes vector data stored in a database. By obtaining the statistical range and initial grid scale of the user, the database is searched and the cache data is queried to obtain the vector data desired by the user.

[0068] This embodiment determines the statistical range according to the query instruction when receiving the query instruction of the user; determines the corresponding spatial index according to the statistical range; queries the database based on the corresponding spatial index to determine the initial grid scale; queries the cached data based on the initial grid scale and the statistical range to obtain the query result; determines the statistical range of the user query through the user's query instruction, determines the corresponding spatial index according to the statistical range, queries the database through the spatial index to determine the initial grid scale, queries the database based on the initial grid scale to obtain the effective cached data, and can flexibly hit more cached data effectively according to the size of the statistical range, thereby improving the hit rate of the cached data.

[0069] refer to Figure 3 , Figure 3 It is a flowchart diagram of the second embodiment of the vector data statistical information query method of the present invention.

[0070] Based on the first embodiment above, step S40 of the vector data statistical information query method of this embodiment specifically includes:

[0071] Step S401: when the statistical range is completely covered by the initial grid scale, the cached data of the initial grid scale is used as the query result.

[0072] It should be understood that the statistical range is completely covered by the initial grid scale, which means that the range of vector data that the user needs to query is all within the initial grid scale, that is, the statistical range is equal to the initial grid scale, that is, the statistical range is completely hit by the initial grid scale.

[0073] In the specific implementation, when the user's statistical query instruction is obtained, the platform or software starts to count the vector data that the user needs to query. The current grid level is i. When i=1, the current grid scale is the initial grid scale, and the maximum grid scale is n, where n can be divided according to specific statistical needs and statistical indicators, such as n=5, 10. For example, if the vector data range is 100m, 100m is divided into 10 levels, then the cache data of the initial grid scale is 10m, and the cache data of the second-level grid scale can be 20m. Through the division rules, the cache data of each scale grid is obtained by step-by-step reduction. If the statistical range is completely covered by the initial grid scale range, the statistical information is merged to obtain the statistical results of the query.

[0074] This embodiment uses the cached data of the initial grid scale as the query result when the statistical range is completely covered by the initial grid scale, adopts grids of different scales as cache statistical units, and when the user's statistical range is within the initial grid scale in the database, uses the cached data of the initial grid scale as the query result, thereby effectively reducing the amount of statistical data calculation.

[0075] refer to Figure 4 , Figure 4 It is a flowchart diagram of the third embodiment of the vector data statistical information query method of the present invention.

[0076] A third embodiment of the vector data statistical information query method of the present invention is proposed based on the first embodiment or the second embodiment. In this embodiment, the first embodiment is used for explanation. Step S40 specifically includes:

[0077] Step S402: when the statistical range is not completely covered by the initial grid scale, the cache data covered by the initial grid scale is counted as the first cache data.

[0078] It should be noted that when the statistical range exceeds the initial grid scale, it means that the current initial grid scale is smaller than the statistical range. Therefore, it is necessary to expand the grid scale to be searched. The first cached data refers to the cached data of the grid scale that overlaps with the statistical range in the initial grid scale.

[0079] In this embodiment, the statistical range may completely include the initial grid scale range, and the initial grid scale range may not be completely within the statistical range, for example, the initial grid scale range is smaller than the statistical range, and half of the grid scale range in the initial grid scale range overlaps with the statistical range.

[0080] Step S403: determining a target grid scale according to the initial grid scale.

[0081] It should be understood that the target grid scale is larger than the initial grid scale, and may be the second-level grid scale, the third-level grid scale, or the maximum-level grid scale. When the initial grid scale is smaller than the statistical range, the grid scale may be expanded to the second-level grid scale, and the second-level grid scale is compared with the statistical range. If the second-level grid scale does not completely cover the statistical range, it means that the second-level grid scale is also smaller than the statistical range, and the next-level grid scale is used for hit calculation until the statistical range is completely covered by the target grid scale.

[0082] Step S404: when the statistical range is completely covered by the target grid scale, obtaining second cache data based on the statistical range and the target grid scale.

[0083] In a specific implementation, when the statistical range is completely covered by the target grid scale, it means that the target grid scale is equal to the statistical range, and the cache data of the target grid scale is used as the second cache data for query.

[0084] Step S405: merge the first cache data and the second cache data to obtain a query result.

[0085] It should be noted that, since the statistical range is within the range of the sum of the initial grid scale and the target grid scale, the cache data queried according to the statistical range is the query result obtained by combining the first cache data and the second cache data.

[0086] It should be understood that when the statistical range is not completely covered by the initial grid scale, the first cache data partially covered by the initial grid scale is calculated, and the next grid scale, that is, the second grid scale, is used for hit calculation. When the statistical range is completely covered by the second grid scale, the cache data of the second grid scale is used as the second cache data, and the first cache data and the second cache data are merged to obtain the cache data result of the query. When the statistical range is not completely covered by the second grid scale, the next grid scale is used for hit calculation, that is, the third grid scale is used for calculation, and this calculation process is repeated until the statistical range is completely covered by the target grid scale, and the cache data of the hit target grid scale is merged to obtain the query result.

[0087] In a specific implementation, there is a situation where the maximum level of grid scale does not completely cover the statistical range. Therefore, when the statistical range is not completely covered by any grid scale, the step S40 queries the cached data based on the initial grid scale and the statistical range, including: when the statistical range is not completely covered by any grid scale, obtaining statistical data within the statistical range according to the database calculation; merging the statistical data with the cached data to obtain a query result.

[0088] It should be understood that when the target grid scale is the maximum grid scale, the statistical range has not been completely covered by the target grid scale or there is no finer-grained grid, and the cache data whose statistical range is partially covered by the target grid scale is merged, and the statistical range that is not hit by any grid is merged, and the database is used to calculate the statistical data within the merged statistical range. The cached data is merged with the statistical data to obtain the complete query cache data statistical results.

[0089] like Figure 5 As shown, Figure 5 This is a schematic diagram of the query of vector data statistical information in this embodiment, wherein rectangle 1 indicates the maximum grid scale, 2 refers to the user statistical range, 3 refers to the initial grid scale, 4 is the next-level grid scale of 3, and 5 is the next-level grid scale of 4. The target grid scale in which the user statistical range is completely hit is found by step-by-step reduction, that is, the cached data of the target grid scale that is completely hit can be obtained through query. For those that are not completely hit by any grid, such as those in 2 that are not completely hit by 3, the database can be queried to calculate the statistical data within the range, and merged with the cached data that are completely hit by the target grid to obtain the query result.

[0090] This embodiment counts cached data covered by the initial grid scale as first cached data when the statistical range is not completely covered by the initial grid scale; determines the target grid scale according to the initial grid scale, and obtains second cached data based on the statistical range and the target grid scale when the statistical range is completely covered by the target grid scale; merges the first cached data and the second cached data to obtain a query result; and adopts grids of different scale levels as cache statistical units. When the statistical range is not completely covered by the initial grid scale, the statistical grid scale is expanded, and hit calculation is performed level by level until the statistical range is completely covered by the target grid scale. This embodiment can adapt to statistics of spatial ranges of any scale, improve the hit rate of cached data, and accelerate statistical query efficiency.

[0091] like Figure 5 As shown, Figure 5 It is a flowchart diagram of the fourth embodiment of the vector data statistical information query method of the present invention.

[0092] A fourth embodiment of the vector data statistical information query method of the present invention is proposed based on the first embodiment. The vector data statistical information query method of this embodiment further includes, before step S20:

[0093] Step S21: Obtain the spatial information of the original vector data.

[0094] It should be noted that the original vector data refers to data that has not been divided and cached. The spatial information includes the spatial range and spatial reference information. By obtaining the spatial information of the original vector data, the specific location information of the original vector data can be determined, which facilitates the subsequent positioning and division of the original vector data.

[0095] Step S22: classifying the original vector data according to the spatial information to obtain statistical information of the vector data at each grid scale and the level of each grid scale.

[0096] In a specific implementation, level division refers to multi-scale grid division of the original vector data, dividing the original vector data into several parts according to the division rules, and each grid scale after division corresponds to vector data. According to statistical requirements, the vector data of each cell grid after division is calculated and counted. Obtain statistical information. Further, the step S22 specifically includes: obtaining the minimum bounding rectangle of the original vector data based on the spatial information; obtaining the target number of grids and the target vector data corresponding to the target number of grids according to the minimum bounding rectangle; taking the grid scale of the target number of grids whose granularity and proportion meet the preset requirements as the initial grid scale, and obtaining the statistical information of the vector data corresponding to the initial grid scale; based on the initial grid scale and the statistical information of the vector data corresponding to the initial grid scale, perform level-by-level reduction to generate the statistical information of the vector data of each grid scale and the level of each grid scale.

[0097] It should be understood that the minimum bounding rectangle of the original vector data is obtained through the spatial range and spatial reference of the original vector data, including the minimum rectangle that completely contains the original vector data, and the irregular original vector data is divided into a number of unit data of equal area or equal distance by obtaining the minimum bounding rectangle. The target quantity refers to a number of grids obtained by dividing the vector data based on the quadtree. The original vector data is divided by the minimum bounding rectangle to obtain multiple grid scales and the level of each grid scale, wherein the grids of each scale follow the quadtree relationship, and the levels may be discontinuous. Among them, the vector data in each grid is the target vector data.

[0098] It should be noted that the grid scale whose granularity and scale meet the preset requirements refers to the grid scale with the finest granularity and the largest scale. After the minimum bounding rectangle of the original vector data is divided into multiple grids, the grid scale with the finest granularity and the largest scale is found from the multiple grids as the initial grid scale, and the statistical information of the vector data corresponding to the initial grid scale is obtained by statistics based on the original vector data. According to the initial grid scale and the statistical information of the corresponding vector data, the statistical information of the vector data of each scale grid is generated, and the scale level of each grid is obtained.

[0099] Further, in order to more quickly search for associated vector data, after performing progressive generalization level by level based on the initial grid scale and the statistical information of the vector data corresponding to the initial grid scale to generate the statistical information of the vector data for each grid scale and the levels of each grid scale, the method further includes: obtaining the grids of the associated vector data based on the vector data of each grid scale; obtaining the grid levels of the associated vector data and establishing a parent-child relationship; storing the statistical information of the associated vector data in a database, and establishing a spatial index based on the grid levels.

[0100] It should be understood that after obtaining the levels of each grid scale and the corresponding vector data, the grids associated with the vector data are screened out, and a parent-child relationship is established between the grids of adjacent levels to facilitate subsequent query statistics. A spatial index is established according to the relationship between the statistical information associated with the vector data and the grid levels. When a user needs to perform a query, the relevant spatial index can be directly queried according to the associated statistical information to obtain the statistical vector data.

[0101] Step S23: Store the statistical information of the vector data of each grid scale in a database, and establish a spatial index according to the levels of each grid scale.

[0102] In a specific implementation, when multiple scale grids and corresponding vector data are obtained by dividing according to the original vector data and its spatial information, the vector data of each grid scale is statistically analyzed to obtain the corresponding statistical information, and the statistical information is stored in a database. A spatial index is established according to the scale levels of each grid. When a user needs to query vector data, the query can be directly performed according to the corresponding grid scale level. As Figure 6 shown, Figure 6 This is a schematic diagram of the overall process for the user to query vector data in this embodiment. When a query instruction from the user is obtained, the statistical range of the user is obtained, and the grids of the current level i hit by the statistical range are calculated. The maximum level of the grid scale is n. If the statistical range is completely covered by the current level i and i < n, it means that the range of the grids at level i already completely includes the statistical range at this time. All the cached vector data of the grid scale at the current level i can be merged to obtain the query result. If the statistical range is completely covered by the grid scale at the current level i but i > n, it means that the statistical range at this time is larger than the grid scale range of the maximum level. Then, the vector data covered by the grids at the maximum level n is used as the cached data, and the vector data not covered by the grids at the maximum level n is calculated to obtain the statistical data. The cached data and the statistical data are merged to obtain the statistical result.

[0103] This embodiment obtains spatial information of original vector data; divides the original vector data into levels according to the spatial information to obtain statistical information of vector data of each grid scale and the level of each grid scale; stores the statistical information of vector data of each grid scale in a database, and establishes a spatial index according to the level of each grid scale; divides the grids of the original vector data into levels to obtain statistical information of grids of each level and corresponding vector data and compiles them level by level, stores the statistical information of vector data of each grid level in a database, and establishes a spatial index based on the grid scale level. When a user needs to query data, statistics are performed according to the spatial statistical range, and statistical data can be quickly and accurately found with short time consumption and high concurrency performance.

[0104] Reference Figure 7 , Figure 7 It is a structural block diagram of the first embodiment of the vector data statistical information query device of the present invention.

[0105] like Figure 7 As shown, the vector data statistical information query device proposed in the embodiment of the present invention includes:

[0106] The receiving module 10 is used to determine the statistical range according to the query instruction when receiving the query instruction of the user.

[0107] The determination module 20 is used to determine the corresponding spatial index according to the statistical range.

[0108] The determination module 20 is further configured to query a database based on the corresponding spatial index to determine an initial grid scale.

[0109] The query module 30 is used to query cache data based on the initial grid scale and the statistical range to obtain a query result.

[0110] This embodiment determines the statistical range according to the query instruction when receiving the query instruction of the user; determines the corresponding spatial index according to the statistical range; queries the database based on the corresponding spatial index to determine the initial grid scale; queries the cached data based on the initial grid scale and the statistical range to obtain the query result; determines the statistical range of the user query through the user's query instruction, determines the corresponding spatial index according to the statistical range, queries the database through the spatial index to determine the initial grid scale, queries the database based on the initial grid scale to obtain the effective cached data, can flexibly hit more cached data effectively according to the size of the statistical range, and improves the efficiency of querying the cached data.

[0111] In one embodiment, the query module 30 is further configured to use the cached data of the initial grid scale as the query result when the statistical range is completely covered by the initial grid scale.

[0112] In one embodiment, the query module 30 is further used to count the cache data covered by the initial grid scale as the first cache data when the statistical range is not completely covered by the initial grid scale; determine the target grid scale according to the initial grid scale; when the statistical range is completely covered by the target grid scale, obtain the second cache data based on the statistical range and the target grid scale; merge the first cache data and the second cache data to obtain a query result.

[0113] In one embodiment, the query module 30 is further used to obtain statistical data within the statistical range according to the database calculation when the statistical range is not completely covered by any grid scale; and merge the statistical data with the cached data to obtain the query result.

[0114] In one embodiment, the determination module 20 is also used to obtain spatial information of the original vector data; classify the original vector data according to the spatial information to obtain statistical information of the vector data of each grid scale and the level of each grid scale; store the statistical information of the vector data of each grid scale in a database, and establish a spatial index according to the level of each grid scale.

[0115] In one embodiment, the determination module 20 is also used to obtain the minimum enclosing rectangle of the original vector data based on the spatial information; obtain a target number of grids and target vector data corresponding to the target number of grids according to the minimum enclosing rectangle; use the grid scale in the target number of grids whose granularity and proportion meet preset requirements as the initial grid scale, and obtain statistical information of the vector data corresponding to the initial grid scale; based on the initial grid scale and the statistical information of the vector data corresponding to the initial grid scale, perform level-by-level reduction to generate statistical information of the vector data of each grid scale and the level of each grid scale.

[0116] In one embodiment, the determination module 20 is also used to obtain a grid of associated vector data based on the vector data of each grid scale; obtain the grid level of the associated vector data and establish a parent-child relationship; store the statistical information of the associated vector data in a database, and establish a spatial index based on the grid level.

[0117] In addition, to achieve the above-mentioned purpose, the present invention also proposes a vector data statistical information query device, which includes: a memory, a processor, and a vector data statistical information query program stored in the memory and executable on the processor, and the vector data statistical information query program is configured to implement the steps of the vector data statistical information query method described above.

[0118] Since the vector data statistical information query device adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.

[0119] In addition, an embodiment of the present invention further proposes a storage medium, on which a vector data statistical information query program is stored. When the vector data statistical information query program is executed by a processor, the steps of the vector data statistical information query method described above are implemented.

[0120] Since the storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.

[0121] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.

[0122] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0123] In addition, for technical details that are not described in detail in this embodiment, reference can be made to the vector data statistical information query method provided in any embodiment of the present invention, and will not be repeated here.

[0124] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0125] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0126] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0127] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A vector data statistical information query method, characterized in that: The vector data statistical information query method comprises: Upon receiving a query instruction from a user, determining a statistical range according to the query instruction; Determine a corresponding spatial index according to the statistical range; Querying a database based on the corresponding spatial index to determine an initial grid scale; When the statistical range is completely covered by the initial grid scale, using the cached data of the initial grid scale as the query result; When the statistical range is not completely covered by the initial grid scale, counting the cache data covered by the initial grid scale as the first cache data; Determining a target grid scale according to the initial grid scale; When the statistical range is completely covered by the target grid scale, obtaining second cache data based on the statistical range and the target grid scale; Merging the first cache data and the second cache data to obtain a query result; When the statistical range is not completely covered by any grid scale, statistical data within the statistical range is calculated according to the database; The statistical data is combined with the cached data to obtain a query result.

2. The vector data statistical information query method according to claim 1, characterized in that: Before determining the corresponding spatial index according to the statistical range, the method further includes: Get the spatial information of the original vector data; Classifying the original vector data according to the spatial information to obtain statistical information of the vector data at each grid scale and the level of each grid scale; The statistical information of the vector data of each grid scale is stored in a database, and a spatial index is established according to the level of each grid scale.

3. The vector data statistical information query method according to claim 2, characterized in that: The step of classifying the original vector data according to the spatial information to obtain statistical information of the vector data at each grid scale and the level of each grid scale includes: Obtaining a minimum bounding rectangle of the original vector data based on the spatial information; Obtaining a target number of grids and target vector data corresponding to the target number of grids according to the minimum circumscribed rectangle; The grid scale whose granularity and proportion meet the preset requirements in the target number of grids is taken as the initial grid scale, and the statistical information of the vector data corresponding to the initial grid scale is obtained; Based on the initial grid scale and the statistical information of the vector data corresponding to the initial grid scale, the scale is reduced level by level to generate the statistical information of the vector data of each grid scale and the level of each grid scale.

4. The vector data statistical information query method according to claim 3, characterized in that: After the statistical information of the vector data corresponding to the initial grid scale and the vector data corresponding to the initial grid scale is reduced level by level to generate the statistical information of the vector data of each grid scale and the level of each grid scale, the method further includes: Obtaining a grid of associated vector data based on the vector data of each grid scale; Get the grid level of the associated vector data and establish the parent-child relationship; The statistical information of the associated vector data is stored in a database, and a spatial index is established based on the grid level.

5. A vector data statistical information query device, characterized in that: The vector data statistical information query device comprises: A receiving module, configured to determine a statistical range according to a query instruction received from a user; A determination module, used to determine a corresponding spatial index according to the statistical range; The determination module is further used to query the database based on the corresponding spatial index to determine the initial grid scale; A query module is used to use the cached data of the initial grid scale as the query result when the statistical range is completely covered by the initial grid scale; when the statistical range is not completely covered by the initial grid scale, count the cached data covered by the initial grid scale as the first cached data; determine the target grid scale according to the initial grid scale; when the statistical range is completely covered by the target grid scale, obtain the second cached data based on the statistical range and the target grid scale; merge the first cached data and the second cached data to obtain the query result; when the statistical range is not completely covered by any grid scale, obtain statistical data within the statistical range according to the database calculation; merge the statistical data with the cached data to obtain the query result.

6. A vector data statistical information query device, characterized in that: The vector data statistical information query device includes: a memory, a processor, and a vector data statistical information query program stored in the memory and executable on the processor, wherein the vector data statistical information query program is configured to implement the vector data statistical information query method according to any one of claims 1 to 4.

7. A storage medium, characterized in that: The storage medium stores a vector data statistical information query program, and when the vector data statistical information query program is executed by the processor, the vector data statistical information query method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Power grid equipment vector data query method and device, computer equipment and medium

    CN113010570A