Beidou grid spatial indexing and retrieval method and device based on database B-tree index
Through the Beidou grid spatial index and search method based on database B-tree index, the problems of data accuracy and retrieval performance of existing spatial databases are solved, and efficient and resource-saving spatial data management and retrieval are realized.
Patent Information
- Application Number
- CN202111143727.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-28
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-09-28
AI Technical Summary
The existing spatial database has many problems in data accuracy and massive data retrieval performance, including inconsistent grid coding and hierarchical field storage, inconvenient management of non-point elements and grid relationships, large redundant IO inside and outside the database, wasted computing resources and low retrieval efficiency.
The Beidou grid spatial index and search method based on the database B-tree index is adopted. By receiving the target spatial range data and query accuracy, the grid level is determined, the grid collection is generated, and the brother grid is determined, and the associated data is summarized to achieve efficient spatial retrieval across levels.
While saving computing resources, it improves the efficiency of space retrieval, reduces data redundancy, and makes full use of the parallel computing capabilities of the database.
Smart Images

Figure CN114048203B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure generally relate to the field of geographic information processing technology, and more specifically, to a Beidou grid spatial indexing and retrieval method and apparatus based on database B-tree index. Background Art
[0002] With the rapid development of information technology and the reduction in the cost of acquiring satellite remote sensing and satellite navigation data, the requirements for the storage, management and retrieval of massive spatial data are becoming increasingly higher.
[0003] Spatial databases have made significant progress in the past 20 years, with the emergence of numerous excellent relational spatial database products both domestically and internationally, such as Oracle Spatial and PostGIS. These databases generally use a geometry data model consisting of coordinates or coordinate sequences, and their spatial indexes generally employ R-Tree indexes. However, traditional spatial geometry data models and spatial indexes have numerous issues with data accuracy and retrieval performance for massive amounts of data.
[0004] In existing databases, grid codes and hierarchical field storage are used, which hinders data encapsulation and consistency. Non-point features and grids have a one-to-many relationship, making data management inconvenient. Data is stored in the database and computed outside the database, resulting in multiple data inflows and outflows, leading to a large amount of redundant I / O. Furthermore, computation outside the database fails to fully utilize the database's parallel computing capabilities. Furthermore, when using existing data for spatial retrieval, networks of different hierarchies must be constructed based on the required retrieval accuracy, resulting in a significant amount of data redundancy. Furthermore, when the retrieval accuracy requirements change, the grid codes must be regenerated based on the retrieval grid's hierarchy, resulting in a waste of computing resources and impacting retrieval efficiency. Summary of the Invention
[0005] According to an embodiment of the present disclosure, a Beidou grid spatial indexing and retrieval solution based on database B-tree index is provided, which can save computing resources while improving spatial retrieval efficiency.
[0006] In a first aspect of the present disclosure, a Beidou grid spatial indexing and retrieval method based on a database B-tree index is provided, comprising:
[0007] Receive target spatial range data to be queried and query accuracy, wherein the target spatial range data is WTK data in a GIS standard format;
[0008] Determining a first grid level corresponding to the target spatial range according to the query accuracy;
[0009] Determine the Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generate a grid set;
[0010] For each Beidou subdivision grid in the grid set, determining its sibling grid;
[0011] The data associated with the descendant grids of the second grid level of the Beidou subdivision grid and its corresponding brother grid that intersects the target query range are aggregated to generate a query result.
[0012] In some embodiments, determining the first grid level corresponding to the target spatial range according to the query accuracy includes:
[0013] The corresponding first grid level is determined from a pre-stored accuracy table according to the query accuracy, wherein the query accuracy is a distance accuracy, and the accuracy table stores distance values corresponding to different grid levels.
[0014] In some embodiments, determining a Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generating a grid set, includes:
[0015] Determine the minimum circumscribed rectangle of the boundary of the target space range, verify whether the Beidou subdivision grid of the first grid level in the minimum circumscribed rectangle intersects with the boundary of the target space range or is located within the target space range, and summarize the Beidou subdivision grids that intersect with the boundary of the target space range or are located within the target space range to generate a grid set.
[0016] In some embodiments, the target space range data includes line type data, surface type data, and volume type data.
[0017] In some embodiments, the coordinate information in the relational database is stored in the form of a grid cell, and the grid cell is stored based on the tb_location table. The tb_location table includes the latitude and longitude and elevation fields of the coordinate system and the grid field, wherein the grid field includes the level field level, the longitude and latitude segmentation code field code and the elevation segmentation code field zcode.
[0018] In some embodiments, the method further includes a data storage process, specifically including:
[0019] Receive attribute information and position coordinate information of the user terminal, store the position coordinate information in the form of a grid cell, and add a pointer in the grid cell to point to the attribute information.
[0020] In some embodiments, determining a sibling grid for each Beidou subdivision grid code in the grid set includes:
[0021] For each Beidou subdivision grid code in the grid set, a grid with the same Beidou subdivision grid code as the first 2(n-1) bits is taken as its sibling grid, where n is the level of the Beidou subdivision grid code in the grid set.
[0022] In a second aspect of the present disclosure, a Beidou grid spatial indexing and retrieval device based on a database B-tree index is provided, comprising:
[0023] A data receiving module is used to receive target spatial range data to be queried and query accuracy, wherein the target spatial range data is WTK data in a GIS standard format;
[0024] A grid level determination module, configured to determine a first grid level corresponding to a target spatial range according to the query accuracy;
[0025] A grid set generation module is used to determine the Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generate a grid set;
[0026] A sibling grid determination module, configured to determine a sibling grid for each Beidou subdivision grid in the grid set;
[0027] The query result generating module is used to summarize the data associated with the descendant grids of the second grid level of the Beidou subdivision grid and its corresponding brother grid that intersects the target query range, and generate a query result.
[0028] In a third aspect of the present disclosure, an electronic device is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the program.
[0029] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0030] The spatial range query method based on the relational database disclosed in the present invention can perform spatial retrieval according to the requirements of retrieval accuracy, thereby improving spatial retrieval efficiency while saving computing resources.
[0031] It should be understood that the contents described in the Summary of the Invention section are not intended to limit the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:
[0033] Figure 1 A flowchart of a Beidou grid spatial indexing and retrieval method based on a database B-tree index according to a first embodiment of the present disclosure is shown;
[0034] Figure 2 A flowchart of a method for generating a spatial database based on a Beidou grid relational database according to a second embodiment of the present disclosure is shown;
[0035] Figure 3 A schematic diagram of the structure of a Beidou grid spatial indexing and retrieval device based on a database B-tree index according to a third embodiment of the present disclosure is shown;
[0036] Figure 4 A structural diagram of a Beidou grid spatial indexing and retrieval device based on database B-tree index according to a fourth embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0037] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present disclosure.
[0038] In this document, the term "and / or" simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the related objects are in an "or" relationship.
[0039] The Beidou grid spatial indexing and retrieval method based on database B-tree index in the embodiment of the present disclosure can perform spatial retrieval according to the requirements of retrieval accuracy, while saving computing resources and improving spatial retrieval efficiency. Figure 1 The figure is a flowchart of the Beidou grid spatial indexing and retrieval method based on database B-tree index according to the first embodiment of the present disclosure. Figure 1 As can be seen from the figure, the Beidou grid spatial indexing and retrieval method based on database B-tree index in this embodiment may include the following steps:
[0040] S101: Receive target spatial range data to be queried and query accuracy, wherein the target spatial range data is WTK data in a GIS standard format.
[0041] Spatial databases are commonly used to store spatial data. With the development of Beidou grid code technology, traditional spatial databases generate grid codes from longitude and latitude coordinates during spatial retrieval, associating the grid codes with location data. Depending on the accuracy of the location data and the scale of the spatial query, it is necessary to associate different levels of grids with each location coordinate data, resulting in a large amount of data redundancy. Furthermore, existing spatial databases generally do not support spatial retrieval across grid levels. Therefore, when the retrieval accuracy changes, the grid code needs to be regenerated based on the level of the retrieval grid, which is inflexible and wastes computing resources. During a query, the query's spatial range is converted into a grid set, and then the location data associated with each grid in the set is retrieved from the database. In other words, when querying, the same spatial coordinates at different levels need to be queried separately.
[0042] In the method of this embodiment, however, there is no need to perform separate queries for the same spatial coordinates at different levels. Specifically, the storage structure of the spatial database in the embodiment of the present disclosure is different from that of existing databases. The storage structure of existing spatial databases is usually Geometry (longitude and latitude coordinate implementation model). In Geometry, one coordinate is used to represent a ground point, and multiple coordinate sequences are used to represent lines, surfaces or bodies. Since ordinary spatial databases do not have a dedicated data model for Beidou grid subdivision coding, they do not provide generation, conversion, calculation, and analysis functions for the grid subdivision code model, nor do they provide spatial indexes based on the grid subdivision code model.
[0043] The spatial database of this embodiment can be based on a relational database, and the coordinate information in the relational database can be converted into Beidou segmentation code. The converted Beidou segmentation code consists of two parts: grid code and grid level. The grid code is used to represent the geographic location, and the grid level is used to express the grid granularity. Ordinary relational spatial databases do not have a dedicated storage model for Beidou segmentation code. In actual application, the grid code and grid need to be stored separately; for lines and polygons, one Geometry corresponds to multiple grid codes, and the relationship between multiple grid codes and one Geometry needs to be maintained in the database.
[0044] In this embodiment, when constructing the spatial database of the embodiment of the present disclosure, you can refer to Figure 2 The flowchart of the method for generating a spatial database based on a relational database specifically includes the following steps:
[0045] S201: Acquire two-dimensional coordinate information or three-dimensional coordinate information in a relational database, wherein the two-dimensional coordinate information or three-dimensional coordinate information is stored in the relational database in the form of a tb_location table.
[0046] First, two-dimensional coordinate information or three-dimensional coordinate information is obtained from a relational database, wherein the two-dimensional coordinate information or three-dimensional coordinate information is stored in the relational database in the form of a tb_location table.
[0047] S202: Determine the level of the corresponding Beidou grid subdivision code according to the actual application scenario of the two-dimensional coordinate information or the three-dimensional coordinate information, and generate a corresponding level field level.
[0048] After obtaining the two-dimensional coordinate information or three-dimensional coordinate information from the relational database, it is necessary to further determine the level of the corresponding Beidou grid code and generate the corresponding level field.
[0049] S203: Convert the two-dimensional coordinate information or the three-dimensional coordinate information into a Beidou grid code of a corresponding level, and generate a corresponding latitude and longitude grid code field code and an elevation grid code field zcode.
[0050] S204: Encapsulate the level field level, the latitude and longitude segmentation code field code, and the elevation segmentation code field zcode into the same field grid, and store the field grid in the tb_location table corresponding to the two-dimensional coordinate information or the three-dimensional coordinate information in the relational database to generate a grid cell gridcell.
[0051] The gridcell is a composite type used to represent a 2D or 3D grid cell in the Beidou grid. A 2D or 3D grid cell represents coordinate information in relational data. Beidou grids are divided into 2D and 3D grids. 2D grids are divided into binary tilings based on latitude and longitude, then combined into a one-dimensional binary code using Morton coding. Grid levels range from 1 to 32, each represented by two bits. A 64-bit unsigned long integer can store 32 levels of 2D codes. 3D grids, based on 2D grids, also add elevation codes. The elevation code ranges from 1 to 32, with each level represented by one bit. A 32-bit unsigned int can store 32 levels of elevation codes. Levels range from 1 to 32, and unsigned char can be used to store levels. Because gridcell is compatible with both 2D and 3D grids, a type flag, dim, is specified to distinguish between 2D and 3D grids.
[0052] To summarize, the structure of the gridcell data type is as follows:
[0053]
[0054] The variables in the structure are as follows:
[0055]
[0056] Regardless of whether it is a 32-bit operating system or a 64-bit operating system, after memory alignment, a gridcell object occupies 16 bytes of memory space.
[0057] The two-dimensional and three-dimensional gridcell generation functions are implemented respectively, and their prototypes are as follows:
[0058] gridcell ST_AsGridcell(double lng,double lat,integer level)
[0059] gridcell ST_AsGridcell3D(double lng,double lat,double height,integerlevel)
[0060] Taking ST_AsGridcell3D as an example, the calculation steps are explained:
[0061] 1. tb_location is a table in a relational database, where lng, lat, and height are the coordinates of longitude, latitude, and elevation, respectively.
[0062] 2. Add a field named grid in the tb_location table, and the field type is gridcell
[0063] 3. Determine the grid level based on business needs
[0064] 4. Update the grid field in tb_location using the update statement.
[0065] Update tb_location set grid=st_AsGridcell(lng,lat,height,level).
[0066] 5. Inside st_AsGridcell, for each set of input lng, lat, height, and level, the Beidou gridding algorithm is used to generate the corresponding longitude and latitude code and elevation code. The code and level are encapsulated together as a gridcell object and returned.
[0067] 6. The Update statement serializes each gridcell object and writes it to the grid field
[0068] 7. Loop until all rows in the table are executed.
[0069] The above method can convert coordinate information in a relational database into Beidou grid code for storage. The Beidou grid code coordinate information is then encapsulated with the original coordinate information in the relational database, ensuring data encapsulation and consistency, facilitating data management, and enabling the conversion of coordinate information encoding within the database, thereby fully utilizing the database's parallel computing capabilities.
[0070] The target spatial range data in this embodiment is WTK data in the GIS standard format. WTK data is the standard language of GIS and will not be described in detail here.
[0071] S102: Determine a first grid level corresponding to the target spatial range according to the query accuracy.
[0072] When it is necessary to perform spatial retrieval using the spatial database of the embodiment of the present disclosure, first, the first grid level corresponding to the target spatial range is determined according to the query accuracy of the target spatial range data.
[0073] In this embodiment, after the coordinate information in the relational database is converted into the form of Beidou grid code for storage, the association between different levels of grids and each position coordinate data can be established according to the actual application scenario. For example, for the same set of Beidou terminal location data, if it is necessary to retrieve data at scales of 30 kilometers, 1 kilometer, and 100 meters respectively in the application scenario, it is necessary to create three fields of type bigint with field names grid11, grid16, and grid19, and calculate the integer grid codes corresponding to levels 11, 16, and 19 of each coordinate data and store them therein, where grid11, grid16, and grid19 are fields representing the grid level. Of course, in some other embodiments of the present disclosure, grid codes of other levels corresponding to the coordinate data can also be calculated.
[0074] S103: Determine a Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generate a grid set.
[0075] In this embodiment, after determining the grid level corresponding to the target spatial range, a Beidou subdivision grid code that is also at the first grid level and intersects the target spatial range can be further determined. For example, if the grid level corresponding to the target spatial range is grid11, a Beidou subdivision grid is determined in the grid level of grid11 to generate a grid set.
[0076] In this embodiment, the target space range is usually represented by the coordinates of continuous points on the boundary of the target space range. When determining the Beidou subdivision grid code whose grid level is also the first grid level and intersects with the target space range, the minimum circumscribed rectangle of the boundary of the target space range can be determined, and it is verified whether the Beidou subdivision grid with the level of the first grid level in the minimum circumscribed rectangle intersects with the boundary of the target space range or is located within the target space range. The Beidou subdivision grids that intersect with the boundary of the target space range or are located within the target space range are summarized to generate a grid set.
[0077] S104: For each Beidou subdivision grid in the grid set, determine its sibling grid.
[0078] In this embodiment, after determining that the Beidou subdivision grid with the first grid level and intersecting with the target spatial range is generated, a grid set is generated. Then, for each Beidou subdivision grid in the generated grid set, its sibling grid is determined. The following is a specific example to illustrate the relationship between grids. A and B are two 8-level grids. Grid B is the subsequent sibling grid of grid A (the value of the first 16 bits of grid B's code is only 1 greater than the first 16 bits of grid A). Aa, Ab, Ac, and Ad are all 9-level grids and are all descendant grids of A. The six grids are numbered as follows:
[0079] CodeA: 10111000110101010000000000000000000000000000000000000000000
[0081] CodeB: 101110001101011000000000000000000000000000000000000000000000
[0083] CodeAa: 10111000110101010000000000000000000000000000000000000000000
[0085] CodeAb: 101110001101010101000000000000000000000000000000000000000000
[0087] CodeAc: 101110001101010110000000000000000000000000000000000000000000
[0089] CodeAd: 101110001101010111000000000000000000000000000000000000000000
[0091] From the grid coding, we can see that the grid coding ranges of Aa, Ab, Ac, and Ad are within the interval [codeA, codeB). In other words, the larger the level of a unit grid, the smaller the spatial area it represents. The spatial ranges of all descendant grids of a unit grid are included in the range of this grid. The value range of the integer code of a descendant grid of a grid cellA is: [codeA, codeB), where codeA is the integer code of A, and codeB is the integer code of A's subsequent sibling grid B. Grid A is the ancestor of grids Aa, Ab, Ac, and Ad, and grids Aa, Ab, Ac, and Ad are the descendants of grid A. Based on the above theory, using the ancestor grid to query the descendant grid is converted into an interval query of [codeA, codeB).
[0092] Predefine the B-tree index in the spatial database. First, define the gridcell comparison function GridcellAbsCmp. The main logic is as follows: if the integer codes of two gridcells are not equal, the gridcell with the smaller integer code is smaller; if the integer codes of two gridcells are equal and the two levels are not equal, the gridcell with the smaller level is smaller; if the integer codes of two gridcells are equal and the two levels are equal, the two gridcells are equal.
[0093] Create the operator class btree_gridcell_ops, register the B-tree index for the gridcell type, and specify the size comparison function GridcellAbsCmp(gridcell,gridcell).
[0094]
[0095] Gridcell implements B-tree indexing and cross-level grid indexing. Therefore, based on this solution, there is no need to generate grids of multiple precisions when storing data.
[0096] Data warehousing process:
[0097] 1. tb_location is a table in a relational database, where lng, lat, and height are the coordinates of longitude, latitude, and elevation, respectively.
[0098] 2. Add a field named grid in the tb_location table, and the field type is gridcell
[0099] 3. Based on the query requirements, determine the grid level (maxLevel) corresponding to the highest query accuracy.
[0100] 4. Call the SQL update statement, generate the gridcell function through the longitude and latitude, and build the gridcell object.
[0101] Update tb_location set grid=st_AsGridcell(lng,lat,height,level).
[0102] 5. The Update statement serializes each gridcell object and writes it to the grid field
[0103] 6. Loop until all rows in the table are executed.
[0104] During the query process, the sibling grids of each Beidou subdivision grid code in the grid set can be determined based on the defined B-tree index.
[0105] S105: Summarize the data associated with the descendant grids of the second grid level of the Beidou subdivision grid code and its corresponding brother grid that intersects the target query range to generate a query result.
[0106] In this embodiment, the descendant grids of the second grid level of the grid of the first grid level are associated with data, such as taxis, corresponding services, and platforms associated with a descendant grid of the second grid level. Since taxis can report information through the Beidou system, other information about taxis can be associated with the grids of the second grid level corresponding to their location information. In one application scenario, when querying how many taxis are within a target area, the query can be performed in the above manner. Since the query is about taxis, the query accuracy can be determined based on the actual operation of taxis. For example, the minimum grid level corresponding to the area of the taxi itself is then determined. The minimum grid level parent grid corresponding to the area of the taxi itself, that is, the grid of the first grid level, is then determined. By determining the sibling grids of the grid of the first grid level, the data of taxis associated with the descendant grids of the grid level of the first grid level is determined, thereby determining how many taxis are within the target area. The minimum grid level corresponding to the area of the taxi itself is the second grid level.
[0107] The Beidou grid spatial indexing and retrieval method based on database B-tree index in the embodiment of the present disclosure can perform spatial retrieval according to the requirements of retrieval accuracy, thereby improving spatial retrieval efficiency while saving computing resources.
[0108] In addition, in some embodiments, determining the first grid level corresponding to the target spatial range based on the query accuracy includes: determining the corresponding first grid level from a pre-stored accuracy table based on the query accuracy, wherein the query accuracy is a distance accuracy, and the accuracy table stores distance values corresponding to different grid levels.
[0109] In some embodiments, the target space range data includes line type data, surface type data, and volume type data.
[0110] In some embodiments, the method further comprises:
[0111] For surface type data and volume type data, determine the value range of the Beidou subdivision grid code of latitude, longitude and elevation after the WTK data of each point on each boundary line is converted into the Beidou subdivision grid code, and use the Beidou subdivision grid code within the value range as the Beidou subdivision grid code covering the target spatial range.
[0112] As another embodiment of the present disclosure, in the above embodiment, when determining the sibling grid of each Beidou subdivision grid code in the grid set, the determination may be performed according to the following method:
[0113] For each Beidou subdivision grid in the grid set, the grid with the same first 2(n-1) bits of the Beidou subdivision grid code is taken as its sibling grid, where n is the level of the Beidou subdivision grid code in the grid set.
[0114] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
[0115] The above is an introduction to the method embodiment. The following is a further explanation of the solution disclosed in the present disclosure through an apparatus embodiment.
[0116] like Figure 3The figure is a schematic diagram of the structure of the Beidou grid spatial index and retrieval device based on the database B-tree index according to the third embodiment of the present disclosure. The Beidou grid spatial index and retrieval device based on the database B-tree index according to this embodiment includes:
[0117] The data receiving module 301 is used to receive target spatial range data to be queried and query accuracy, wherein the target spatial range data is WTK data in a GIS standard format.
[0118] The grid level determination module 302 is configured to determine a first grid level corresponding to the target spatial range according to the query accuracy.
[0119] The grid set generation module 303 is configured to determine a Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generate a grid set.
[0120] The sibling grid determination module 304 is configured to determine a sibling grid for each Beidou subdivision grid in the grid set.
[0121] The query result generating module 305 is configured to aggregate data associated with descendant grids of the second grid level of the Beidou subdivision grid and its corresponding sibling grid that intersects the target query range, and generate a query result.
[0122] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the described module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0123] Figure 4 A schematic block diagram of an electronic device 400 that can be used to implement the embodiment method of the present disclosure is shown. As shown in the figure, 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 402 or loaded from a storage unit 408 into a random access memory (RAM) 403. In RAM 403, various programs and data required for the operation of device 400 can also be stored. CPU 401, ROM 402 and RAM 403 are connected to each other via a bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0124] Various components in device 400 are connected to I / O interface 405, including an input unit 406, such as a keyboard, mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a magnetic disk, optical disk, etc.; and a communication unit 409, such as a network card, modem, wireless communication transceiver, etc. Communication unit 409 allows device 400 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0125] The processing unit 401 performs the various methods and processes described above and is tangibly embodied in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of a computer program may be loaded and / or installed onto the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the CPU 401, one or more steps of the methods described above may be performed. Alternatively, in other embodiments, the CPU 401 may be configured to perform the above methods in any other suitable manner (e.g., via firmware).
[0126] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), and the like.
[0127] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0128] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0129] In addition, although adopting specific order to describe each operation, this should be understood as requiring such operation to be carried out in the specific order shown or in sequential order, or requiring that all illustrated operations should be carried out to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although comprising some specific implementation details in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation also can be implemented in a plurality of implementations individually or in the mode of any suitable subcombination.
[0130] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A Beidou grid spatial indexing and retrieval method, characterized in that: include: Receive target spatial range data to be queried and query accuracy, wherein the target spatial range data is WTK data in a GIS standard format; Determining a first grid level corresponding to the target spatial range according to the query accuracy; Determine the Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generate a grid set; For each Beidou subdivision grid in the grid set, determining its sibling grid; Summarize the data associated with the descendant grids of the second grid level of the Beidou subdivision grid and its corresponding brother grid that intersects the target spatial range to generate a query result; Beidou grid spatial indexing and retrieval uses a spatial database based on a relational database, which is constructed in the following way: Acquire two-dimensional coordinate information or three-dimensional coordinate information from a relational database, wherein the two-dimensional coordinate information or three-dimensional coordinate information is stored in the relational database in the form of a tb_location table; Determine the level of the corresponding Beidou grid code according to the actual application scenario of the two-dimensional coordinate information or the three-dimensional coordinate information, and generate the corresponding level field level; Convert the two-dimensional coordinate information or three-dimensional coordinate information into the Beidou grid code of the corresponding level, and generate the corresponding latitude and longitude grid code field code and elevation grid code field zcode; The level field level, the latitude and longitude segmentation code field code and the elevation segmentation code field zcode are encapsulated into the same field grid, and the field grid is stored in the tb_location table corresponding to the two-dimensional coordinate information or the three-dimensional coordinate information in the relational database to generate a grid cell gridcell.
2. The Beidou grid spatial indexing and retrieval method according to claim 1, characterized in that: Determining the first grid level corresponding to the target spatial range according to the query accuracy includes: The corresponding first grid level is determined from a pre-stored accuracy table according to the query accuracy, wherein the query accuracy is a distance accuracy, and the accuracy table stores distance values corresponding to different grid levels.
3. The Beidou grid spatial indexing and retrieval method according to claim 2, characterized in that: The step of determining a Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generating a grid set, includes: Determine the minimum circumscribed rectangle of the boundary of the target space range, verify whether the Beidou subdivision grid of the first grid level in the minimum circumscribed rectangle intersects with the boundary of the target space range or is located within the target space range, and summarize the Beidou subdivision grids that intersect with the boundary of the target space range or are located within the target space range to generate a grid set.
4. The Beidou grid spatial indexing and retrieval method according to claim 3, characterized in that: The target space range data includes line type data, surface type data and volume type data.
5. The Beidou grid spatial indexing and retrieval method according to claim 4, characterized in that: The method also includes a data storage process, specifically including: Receive attribute information and position coordinate information of the user terminal, store the position coordinate information in the form of a grid cell, and add a pointer in the grid cell to point to the attribute information.
6. The Beidou grid spatial indexing and retrieval method according to claim 5, characterized in that: For each Beidou subdivision grid in the grid set, determining its sibling grid includes: For each Beidou subdivision grid in the grid set, the grid with the same first 2(n-1) bits of the Beidou subdivision grid code is taken as its sibling grid, where n is the level of the Beidou subdivision grid code in the grid set.
7. A Beidou grid spatial indexing and retrieval device, characterized in that: include: A data receiving module is used to receive target spatial range data to be queried and query accuracy, wherein the target spatial range data is WTK data in a GIS standard format; A grid level determination module, configured to determine a first grid level corresponding to a target spatial range according to the query accuracy; A grid set generation module is used to determine the Beidou subdivision grid whose grid level is the first grid level and intersects with the target spatial range, and generate a grid set; A sibling grid determination module, configured to determine a sibling grid for each Beidou subdivision grid in the grid set; A query result generating module, configured to aggregate data associated with descendant grids of the second grid level of the Beidou subdivision grid and its corresponding sibling grid that intersects the target spatial range, and generate a query result; Beidou grid spatial indexing and retrieval uses a spatial database based on a relational database, which is constructed in the following way: A spatial database based on a relational database is constructed in the following ways: Acquire two-dimensional coordinate information or three-dimensional coordinate information from a relational database, wherein the two-dimensional coordinate information or three-dimensional coordinate information is stored in the relational database in the form of a tb_location table; Determine the level of the corresponding Beidou grid code according to the actual application scenario of the two-dimensional coordinate information or the three-dimensional coordinate information, and generate the corresponding level field level; Convert the two-dimensional coordinate information or three-dimensional coordinate information into the Beidou grid code of the corresponding level, and generate the corresponding latitude and longitude grid code field code and elevation grid code field zcode; The level field level, the latitude and longitude segmentation code field code and the elevation segmentation code field zcode are encapsulated into the same field grid, and the field grid is stored in the tb_location table corresponding to the two-dimensional coordinate information or the three-dimensional coordinate information in the relational database to generate a grid cell gridcell.
8. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Beidou position stream data real-time space aggregation method
CN111353008A