Method and device for processing grid spatio-temporal data
By introducing dynamic grid linked lists and real-time data update mechanisms into the H3 grid system, the problem that static H3 grids are difficult to provide real-time traffic query is solved, and efficient and real-time traffic data query services are achieved.
Patent Information
- Application Number
- CN202411753234.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-02
AI Technical Summary
Due to the static nature of the existing H3 grid system, it is difficult to provide real-time traffic query services.
By replacing the static data in the traditional H3 grid with a dynamic grid linked list, adding information of the time dimension, thereby building a dynamic H3 grid. This solution includes storing the H3 grid hash table in a distributed database, and performing queue record scrolling addition of the grid linked list at preset scroll intervals, and updating the grid object based on real-time traffic feedback.
It realizes the real-time traffic query service for users, and improves the real-timeness of grid data and the real-timeness of query services.
Smart Images

Figure CN119690968A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a method and device for processing grid spatiotemporal data. Background Art
[0002] The H3 grid system divides the geographic space into a series of uniformly sized and regularly shaped grid units through a hexagonal grid design, and provides a hierarchical management function, that is, a higher-level grid can contain multiple lower-level grids, thereby achieving step-by-step sharding / partitioning by building a grid hierarchy. This division method not only simplifies the storage and management of spatial data, but also improves the efficiency of spatial query and analysis. Intelligent transportation systems can use these grid units to accurately organize and store traffic data, such as vehicle location, traffic flow, road conditions, etc., so as to achieve rapid access and processing of traffic data. However, most of the commonly used H3 grids are static grids. The so-called static grid means that the grid unit data does not have a time dimension and has poor real-time performance. It is difficult to provide users with real-time traffic query services based on static H3 grids.
[0003] To solve this problem, we replace the static data in the traditional H3 grid with a grid linked list that can be continuously scrolled and refreshed, so as to add time dimension information to the grid unit. Based on the dynamic H3 grid we provide, we can provide users with real-time traffic query services. The technical solution provided by the present invention is also the spatiotemporal data design scheme of this dynamic H3 grid and the corresponding spatiotemporal data refresh and query scheme. Summary of the invention
[0004] The purpose of the present invention is to provide a grid spatiotemporal data processing method, device, electronic device and computer-readable storage medium for the defects of the prior art. The present invention divides the designated road network area into grids according to the H3 grid format to obtain the corresponding first grid network, and counts the total number of H3 grids at the bottom of the first grid network to obtain the corresponding total number of grids N, and creates a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table, and stores the H3 grid hash table based on a type of distributed database; and performs queue record rolling addition processing on all grid linked lists of the H3 grid hash table according to a preset rolling interval △t, and performs grid object update processing on the H3 grid hash table based on the real-time traffic feedback of the designated road network area; and when receiving the traffic information query instruction input by the user, the H3 grid hash table is queried for grid spatiotemporal data based on the traffic information query instruction and the traffic information is analyzed based on the query result to obtain the corresponding instruction feedback data and feedback to the current user. The grid spatiotemporal data design scheme and the corresponding spatiotemporal data refresh and query scheme provided by the present invention can build a dynamic H3 grid, and can provide users with real-time query services, thereby achieving the purpose of improving the real-time performance of grid data and query services.
[0005] To achieve the above object, a first aspect of an embodiment of the present invention provides a method for processing grid spatiotemporal data, the method comprising:
[0006] Step 1: grid the designated road network area according to the H3 grid format to obtain a corresponding first grid network; and count the total number of H3 grids at the bottom of the first grid network to obtain the corresponding total number of grids N; and create a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table; and store the H3 grid hash table based on a distributed database;
[0007] Wherein, the first grid network includes N first grids; each of the first grids is a bottom-level H3 grid; each of the first grids corresponds to a grid identifier S; the H3 grid hash table includes N grid key-value pairs; the grid key-value pairs correspond to the first grids one by one; the key field of the grid key-value pairs is the corresponding grid identifier S, and the value field is the corresponding grid linked list; each grid linked list is a first-in-first-out circular queue linked list with a fixed queue size, and is composed of queue records with a preset total number of queue records M; the queue record is composed of a corresponding timestamp T and a grid object set; the distributed database at least includes a Redis database;
[0008] Step 2, performing a queue record rolling addition process on all the grid linked lists of the H3 grid hash table at a preset rolling interval Δt; and performing a grid object update process on the H3 grid hash table based on the real-time traffic feedback of the designated road network area;
[0009] Step 3, upon receiving a traffic information query instruction input by a user, performing a grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction and performing traffic information analysis based on the query result to obtain corresponding instruction feedback data to feed back to the current user;
[0010] Among them, the traffic information query instruction includes a query period, a query type and a query parameter; the query type includes at least a traffic participant trajectory query, a vehicle flow statistics query and a sub-grid network query; when the query type is a traffic participant trajectory query, the query parameter is a query object identifier; when the query type is a vehicle flow statistics query, the query parameter is a query grid identifier; when the query type is a sub-grid network query, the query parameter is a clockwise / counterclockwise vertex coordinate sequence of an irregular ground area, and the clockwise / counterclockwise vertex coordinate sequence is formed by sequentially sorting the coordinates of multiple regional vertices in a clockwise / counterclockwise order.
[0011] Preferably, the time difference between the timestamp T of each queue record and the previous or next queue record matches the rolling interval Δt;
[0012] When the grid object set is empty, it means that at the time point corresponding to the current timestamp T, there is no traffic participant in motion in the current first grid; the types of traffic participants include at least motor vehicles, non-motor vehicles and pedestrians;
[0013] When the grid object set is not empty, it is composed of one or more grid objects P; each of the grid objects P corresponds to a traffic participant that is in motion within the current first grid at a time point corresponding to the current timestamp T; the grid object P includes an object identifier, an object type and an object coordinate; the object type includes at least motor vehicles, non-motor vehicles and pedestrians.
[0014] Preferably, the rolling addition process of queue records to all the grid linked lists of the H3 grid hash table according to a preset rolling interval Δt specifically includes:
[0015] Every rolling interval Δt, a queue record is added to each grid linked list as the corresponding current added record; the timestamp T of the current added record is set based on the current time; and the grid object set of the current added record is set to empty.
[0016] Preferably, the grid object update processing of the H3 grid hash table based on the real-time traffic feedback of the designated road network area specifically includes:
[0017] Step 41, receiving a first real-time traffic feedback of the designated road network area;
[0018] Wherein, the first real-time traffic feedback includes the first time and the first participant set; the first participant set is composed of a plurality of first participant information; the first participant information includes the first participant identification, the first participant type and the first participant coordinates;
[0019] Step 42, taking each of the first participant information as the corresponding current participant information; taking the first time and the first participant identifier, the first participant type and the first participant coordinates of the current participant information as the corresponding current time, current participant identifier, current participant type and current participant coordinates; and according to the preset coordinate and grid identifier conversion rule, performing corresponding grid identifier conversion according to the current participant coordinates to obtain the corresponding current grid identifier; taking the grid linked list of the grid key-value pairs matching the grid identifier S in the H3 grid hash table with the current grid identifier as the corresponding current grid linked list; taking the queue record in the current grid linked list that is closest to the timestamp T and the current time interval as the corresponding current record; taking the queue record before the current record as the corresponding previous record; and checking whether the previous record is If the previous record is empty, then when the grid object P whose object identifier matches the current participant identifier does not exist in the grid object set of the current record, the current participant identifier, the current participant type and the current participant coordinates are used as the corresponding object identifier, the object type and the object coordinates to form a corresponding grid object P, which is added to the grid object set of the current record; if the previous record is not empty, then when the grid object P whose object identifier matches the current participant identifier does not exist in the grid object sets of the previous and current records, the current participant identifier, the current participant type and the current participant coordinates are used as the corresponding object identifier, the object type and the object coordinates to form a corresponding grid object P, which is added to the grid object set of the current record.
[0020] Preferably, the performing grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction and performing traffic information analysis based on the query result to obtain corresponding instruction feedback data to the current user specifically includes:
[0021] Step 51, taking the query period, the query type and the query parameter of the traffic information query instruction as the corresponding current query period, current query type and current query parameter;
[0022] Step 52, record the queue records whose timestamp T in each grid linked list of the H3 grid hash table satisfies the current query period as valid records, and record the queue records whose timestamp T does not satisfy the current query period as invalid records;
[0023] Step 53, identifying the current query type; if the current query type is a traffic participant trajectory query, go to step 54; if the current query type is a vehicle flow statistics query, go to step 55; if the current query type is a sub-grid network query, go to step 56;
[0024] Step 54, extract the corresponding query object identifier from the current query parameter; and record the valid record where the grid object P whose object identifier matches the query object identifier in the H3 grid hash table is located as the corresponding first screening record; and use the timestamp T, the object coordinates and the grid identifier S corresponding to each of the first screening records as the corresponding first track point time, the first track point coordinates and the first track point grid identifier to form a corresponding first track point; and sort all the first track points obtained in chronological order to form a corresponding first query track; and use the first query track as the corresponding instruction feedback data; and go to step 57;
[0025] Step 55, extract the corresponding query grid identifier from the current query parameter; and use the grid linked list of the grid key-value pairs that match the grid identifier S and the query grid identifier in the H3 grid hash table as the corresponding current grid linked list; and count the total number of the grid objects P of the object type of motor vehicles in the grid object set of each valid record in the current grid linked list to obtain a corresponding first total number; and calculate the sum of all the obtained first total numbers to obtain a corresponding first sum; and use the first sum as the corresponding instruction feedback data; and go to step 57;
[0026] Step 56, extract the corresponding clockwise / counterclockwise vertex coordinate sequence from the current query parameter; and connect all the regional vertex coordinates of the clockwise / counterclockwise vertex coordinate sequence in the corresponding clockwise / counterclockwise order to form a corresponding first ground area; and record each of the first grids in the first grid network that intersects with the first ground area as a corresponding first screening grid; and record the grid key-value pairs corresponding to each of the first screening grids in the H3 grid hash table as corresponding sub-network grid key-value pairs; and form a corresponding sub-network grid hash table from all the obtained sub-network grid key-value pairs; and use the sub-network grid hash table as the corresponding instruction feedback data;
[0027] Step 57: Feedback the command feedback data obtained this time to the current user.
[0028] A second aspect of the embodiment of the present invention provides a device for implementing the grid spatiotemporal data processing method described in the first aspect, the device comprising: a grid spatiotemporal data construction module, a grid spatiotemporal data update module and a grid spatiotemporal data application module;
[0029] The grid spatiotemporal data construction module is used to grid the designated road network area according to the H3 grid format to obtain the corresponding first grid network; and to count the total number of H3 grids at the bottom layer of the first grid network to obtain the corresponding total number of grids N; and to create a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table; and to store the H3 grid hash table based on a type of distributed database; wherein, the first grid network includes N first grids; each of the first grids is a bottom-level H3 grid; each of the first grids corresponds to a grid identifier S; the H3 grid hash table includes N grid key-value pairs; the grid key-value pairs correspond to the first grids one by one; the key field of the grid key-value pairs is the corresponding grid identifier S, and the value field is the corresponding grid linked list; each of the grid linked lists is a first-in-first-out circular queue linked list with a fixed queue size, and is composed of queue records with a preset total number of queue records M; the queue record is composed of a corresponding timestamp T and a grid object set; the distributed database at least includes a Redis database;
[0030] The grid spatiotemporal data update module is used to perform a queue record rolling addition process on all the grid linked lists of the H3 grid hash table at a preset rolling interval Δt; and perform a grid object update process on the H3 grid hash table based on the real-time traffic feedback of the designated road network area;
[0031] The grid spatiotemporal data application module is used to perform a grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction when receiving a traffic information query instruction input by the user, and perform traffic information analysis based on the query result to obtain corresponding instruction feedback data to the current user; wherein, the traffic information query instruction includes a query period, a query type and a query parameter; the query type includes at least a traffic participant trajectory query, a vehicle flow statistics query and a sub-grid network query; when the query type is a traffic participant trajectory query, the query parameter is a query object identifier; when the query type is a vehicle flow statistics query, the query parameter is a query grid identifier; when the query type is a sub-grid network query, the query parameter is a clockwise / counterclockwise vertex coordinate sequence of an irregular ground area, and the clockwise / counterclockwise vertex coordinate sequence is formed by sequentially sorting the vertex coordinates of multiple areas in a clockwise / counterclockwise order.
[0032] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;
[0033] The processor is used to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;
[0034] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
[0035] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.
[0036] The embodiment of the present invention provides a method, device, electronic device and computer-readable storage medium for processing grid spatiotemporal data. It can be seen from the above invention content that the embodiment of the present invention divides the designated road network area into grids according to the H3 grid format to obtain the corresponding first grid network, and counts the total number of H3 grids at the bottom of the first grid network to obtain the corresponding total number of grids N, and creates a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table, and stores the H3 grid hash table based on a type of distributed database; and performs queue record rolling addition processing on all grid linked lists of the H3 grid hash table according to a preset rolling interval △t, and performs grid object update processing on the H3 grid hash table based on real-time traffic feedback of the designated road network area; and when receiving a traffic information query instruction input by a user, performs a grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction and performs traffic information analysis based on the query result to obtain corresponding instruction feedback data to feed back to the current user. The grid spatiotemporal data design scheme and the corresponding spatiotemporal data refresh and query scheme provided by the embodiment of the present invention can construct a dynamic H3 grid and provide users with real-time query services, thereby improving the real-time performance of both grid data and traffic query services. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of a method for processing grid spatiotemporal data provided in Embodiment 1 of the present invention;
[0038] Figure 2 A schematic diagram of the data structure of the H3 grid hash table and grid linked list provided in the first embodiment of the present invention;
[0039] Figure 3 A module structure diagram of a grid spatiotemporal data processing device provided in Embodiment 2 of the present invention;
[0040] Figure 4 A schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0042] A method for processing grid spatiotemporal data provided by the first embodiment of the present invention is as follows: Figure 1 A schematic diagram of a method for processing grid spatiotemporal data provided in the first embodiment of the present invention is shown, and includes the following main steps:
[0043] Step 1: grid the designated road network area according to the H3 grid format to obtain the corresponding first grid network; and count the total number of H3 grids at the bottom layer of the first grid network to obtain the corresponding total number of grids N; and create a corresponding grid spatiotemporal data table for the first grid network, denoted as an H3 grid hash table; and store the H3 grid hash table based on a type of distributed database.
[0044] Here, the first grid network of the embodiment of the present invention includes N first grids; each first grid is a bottom-level H3 grid; each first grid corresponds to a grid identifier S. The reason why the first grid network is constructed only according to the bottom-level H3 grid is that in the H3 grid system, except for the bottom-level H3 grid, all upper-level grids can be derived step by step from the grid identifier of the bottom-level H3 grid according to the grid identifier definition standard, so the grid spatiotemporal data of each upper-level grid can be completed by counting the spatiotemporal data of the lower-level grids. Therefore, the embodiment of the present invention only describes the bottom-level H3 grid network, i.e., the first grid network.
[0045] like Figure 2 As shown in the data structure diagram of the H3 grid hash table and grid linked list provided in the first embodiment of the present invention, the H3 grid hash table of the embodiment of the present invention includes N grid key-value pairs; the grid key-value pairs in the H3 grid hash table correspond one-to-one to the first grid in the first grid network; the key field of each grid key-value pair is the corresponding grid identifier S, and the value field is the corresponding grid linked list.
[0046] Each grid linked list in the embodiment of the present invention is a first-in-first-out circular queue linked list with a fixed queue size, and is composed of queue records with a preset total number of queue records M. Figure 2 As shown, each queue record of the grid linked list in the embodiment of the present invention consists of a corresponding timestamp T and a grid object set.
[0047] It should be noted that the time difference between each queue record and the timestamp T of the previous or next queue record matches the preset rolling interval △t, and the rolling interval △t is a preset time length parameter.
[0048] It should also be noted that: 1) when the grid object set is empty, it means that there is no traffic participant in motion in the current first grid at the time point corresponding to the current timestamp T, and the participant types of traffic participants in the embodiment of the present invention include at least motor vehicles, non-motor vehicles and pedestrians; 2) when the grid object set is not empty, it is composed of one or more grid objects P, each grid object P corresponds to a traffic participant in motion in the current first grid at the time point corresponding to the current timestamp T, and the grid object P includes an object identifier, an object type and an object coordinate, and the object type includes at least motor vehicles, non-motor vehicles and pedestrians.
[0049] The distributed database used to store the H3 grid hash table in the embodiment of the present invention includes at least a Redis database. The reason for selecting the distributed database to store the H3 grid hash table is to improve the read and write efficiency of the H3 grid hash table.
[0050] Step 2: Perform queue record rolling addition processing on all grid linked lists of the H3 grid hash table according to the preset rolling interval △t; and perform grid object update processing on the H3 grid hash table based on the real-time traffic feedback of the specified road network area;
[0051] Specifically, it includes: step 21, performing a queue record rolling addition process on all grid linked lists of the H3 grid hash table according to a preset rolling interval △t;
[0052] Specifically, it includes: adding a queue record to each grid linked list every scrolling interval △t as the corresponding current added record; setting the timestamp T of the current added record based on the current time; and setting the grid object set of the current added record to empty;
[0053] Step 22, performing grid object update processing on the H3 grid hash table based on the real-time traffic feedback of the specified road network area;
[0054] Specifically comprising: step 221, receiving first real-time traffic feedback of a designated road network area;
[0055] The first real-time traffic feedback includes the first time and the first participant set; the first participant set is composed of a plurality of first participant information; the first participant information includes the first participant identifier, the first participant type and the first participant coordinates;
[0056] Step 222, taking each first participant information as the corresponding current participant information; taking the first time and the first participant identifier, the first participant type and the first participant coordinates of the current participant information as the corresponding current time, the current participant identifier, the current participant type and the current participant coordinates; and according to the preset coordinate and grid identifier conversion rule, performing the corresponding grid identifier conversion according to the current participant coordinates to obtain the corresponding current grid identifier; taking the grid linked list of grid key-value pairs matching the grid identifier S and the current grid identifier in the H3 grid hash table as the corresponding current grid linked list; taking the queue record in the current grid linked list that is closest to the timestamp T and the current time interval as the corresponding current record; and taking the previous queue record of the current record as the corresponding previous record; and identify whether the previous record is empty; if the previous record is empty, then when there is no grid object P whose object identifier matches the current participant identifier in the grid object set of the current record, the current participant identifier, current participant type and current participant coordinates are used as corresponding object identifiers, object types and object coordinates to form a corresponding grid object P, which is added to the grid object set of the current record; if the previous record is not empty, then when there is no grid object P whose object identifier matches the current participant identifier in both the previous and current grid object sets, the current participant identifier, current participant type and current participant coordinates are used as corresponding object identifiers, object types and object coordinates to form a corresponding grid object P, which is added to the grid object set of the current record.
[0057] Here, the conversion rules between coordinates and grid identifiers in the embodiment of the present invention are the conversion rules between map coordinates and grid identifiers in the H3 grid system. This is a public technical solution that can be obtained by querying the technical literature of the H3 grid system and will not be further described here.
[0058] It should be noted that in the current step, it is also necessary to check whether there is a grid object P (hereinafter referred to as grid object P) in the previously recorded grid object set whose object identifier matches the current participant identifier. ’ ) is confirmed because if the mesh object set of the previous record contains mesh object P ’ This indicates that within the interval period (period length = △t) from the previous record to the current record, the traffic participant either did not move or did not completely move out of the current grid. In this case, the embodiment of the present invention will not repeatedly write it into the grid object set of the current record, otherwise a problem of repeated counting will occur when counting the traffic flow.
[0059] Step 3: upon receiving a traffic information query instruction input by the user, query the H3 grid hash table for grid spatiotemporal data based on the traffic information query instruction and analyze the traffic information based on the query result to obtain corresponding instruction feedback data to be fed back to the current user;
[0060] The traffic information query instruction includes a query period, a query type and a query parameter; the query type includes at least a traffic participant trajectory query, a vehicle flow statistics query and a sub-grid network query; when the query type is a traffic participant trajectory query, the query parameter is a query object identifier; when the query type is a vehicle flow statistics query, the query parameter is a query grid identifier; when the query type is a sub-grid network query, the query parameter is a clockwise / counterclockwise vertex coordinate sequence of an irregular ground area, and the clockwise / counterclockwise vertex coordinate sequence is formed by sequentially sorting the coordinates of multiple regional vertices in a clockwise / counterclockwise order;
[0061] Specifically, it includes: step 31, taking the query period, query type and query parameters of the traffic information query instruction as the corresponding current query period, current query type and current query parameters;
[0062] Step 32, in each grid linked list of the H3 grid hash table, the queue records whose timestamp T meets the current query period are recorded as valid records, and the queue records whose timestamp T does not meet the current query period are recorded as invalid records;
[0063] Here, when locating the queue records whose timestamp T in each grid linked list meets the current query period, although the grid linked list is a circular queue and the physical record index is not necessarily equal to the actual queue record order, the record order can be identified based on the timestamp of the queue record; when identifying valid / invalid records based on the timestamp order, in order to improve the identification efficiency, a variety of optimized query methods can be used to improve the query efficiency. The embodiment of the present invention uses a binary search algorithm by default;
[0064] Step 33, identifying the current query type; if the current query type is a traffic participant trajectory query, go to step 34; if the current query type is a traffic flow statistics query, go to step 35; if the current query type is a sub-grid network query, go to step 36;
[0065] Step 34, extract the corresponding query object identifier from the current query parameter; and record the valid record of the grid object P in the H3 grid hash table where each object identifier matches the query object identifier as the corresponding first screening record; and use the timestamp T, object coordinates and grid identifier S corresponding to each first screening record as the corresponding first track point time, first track point coordinates and first track point grid identifier to form a corresponding first track point; and sort all the obtained first track points in chronological order to form a corresponding first query track; and use the first query track as the corresponding instruction feedback data; and go to step 37;
[0066] Step 35, extract the corresponding query grid identifier from the current query parameter; and use the grid linked list of grid key-value pairs matching the grid identifier S and the query grid identifier in the H3 grid hash table as the corresponding current grid linked list; and count the total number of grid objects P of the motor vehicle object type in the grid object set of each valid record in the current grid linked list to obtain the corresponding first total number; and calculate the sum of all the obtained first total numbers to obtain the corresponding first sum; and use the first sum as the corresponding instruction feedback data; and go to step 37;
[0067] Step 36, extract the corresponding clockwise / counterclockwise vertex coordinate sequence from the current query parameter; and connect all the regional vertex coordinates of the clockwise / counterclockwise vertex coordinate sequence in the corresponding clockwise / counterclockwise order to form the corresponding first ground area; and record each first grid in the first grid network that intersects with the first ground area as the corresponding first screening grid; and record the grid key-value pairs corresponding to each first screening grid in the H3 grid hash table as the corresponding sub-network grid key-value pairs; and form the corresponding sub-network grid hash table from all the obtained sub-network grid key-value pairs; and use the sub-network grid hash table as the corresponding instruction feedback data;
[0068] Step 37: Feedback the command feedback data obtained this time to the current user.
[0069] It should also be noted that, in addition to the above three real-time query services, based on the grid spatiotemporal data features of the dynamic H3 grid provided by the embodiment of the present invention, a three-dimensional grid space with H3 grid, time, and traffic participants as XYZ axes can be constructed as the first 3D data space; and the first 3D data space is divided into data grids; and a corresponding first data grid value calculation rule is set as follows: if a traffic participant corresponding to a data grid in the first 3D data space exists in the current H3 grid at the current time point / segment, then the grid value of this data grid is set to 1, otherwise it is set to 0; and all data grids in the first 3D data space are continuously and dynamically refreshed based on the H3 grid hash table. In this way, the real-time dynamics and historical trajectories of all traffic participants can be obtained by observing the first 3D data space, and visualization processing can be conveniently performed based on the first 3D data space.
[0070] It should also be noted that, based on the grid spatiotemporal data features of the dynamic H3 grid provided by the embodiment of the present invention, a three-dimensional grid space with H3 grid, time, and the number of traffic participants as XYZ axes can be constructed as the second 3D data space; the number of traffic participants here can be defined as the number of traffic participants of a specified type (such as motor vehicles, aircraft vehicles, pedestrians), or the number of traffic participants of all types; and the second 3D data space is divided into data grids; and a corresponding data grid value calculation rule is set as: the total number of traffic participants existing in the current H3 grid at the time point / segment corresponding to each data grid is counted and the statistical result is used as the grid value of the current data grid; and all data grids in the second 3D data space are continuously and dynamically refreshed based on the H3 grid hash table. In this way, by observing the second 3D data space, real-time traffic information and historical traffic information at all traffic locations (points, pieces, segments, and areas) can be obtained. The traffic information here can be motor vehicle traffic, non-motor vehicle traffic or pedestrian traffic, or all traffic participant traffic, and visualization processing can be conveniently performed based on the second 3D data space.
[0071] Figure 3 This is a module structure diagram of a grid spatiotemporal data processing device provided in the second embodiment of the present invention. The device is a terminal device or server that implements the aforementioned method embodiment, and can also be a device that enables the aforementioned terminal device or server to implement the aforementioned method embodiment. For example, the device can be a device or chip system of the aforementioned terminal device or server. Figure 3 As shown, the grid spatiotemporal data processing device provided by the second embodiment of the present invention includes: a grid spatiotemporal data construction module 201, a grid spatiotemporal data update module 202 and a grid spatiotemporal data application module 203.
[0072] The grid spatiotemporal data construction module 201 is used to grid the designated road network area according to the H3 grid format to obtain the corresponding first grid network; and to count the total number of H3 grids at the bottom layer of the first grid network to obtain the corresponding total number of grids N; and to create a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table; and to store the H3 grid hash table based on a type of distributed database; wherein, the first grid network includes N first grids; each first grid is a bottom layer H3 grid; each first grid corresponds to a grid identifier S; the H3 grid hash table includes N grid key-value pairs; the grid key-value pairs correspond to the first grids one by one; the key field of the grid key-value pairs is the corresponding grid identifier S, and the value field is the corresponding grid linked list; each grid linked list is a first-in-first-out circular queue linked list with a fixed queue size, and is composed of queue records with a preset total number of queue records M; the queue record is composed of a corresponding timestamp T and a grid object set; the distributed database at least includes a Redis database.
[0073] The grid spatiotemporal data updating module 202 is used to perform a rolling addition process on all grid linked lists of the H3 grid hash table at a preset rolling interval Δt; and to perform a grid object update process on the H3 grid hash table based on real-time traffic feedback of a designated road network area.
[0074] The grid spatiotemporal data application module 203 is used to perform a grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction and perform traffic information analysis based on the query result to obtain corresponding instruction feedback data to the current user when receiving a traffic information query instruction input by the user; wherein the traffic information query instruction includes a query period, a query type and a query parameter; the query type includes at least a traffic participant trajectory query, a vehicle flow statistics query and a sub-grid network query; when the query type is a traffic participant trajectory query, the query parameter is a query object identifier; when the query type is a vehicle flow statistics query, the query parameter is a query grid identifier; when the query type is a sub-grid network query, the query parameter is a clockwise / counterclockwise vertex coordinate sequence of an irregular ground area, and the clockwise / counterclockwise vertex coordinate sequence is formed by sequentially sorting the coordinates of multiple regional vertices in a clockwise / counterclockwise order.
[0075] An embodiment of the present invention provides a processing device for grid spatiotemporal data, which can execute the method steps in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
[0076] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the grid spatiotemporal data construction module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above-mentioned module is determined. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0077] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0078] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the above method embodiments are generated. The above computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the above-mentioned computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, Bluetooth, microwave, etc.) methods. The above-mentioned computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The above-mentioned available medium can be a magnetic medium (such as a floppy disk, a hard disk, a tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.
[0079] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. The electronic device may be a terminal device or a server for implementing the method of the aforementioned embodiment, or may be a terminal device or a server for implementing the method of the aforementioned embodiment connected to the aforementioned terminal device or server. Figure 4As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303. Various instructions may be stored in the memory 302 to complete various processing functions and implement the processing steps described in the aforementioned embodiment method. Preferably, the electronic device involved in the embodiment of the present invention also includes: a power supply 304, a system bus 305 and a communication port 306. The system bus 305 is used to realize the communication connection between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripherals.
[0080] exist Figure 4 The system bus 305 mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize the communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM), and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.
[0081] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (Network Processor, NP), a graphics processing unit (Graphics Processing Unit, GPU), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0082] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the method and processing process provided in the above embodiments.
[0083] The embodiment of the present invention provides a method, device, electronic device and computer-readable storage medium for processing grid spatiotemporal data. It can be seen from the above invention content that the embodiment of the present invention divides the designated road network area into grids according to the H3 grid format to obtain the corresponding first grid network, and counts the total number of H3 grids at the bottom of the first grid network to obtain the corresponding total number of grids N, and creates a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table, and stores the H3 grid hash table based on a type of distributed database; and performs queue record rolling addition processing on all grid linked lists of the H3 grid hash table according to a preset rolling interval △t, and performs grid object update processing on the H3 grid hash table based on real-time traffic feedback of the designated road network area; and when receiving a traffic information query instruction input by a user, performs a grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction and performs traffic information analysis based on the query result to obtain corresponding instruction feedback data to feed back to the current user. The grid spatiotemporal data design scheme and the corresponding spatiotemporal data refresh and query scheme provided by the embodiment of the present invention can construct a dynamic H3 grid and provide users with real-time query services, thereby improving the real-time performance of both grid data and traffic query services.
[0084] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0085] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for processing grid spatiotemporal data, characterized in that: The method comprises: Step 1: grid the designated road network area according to the H3 grid format to obtain a corresponding first grid network; and count the total number of H3 grids at the bottom of the first grid network to obtain the corresponding total number of grids N; and create a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table; and store the H3 grid hash table based on a distributed database; Wherein, the first grid network includes N first grids; each of the first grids is a bottom-level H3 grid; each of the first grids corresponds to a grid identifier S; the H3 grid hash table includes N grid key-value pairs; the grid key-value pairs correspond to the first grids one by one; the key field of the grid key-value pairs is the corresponding grid identifier S, and the value field is the corresponding grid linked list; each grid linked list is a first-in-first-out circular queue linked list with a fixed queue size, and is composed of queue records with a preset total number of queue records M; the queue record is composed of a corresponding timestamp T and a grid object set; the distributed database at least includes a Redis database; Step 2, performing a queue record rolling addition process on all the grid linked lists of the H3 grid hash table at a preset rolling interval Δt; and performing a grid object update process on the H3 grid hash table based on the real-time traffic feedback of the designated road network area; Step 3, upon receiving a traffic information query instruction input by a user, performing a grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction and performing traffic information analysis based on the query result to obtain corresponding instruction feedback data to feed back to the current user; Among them, the traffic information query instruction includes a query period, a query type and a query parameter; the query type includes at least a traffic participant trajectory query, a vehicle flow statistics query and a sub-grid network query; when the query type is a traffic participant trajectory query, the query parameter is a query object identifier; when the query type is a vehicle flow statistics query, the query parameter is a query grid identifier; when the query type is a sub-grid network query, the query parameter is a clockwise / counterclockwise vertex coordinate sequence of an irregular ground area, and the clockwise / counterclockwise vertex coordinate sequence is formed by sequentially sorting the coordinates of multiple regional vertices in a clockwise / counterclockwise order.
2. The method for processing grid spatiotemporal data according to claim 1, characterized in that: The time difference between the timestamp T of each queue record and the previous or next queue record matches the rolling interval Δt; When the grid object set is empty, it means that at the time point corresponding to the current timestamp T, there is no traffic participant in motion in the current first grid; the types of traffic participants include at least motor vehicles, non-motor vehicles and pedestrians; When the grid object set is not empty, it is composed of one or more grid objects P; each of the grid objects P corresponds to a traffic participant that is in motion within the current first grid at the time point corresponding to the current timestamp T; The grid object P includes an object identifier, an object type and an object coordinate; the object type includes at least motor vehicles, non-motor vehicles and pedestrians.
3. The method for processing grid spatiotemporal data according to claim 2, characterized in that: The step of performing a queue record rolling addition process on all the grid linked lists of the H3 grid hash table at a preset rolling interval Δt specifically includes: Every rolling interval Δt, a queue record is added to each grid linked list as the corresponding current added record; the timestamp T of the current added record is set based on the current time; and the grid object set of the current added record is set to empty.
4. The method for processing grid spatiotemporal data according to claim 2, characterized in that: The performing grid object updating processing on the H3 grid hash table based on the real-time traffic feedback of the designated road network area specifically includes: Step 41, receiving a first real-time traffic feedback of the designated road network area; Wherein, the first real-time traffic feedback includes the first time and the first participant set; the first participant set is composed of a plurality of first participant information; the first participant information includes the first participant identification, the first participant type and the first participant coordinates; Step 42, taking each of the first participant information as the corresponding current participant information; taking the first time and the first participant identifier, the first participant type and the first participant coordinates of the current participant information as the corresponding current time, current participant identifier, current participant type and current participant coordinates; and according to the preset coordinate and grid identifier conversion rule, performing corresponding grid identifier conversion according to the current participant coordinates to obtain the corresponding current grid identifier; taking the grid linked list of the grid key-value pairs matching the grid identifier S in the H3 grid hash table with the current grid identifier as the corresponding current grid linked list; taking the queue record in the current grid linked list that is closest to the timestamp T and the current time interval as the corresponding current record; taking the queue record before the current record as the corresponding previous record; and checking whether the previous record is If the previous record is empty, then when the grid object P whose object identifier matches the current participant identifier does not exist in the grid object set of the current record, the current participant identifier, the current participant type and the current participant coordinates are used as the corresponding object identifier, the object type and the object coordinates to form a corresponding grid object P, which is added to the grid object set of the current record; if the previous record is not empty, then when the grid object P whose object identifier matches the current participant identifier does not exist in the grid object sets of the previous and current records, the current participant identifier, the current participant type and the current participant coordinates are used as the corresponding object identifier, the object type and the object coordinates to form a corresponding grid object P, which is added to the grid object set of the current record.
5. The method for processing grid spatiotemporal data according to claim 2, characterized in that: The performing grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction and performing traffic information analysis based on the query result to obtain corresponding instruction feedback data to the current user specifically includes: Step 51, taking the query period, the query type and the query parameter of the traffic information query instruction as the corresponding current query period, current query type and current query parameter; Step 52, record the queue records whose timestamp T in each grid linked list of the H3 grid hash table satisfies the current query period as valid records, and record the queue records whose timestamp T does not satisfy the current query period as invalid records; Step 53, identifying the current query type; if the current query type is a traffic participant trajectory query, go to step 54; if the current query type is a vehicle flow statistics query, go to step 55; if the current query type is a sub-grid network query, go to step 56; Step 54, extract the corresponding query object identifier from the current query parameter; and record the valid record where the grid object P whose object identifier matches the query object identifier in the H3 grid hash table is located as the corresponding first screening record; and use the timestamp T, the object coordinates and the grid identifier S corresponding to each of the first screening records as the corresponding first track point time, the first track point coordinates and the first track point grid identifier to form a corresponding first track point; and sort all the first track points obtained in chronological order to form a corresponding first query track; and use the first query track as the corresponding instruction feedback data; and go to step 57; Step 55, extract the corresponding query grid identifier from the current query parameter; and use the grid linked list of the grid key-value pairs that match the grid identifier S and the query grid identifier in the H3 grid hash table as the corresponding current grid linked list; and count the total number of the grid objects P of the object type of motor vehicles in the grid object set of each valid record in the current grid linked list to obtain a corresponding first total number; and calculate the sum of all the obtained first total numbers to obtain a corresponding first sum; and use the first sum as the corresponding instruction feedback data; and go to step 57; Step 56, extract the corresponding clockwise / counterclockwise vertex coordinate sequence from the current query parameter; and connect all the regional vertex coordinates of the clockwise / counterclockwise vertex coordinate sequence in the corresponding clockwise / counterclockwise order to form a corresponding first ground area; and record each of the first grids in the first grid network that intersects with the first ground area as a corresponding first screening grid; and record the grid key-value pairs corresponding to each of the first screening grids in the H3 grid hash table as corresponding sub-network grid key-value pairs; and form a corresponding sub-network grid hash table from all the obtained sub-network grid key-value pairs; and use the sub-network grid hash table as the corresponding instruction feedback data; Step 57: Feedback the command feedback data obtained this time to the current user.
6. A device for executing the grid spatiotemporal data processing method according to any one of claims 1 to 5, characterized in that: The device comprises: a grid spatiotemporal data construction module, a grid spatiotemporal data update module and a grid spatiotemporal data application module; The grid spatiotemporal data construction module is used to grid the designated road network area according to the H3 grid format to obtain the corresponding first grid network; and to count the total number of H3 grids at the bottom layer of the first grid network to obtain the corresponding total number of grids N; and to create a corresponding grid spatiotemporal data table for the first grid network, which is recorded as an H3 grid hash table; and to store the H3 grid hash table based on a type of distributed database; wherein, the first grid network includes N first grids; each of the first grids is a bottom-level H3 grid; each of the first grids corresponds to a grid identifier S; the H3 grid hash table includes N grid key-value pairs; the grid key-value pairs correspond to the first grids one by one; the key field of the grid key-value pairs is the corresponding grid identifier S, and the value field is the corresponding grid linked list; each of the grid linked lists is a first-in-first-out circular queue linked list with a fixed queue size, and is composed of queue records with a preset total number of queue records M; the queue record is composed of a corresponding timestamp T and a grid object set; the distributed database at least includes a Redis database; The grid spatiotemporal data update module is used to perform a queue record rolling addition process on all the grid linked lists of the H3 grid hash table at a preset rolling interval Δt; and perform a grid object update process on the H3 grid hash table based on the real-time traffic feedback of the designated road network area; The grid spatiotemporal data application module is used to perform a grid spatiotemporal data query on the H3 grid hash table based on the traffic information query instruction when receiving a traffic information query instruction input by the user, and perform traffic information analysis based on the query result to obtain corresponding instruction feedback data to the current user; wherein, the traffic information query instruction includes a query period, a query type and a query parameter; the query type includes at least a traffic participant trajectory query, a vehicle flow statistics query and a sub-grid network query; when the query type is a traffic participant trajectory query, the query parameter is a query object identifier; when the query type is a vehicle flow statistics query, the query parameter is a query grid identifier; when the query type is a sub-grid network query, the query parameter is a clockwise / counterclockwise vertex coordinate sequence of an irregular ground area, and the clockwise / counterclockwise vertex coordinate sequence is formed by sequentially sorting the vertex coordinates of multiple areas in a clockwise / counterclockwise order.
7. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is used to couple with the memory, read and execute instructions in the memory, so as to implement the method according to any one of claims 1 to 5; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a computer, the computer is enabled to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Efficient spatial nearest neighbor query method for highway networks
CN103559213A
Method for realizing large-scale dynamic target visualization by utilizing grids under real-time environment
CN104199949A
Spatio-temporal data processing method and device, electronic equipment and storage medium
CN118363991A
Method, apparatus and system for implementing location based services
WO2015188750A1