Dynamic reconstruction method and device for track in database, equipment and medium
By performing time partitioning, spatial filtering, and geometric aggregation calculations within the database, the problems of low query efficiency and insufficient accuracy of massive trajectory data are solved, achieving efficient and accurate trajectory reconstruction, simplifying the system architecture, and supporting real-time analysis and visualization.
Patent Information
- Application Number
- CN202511931932.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-03-03
AI Technical Summary
Existing trajectory reconstruction methods suffer from low query efficiency in massive data environments, lack efficient spatiotemporal joint indexes leading to increased response time, insufficient accuracy and completeness of trajectory reconstruction, lack of effective data quality control, and complex architecture and high cost.
By dynamically reconstructing the trajectory within the database, spatial filtering is performed using time-dimensional partitioning and pruning, Z-ORDER spatiotemporal indexes, or S2 grid secondary indexes. Combined with structured query language for grouping, sorting, and geometric aggregation calculations, continuous trajectory line objects are generated, and anomaly detection and interpolation compensation are performed.
It improves the processing efficiency of massive trajectory data, ensures the temporal continuity and geometric accuracy of trajectories, simplifies the system architecture, reduces the computational burden of the application layer, and supports real-time analysis and visualization of large-scale trajectory data.
Smart Images

Figure FT_1
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage, indexing, and query optimization technology for spatiotemporal data, and in particular to a method, apparatus, device, and medium for dynamic trajectory reconstruction within a database. Background Technology
[0002] With the rapid development of IoT, intelligent transportation, and location services technologies, the collection and application of spatiotemporal trajectory data are becoming increasingly widespread. Terminals such as Automatic Identification Systems (AIS) for ships, GPS for vehicles, and mobile device positioning continuously generate massive amounts of trajectory point data. This data truthfully records the behavioral patterns of moving objects in the spatiotemporal dimension. Trajectory reconstruction technology, as the foundation of spatiotemporal data analysis, aims to recover continuous and complete motion paths from discrete trajectory points, providing support for applications such as trajectory visualization, behavior analysis, and anomaly detection.
[0003] Existing trajectory reconstruction methods typically face three major technical challenges. First, query efficiency is low in massive data environments. With the exponential growth of trajectory data, traditional databases require full table scans when handling spatiotemporal joint queries, resulting in a linear increase in response time with the data volume, failing to meet the real-time requirements of application scenarios. Efficiently processing massive trajectory data in complex environments becomes a technical bottleneck. Second, the limitations of existing spatiotemporal indexes restrict query performance. While traditional spatial indexes (such as R-trees) or temporal indexes can accelerate queries based on spatial or temporal conditions individually, there is a lack of efficient spatiotemporal joint index mechanisms. When both temporal and spatial conditions need to be met simultaneously, the system often needs to first use one index for initial filtering, and then perform secondary filtering in memory. This approach results in significant I / O waste and computational redundancy. Third, the accuracy and completeness of trajectory reconstruction are insufficient. Existing methods typically perform trajectory reconstruction at the application layer, requiring the transfer of original trajectory points from the database to the application server. This not only increases network overhead but may also lead to trajectory breakage due to data paging during transmission.
[0004] Furthermore, the lack of an effective data quality control mechanism and insufficient handling of noise and missing points in trajectory data affect the geometric accuracy of the reconstructed trajectory. Current improvement schemes attempt to increase processing speed through distributed computing or in-memory databases, but these solutions suffer from complex architectures, high costs, and fail to fundamentally address database-level query optimization. Another approach is to implement complex trajectory processing algorithms at the application layer, but this introduces additional system complexity and maintenance costs. Therefore, there is an urgent need in this field for a method that can fully utilize the native capabilities of databases to achieve efficient, accurate, and complete dynamic trajectory reconstruction, capable of performing spatiotemporal joint queries and trajectory reconstruction at the database level, thereby providing high-quality trajectory services for upper-layer applications. Summary of the Invention Based on this, it is necessary to propose a method, device, equipment, and medium for dynamic trajectory reconstruction within a database to address the above problems.
[0005] A method for dynamic trajectory reconstruction within a database, the method comprising: Receive a trajectory query request, the trajectory query request including time range conditions and spatial range conditions; Based on the time range conditions, the stored trajectory point data is partitioned and pruned according to the time dimension to obtain a pruned data subset; Spatial filtering is performed on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions; The candidate trajectory point set is grouped according to the trajectory object identifier, and each group of trajectory points is sorted according to the time attribute to form an ordered trajectory point sequence; Perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object; The continuous trajectory line object is used as the trajectory reconstruction result and obtained in a structured form in segments for dynamic display or subsequent processing.
[0006] Preferably, the step of partitioning and pruning the stored trajectory point data according to the time range condition to obtain a pruned data subset specifically includes: The trajectory point data is stored in the database in the form of a partitioned table according to the time attribute, and each partition corresponds to a fixed time interval. Based on the time range condition in the trajectory query request, the relevant time partition is directly located and read, and the time partition is truncated to obtain a truncated data subset.
[0007] Preferably, the step of performing spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions specifically includes: Spatial range filtering of the clipped data subset is performed using Z-ORDER spatiotemporal index or S2 grid secondary index; By quickly locating the index item that intersects with the query space range, a preliminary set of trajectory points can be obtained; For each trajectory point in the initially selected trajectory point set, the geometric coordinates are precisely calculated to determine whether it is within the query space range conditions, and the final candidate trajectory point set is selected.
[0008] Preferably, the step of grouping the candidate trajectory point set according to trajectory object identifiers and sorting each group of trajectory points according to time attributes to form an ordered trajectory point sequence specifically includes: The candidate trajectory points are logically grouped according to the trajectory object identifier column using the GROUPBY statement of the structured query language, and the trajectory points of the same moving entity are merged into the same group. Within each group, the trajectory points are sorted chronologically by the timestamp column using the ORDERBY statement. The sorting direction is either ascending from oldest to newest or descending from newest to oldest, depending on business requirements, to form a continuous and ordered sequence of trajectory points in the time dimension.
[0009] Preferably, the step of performing geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object specifically includes: By performing geometric calculations on an ordered sequence of trajectory points for the same trajectory object using geometric space aggregation functions, the resulting continuous trajectory line object is internally expressed using geometric data types supported by the database, fully describing the geometric shape of the target object's motion path within a specified time and space range.
[0010] Preferably, the step of using the continuous trajectory line object as the trajectory reconstruction result and obtaining it in a structured segment for dynamic display or subsequent processing specifically includes: encapsulating the generated continuous trajectory line object according to the database standard geometric data type to form a structured trajectory result set; logically dividing the trajectory line according to a preset segmentation strategy, the segmentation strategy including dividing by a fixed time window or dividing by the number of trajectory points; and returning the segmented trajectory results to the client application in batches through a database query interface, wherein each trajectory segment contains complete geometric attributes and timestamp information to support dynamic visualization playback, trajectory analysis, or further spatiotemporal data processing of the trajectory.
[0011] Preferably, before performing geometric aggregation calculations on the ordered trajectory point sequence, the method further includes: Anomaly detection is performed on the ordered trajectory point sequence, and isolated noise points with abrupt changes in spatial position are eliminated based on velocity continuity constraints; For trajectory point loss caused by acquisition interval, linear interpolation compensation is performed based on trajectory points within the time neighborhood.
[0012] A device for dynamic trajectory reconstruction within a database, the device comprising: A query request receiving module is configured to receive trajectory query requests, the trajectory query requests including time range conditions and spatial range conditions; The time-based cropping module is configured to perform time-dimension cropping on the stored trajectory point data according to the time range conditions, thereby obtaining a cropped subset of data. A spatial filtering module is configured to perform spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions. The grouping and sorting module is configured to group the candidate trajectory point set according to the trajectory object identifier, and sort each group of trajectory points according to the time attribute to form an ordered trajectory point sequence; The geometric aggregation module is configured to perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object. The result output module is configured to use the continuous trajectory line object as the trajectory reconstruction result and obtain it in segments in a structured form for dynamic display or subsequent processing.
[0013] A computer device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps: Receive a trajectory query request, the trajectory query request including time range conditions and spatial range conditions; Based on the time range conditions, the stored trajectory point data is partitioned and pruned according to the time dimension to obtain a pruned data subset; Spatial filtering is performed on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions; The candidate trajectory point set is grouped according to the trajectory object identifier, and each group of trajectory points is sorted according to the time attribute to form an ordered trajectory point sequence; Perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object; The continuous trajectory line object is used as the trajectory reconstruction result and obtained in a structured form in segments for dynamic display or subsequent processing.
[0014] A computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the following steps: Receive a trajectory query request, the trajectory query request including time range conditions and spatial range conditions; Based on the time range conditions, the stored trajectory point data is partitioned and pruned according to the time dimension to obtain a pruned data subset; Spatial filtering is performed on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions; The candidate trajectory point set is grouped according to the trajectory object identifier, and each group of trajectory points is sorted according to the time attribute to form an ordered trajectory point sequence; Perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object; The continuous trajectory line object is used as the trajectory reconstruction result and obtained in a structured form in segments for dynamic display or subsequent processing.
[0015] The embodiments of the present invention have the following beneficial effects: This invention integrates trajectory data filtering, sorting, and trajectory line construction into the internal database execution process, achieving native generation of trajectories from discrete point sets to continuous path pairs, resulting in significant benefits. A preprocessing mechanism prioritizing time pruning and coordinating spatial filtering drastically reduces the amount of data to be processed. Combined with in-database geometric aggregation calculations, it avoids frequent transmission of trajectory point-level data between system layers, greatly improving the processing efficiency of massive trajectory data. Within the database, trajectory points are systematically organized according to time attributes and trajectory lines are directly generated, ensuring complete temporal continuity and geometric accuracy of the trajectory during the generation stage, effectively solving the problems of trajectory breakage and delay in dynamic playback. By clearly defining the responsibilities of the database in trajectory reconstruction calculations and the application layer in calling the results, the system architecture is simplified, the computational burden on the application layer is reduced, and the system maintains stable processing performance even as the amount of trajectory data continues to grow, providing efficient and reliable technical support for real-time analysis and visualization of large-scale trajectory data. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] in: Figure 1 This is a flowchart of a method for dynamic trajectory reconstruction within a database in one embodiment. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] This invention provides a method for dynamic trajectory reconstruction within a database, such as... Figure 1 As shown, the method includes: Step 101: Receive a trajectory query request, the trajectory query request including time range conditions and spatial range conditions; Specifically, the trajectory query request is usually initiated by a client application (such as a ship monitoring system or traffic analysis platform) through a user interface or API interface, with the aim of obtaining the movement trajectory of a specific object within a specified time and space range.
[0020] The trajectory query request is transmitted in a structured data format (such as JSON or SQL query parameters) and delivered to the database system through a database connection layer or a web service interface. The time range condition defines the query time window in the form of start and end times, for example, specifying to query data from January 1, 2023 to January 31, 2023. The spatial range condition limits the spatial search area through geometric boundaries (such as latitude and longitude coordinate frames, polygonal regions, or geofences), such as a rectangular sea area or road network area. These conditions together ensure the relevance and efficiency of the query, laying the foundation for subsequent data filtering.
[0021] The process of receiving the trajectory query request relies on the network communication module of the database system. For example, in a ship navigation monitoring scenario, after the user sets the time range and spatial area through the front-end interface, the request is transmitted to the back-end service via HTTP POST or a JDBC database connection. After receiving the trajectory query request, the database listening port parses the parameters and verifies their validity (such as whether the time format is correct and whether the spatial range is valid). If the verification passes, the subsequent processing flow is triggered.
[0022] The received trajectory query request parameters may also include other optional fields, such as trajectory object identifiers (e.g., ship IDs), data accuracy requirements, or output format preferences. However, the core parameters are always the time range and spatial range conditions, which directly determine the granularity of subsequent data pruning and filtering, and are key to optimizing query performance. By standardizing the request format, this invention ensures the compatibility of the method with various application scenarios, providing a unified entry point for trajectory reconstruction.
[0023] Step 102: Based on the time range conditions, partition and prune the stored trajectory point data according to the time dimension to obtain a pruned data subset; Specifically, the trajectory point data is stored in the database in the form of partitioned tables based on time attributes, with each partition corresponding to a fixed time interval. The database distributes the trajectory point data across different physical storage units using a predefined time partitioning strategy (such as partitioning by day, week, or month). Each partition corresponds to a fixed time interval (for example, a partition stores data for the entire day of January 1, 2023). The partitioning key is based on a time column (such as timestamp), and physical data isolation is achieved using the database's partitioning management capabilities (such as partitioned tables in MySQL or table inheritance in PostgreSQL). This partitioning mechanism not only improves the flexibility of data management but also enables queries within a time range to quickly locate relevant partitions, avoiding full table scans and significantly reducing I / O overhead and response latency.
[0024] Based on the time range condition in the trajectory query request, the relevant time partition is directly located and read, and the time partition is truncated to obtain a truncated data subset. Upon receiving the time range conditions of a trajectory query request, the database query engine first parses the time conditions (such as the start time 2023-01-01 00:00:00 and the end time 2023-01-31 23:59:59), and then directly locates the data partitions that intersect with the query time window through partition metadata (such as the partition key mapping table). For example, if the partitions are divided by day, only the 31 partitions corresponding to January 1 to January 31, 2023 need to be loaded, while other irrelevant partitions are ignored. This is automatically completed through the database's built-in partition pruning function: the query optimizer rewrites the query plan, transforming the time conditions into partition filtering predicates, and only accessing the data blocks of the relevant partitions, thus achieving logical pruning of the partitions.
[0025] Finally, a subset of data is read from these partitions and used as the basis for subsequent processing, ensuring that only data that may meet the conditions enters the in-memory computation.
[0026] Partition pruning is particularly suitable for high-frequency trajectory data scenarios (such as ship AIS data), where the data volume increases dramatically over time. By partitioning by time, only a small number of partitions are processed during queries, reducing disk scans and memory usage, and improving query efficiency. For example, in tests, for queries of 100 million trajectory points, partition pruning reduced response time from seconds to milliseconds. Furthermore, the partition design supports data lifecycle management, such as automatically archiving old partitions, further optimizing storage resources.
[0027] Step 103: Perform spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions; Specifically, the spatial range of the clipped data subset is filtered using the Z-ORDER spatiotemporal index or the S2 grid secondary index; By quickly locating index entries that intersect with the query spatial range using indexes, a preliminary set of trajectory points is obtained. The indexing mechanism encodes spatial coordinates (such as latitude and longitude) into sortable key values, enabling the database to quickly locate index cells that intersect with the target spatial range through range queries. For example, when querying a polygonal sea area, the index prediction stage first retrieves all grid cells that intersect with the boundary of that sea area, generating a preliminary candidate set.
[0028] For each trajectory point in the initially selected trajectory point set, the geometric coordinates are precisely calculated to determine whether it is within the query space range conditions, and the final candidate trajectory point set is selected.
[0029] For each trajectory point in the initially selected set of trajectory points, precise calculation of geometric coordinates is performed, and each point is verified to ensure it truly lies within the query space. For example, for ship trajectory points, it is calculated whether their latitude and longitude coordinates fall within a specified polygonal sea area, excluding points that are in the index unit but are actually outside the range.
[0030] By directly manipulating the time-trimmed data subset, the candidate range is quickly narrowed down through the index interface, and then refined by combining the geometry engine. The final output set of candidate trajectory points only contains points that meet both time and space conditions, providing high-quality input for subsequent trajectory reconstruction. This significantly reduces unnecessary data transmission and computational overhead, making it particularly suitable for real-time processing scenarios with massive trajectory data.
[0031] Step 104: Group the candidate trajectory points according to the trajectory object identifier, and sort each group of trajectory points according to the time attribute to form an ordered trajectory point sequence; Specifically, the candidate trajectory point set is logically grouped according to the trajectory object identifier column using the GROUPBY statement of the structured query language, and trajectory points of the same moving entity are merged into the same group. The grouping is based on trajectory object identifiers (such as ship ID, vehicle ID, etc.) and is implemented using the SQL GROUPBY statement. For example, in a database query, GROUPBYobject_id is used to logically group the candidate trajectory point set according to the unique identifier of each moving entity, merging trajectory points of the same object into the same group, ensuring the independence of each trajectory object and laying the foundation for individual trajectory reconstruction. The grouping process utilizes the database's hash grouping or sorting grouping algorithms to efficiently process large-scale data. For example, in a ship trajectory scenario, all AIS data points belonging to the same ship are grouped together, facilitating the subsequent generation of the ship's complete navigation path.
[0032] Within each group, the trajectory points are sorted chronologically by the timestamp column using the ORDERBY statement. The sorting direction is either ascending from oldest to newest or descending from newest to oldest, depending on business requirements, to form a continuous and ordered sequence of trajectory points in the time dimension.
[0033] Within each trajectory object group, sort by time attribute (such as timestamp column) using the ORDER BY statement. The sorting direction can be flexibly chosen according to business needs: for scenarios such as trajectory playback, ascending order from oldest to newest (ORDERBY timestampASC) is usually used to maintain forward temporal continuity; for reverse analysis, descending order can be used.
[0034] The sorting operation relies on the database's index sorting or quicksort algorithm to ensure temporal consistency. For example, trajectory points of the same ship are arranged in ascending order of acquisition time, forming a strictly ordered sequence of points in the time dimension, providing continuous input for trajectory line generation.
[0035] The filtered discrete trajectory points are transformed into an ordered sequence, providing structured input for subsequent geometric aggregation. The grouping and sorting operations are performed entirely within the database, utilizing the aggregation and sorting capabilities of the Structured Query Language (SQL) to avoid exporting data to the application layer, thereby improving processing efficiency.
[0036] Step 105: Perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object; Specifically, geometric calculations are performed on the ordered sequence of trajectory points of the same trajectory object using geometric space aggregation functions. The resulting continuous trajectory line object is internally expressed using geometric data types supported by the database, which fully describes the geometric shape of the target object's motion path within a specified time and space range.
[0037] This is achieved by calling built-in geometric spatial aggregation functions in the database, such as the ST_MakeLine function in PostGIS or SDO_AGGR_CONCAT_LINES in Oracle Spatial. These functions take an ordered sequence of trajectory points for the same trajectory object as input (usually passed as an array or set), and aggregate the discrete point sequence into a continuous LineString geometric object through linear interpolation or path join algorithms. For example, in an SQL query, you can use the statement SELECT object_id, ST_MakeLine(ARRAY_AGG(geometry ORDER BY timestamp)) AS trajectory_line FROM sorted_points GROUP BY object_id, where ARRAY_AGG ensures that the trajectory points are aggregated in chronological order, and the ST_MakeLine function converts the ordered points into a line.
[0038] The generated trajectory line object is internally expressed in a geometric data type supported by the database (such as WKT or WKB format), containing complete geometric attributes (such as length, shape, and orientation), and can accurately describe the motion path of the target object within a specified spatiotemporal range.
[0039] Step 106: The continuous trajectory line object is used as the trajectory reconstruction result and obtained in a structured form in segments for dynamic display or subsequent processing.
[0040] Specifically, the generated continuous trajectory line objects are encapsulated according to the standard geometric data types of the database to form a structured trajectory result set; For example, the trajectory line is expressed in WKT (Well-Known Text) or WKB (Well-Known Binary) format, and contains complete metadata information, such as trajectory object identifier, time range, geometric length, segment number, etc. For example, in PostgreSQL, the trajectory result can be encapsulated as a composite data type containing a geometry column (storing LineString) and multiple attribute columns, ensuring the integrity of geometric and attribute information, making it easy for client applications to parse and use directly without additional data conversion processing.
[0041] The trajectory line is logically divided according to a preset segmentation strategy, which includes dividing by a fixed time window or dividing by the number of trajectory points. The segmented trajectory results are returned to the client application in batches through a database query interface. Each trajectory segment contains complete geometric attributes and timestamp information to support dynamic visualization playback, trajectory analysis, or further spatiotemporal data processing of the trajectory.
[0042] The complete trajectory line is logically divided according to a preset segmentation strategy, mainly using two segmentation methods: division by a fixed time window (e.g., every hour as a segment) or division by the number of trajectory points (e.g., every 100 trajectory points as a segment). The choice of segmentation strategy depends on the specific application scenario requirements. Dynamic playback scenarios typically use time window division to ensure time continuity, while analysis scenarios may prefer division by the number of points to maintain data uniformity. The segmented trajectory results are returned to the client in batches through database query interfaces (e.g., JDBC, ODBC). Each trajectory segment is an independent data unit, containing its own geometric attributes and timestamp information, effectively solving the transmission performance problem of large-scale trajectory data and supporting streaming processing and incremental loading.
[0043] The segmented trajectory results directly support a variety of application scenarios. In dynamic visualization playback, the client loads each trajectory segment in sequence to achieve a smooth trajectory animation effect. In trajectory analysis scenarios, the segmented structure facilitates parallel processing and distributed computing.
[0044] Furthermore, prior to performing geometric aggregation calculations on the ordered trajectory point sequence, the method further includes: Anomaly detection is performed on the ordered trajectory point sequence, and isolated noise points with abrupt changes in spatial position are eliminated based on velocity continuity constraints; For trajectory point loss caused by acquisition interval, linear interpolation compensation is performed based on trajectory points within the time neighborhood.
[0045] Specifically, data quality verification is a crucial preprocessing step to ensure the continuity and accuracy of the trajectory. Before performing geometric aggregation calculations on the ordered trajectory point sequence, anomaly detection and interpolation compensation operations are first performed to eliminate noise and missing data that may have been introduced during data acquisition.
[0046] Anomaly detection is based on velocity continuity constraints. By calculating the changes in movement speed and direction between adjacent trajectory points, it identifies isolated noise points with abrupt changes in spatial location. For each trajectory point, its instantaneous velocity relative to points before and after it is calculated (e.g., using the Havesing formula to calculate geographical distance divided by time difference), and a velocity threshold is set: if the velocity of a point significantly exceeds the normal range (e.g., a ship's speed suddenly spikes from 10 knots to 100 knots), it is identified as an anomaly. Simultaneously, the spatial distribution of points is checked for rationality, for example, by using density clustering algorithms (such as DBSCAN) to identify outliers far from the main trajectory. Detected anomalies are automatically removed to prevent them from interfering with trajectory line generation. For example, in AIS data, drift points caused by signal interference are filtered out to ensure that the trajectory reflects the true motion path.
[0047] For missing trajectory points due to acquisition intervals, linear interpolation compensation is performed based on trajectory points within the time neighborhood. Missing intervals in the time series are identified (e.g., the time difference between consecutive points exceeds twice the acquisition frequency), and new points are then inserted between the start and end points of the missing intervals. The interpolation algorithm uses linear interpolation: the latitude and longitude coordinates of the inserted points are calculated based on time weights, ensuring the continuity of the trajectory in the time dimension, which is particularly suitable for short-term packet loss scenarios in high-frequency acquisition data.
[0048] The interpolated points are marked as composite points for easy differentiation in subsequent analysis.
[0049] The data quality verification step significantly improves the robustness of trajectory reconstruction. Through anomaly detection and interpolation compensation, a clean, continuous, and ordered sequence of trajectory points is output, providing high-quality input for geometric aggregation. Ultimately, a smoother and more accurate trajectory line is generated, solving common data quality problems in practical applications and enhancing the method's practicality.
[0050] This invention integrates trajectory data filtering, sorting, and trajectory line construction into the internal database execution process, achieving native generation of trajectories from discrete point sets to continuous path pairs, resulting in significant benefits. A preprocessing mechanism prioritizing time pruning and coordinating spatial filtering drastically reduces the amount of data to be processed. Combined with in-database geometric aggregation calculations, it avoids frequent transmission of trajectory point-level data between system layers, greatly improving the processing efficiency of massive trajectory data. Within the database, trajectory points are systematically organized according to time attributes and trajectory lines are directly generated, ensuring complete temporal continuity and geometric accuracy of the trajectory during the generation stage, effectively solving the problems of trajectory breakage and delay in dynamic playback. By clearly defining the responsibilities of the database in trajectory reconstruction calculations and the application layer in calling the results, the system architecture is simplified, the computational burden on the application layer is reduced, and the system maintains stable processing performance even as the amount of trajectory data continues to grow, providing efficient and reliable technical support for real-time analysis and visualization of large-scale trajectory data.
[0051] This invention also provides a database-based trajectory dynamic reconstruction device, the device comprising: A query request receiving module is configured to receive trajectory query requests, the trajectory query requests including time range conditions and spatial range conditions; The time-based cropping module is configured to perform time-dimension cropping on the stored trajectory point data according to the time range conditions, thereby obtaining a cropped subset of data. A spatial filtering module is configured to perform spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions. The grouping and sorting module is configured to group the candidate trajectory point set according to the trajectory object identifier, and sort each group of trajectory points according to the time attribute to form an ordered trajectory point sequence; The geometric aggregation module is configured to perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object. The result output module is configured to use the continuous trajectory line object as the trajectory reconstruction result and obtain it in segments in a structured form for dynamic display or subsequent processing.
[0052] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the following steps: Step 101: Receive a trajectory query request, the trajectory query request including time range conditions and spatial range conditions; Step 102: Based on the time range conditions, partition and prune the stored trajectory point data according to the time dimension to obtain a pruned data subset; Step 103: Perform spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions; Step 104: Group the candidate trajectory points according to the trajectory object identifier, and sort each group of trajectory points according to the time attribute to form an ordered trajectory point sequence; Step 105: Perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object; Step 106: The continuous trajectory line object is used as the trajectory reconstruction result and obtained in a structured form in segments for dynamic display or subsequent processing.
[0053] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, causes the processor to perform the following steps: Step 101: Receive a trajectory query request, the trajectory query request including time range conditions and spatial range conditions; Step 102: Based on the time range conditions, partition and prune the stored trajectory point data according to the time dimension to obtain a pruned data subset; Step 103: Perform spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions; Step 104: Group the candidate trajectory points according to the trajectory object identifier, and sort each group of trajectory points according to the time attribute to form an ordered trajectory point sequence; Step 105: Perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object; Step 106: The continuous trajectory line object is used as the trajectory reconstruction result and obtained in a structured form in segments for dynamic display or subsequent processing.
[0054] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0055] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0056] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for dynamic trajectory reconstruction within a database, characterized in that, The method includes: Receive a trajectory query request, the trajectory query request including time range conditions and spatial range conditions; Based on the time range conditions, the stored trajectory point data is partitioned and pruned according to the time dimension to obtain a pruned data subset; Spatial filtering is performed on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions; The candidate trajectory point set is grouped according to the trajectory object identifier, and each group of trajectory points is sorted according to the time attribute to form an ordered trajectory point sequence; Perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object; The continuous trajectory line object is used as the trajectory reconstruction result and obtained in a structured form in segments for dynamic display or subsequent processing.
2. The method for dynamic trajectory reconstruction within a database according to claim 1, characterized in that, The step of partitioning and pruning the stored trajectory point data according to the time range conditions to obtain a pruned data subset specifically includes: The trajectory point data is stored in the database in the form of a partitioned table according to the time attribute, and each partition corresponds to a fixed time interval. Based on the time range condition in the trajectory query request, the relevant time partition is directly located and read, and the time partition is truncated to obtain a truncated data subset.
3. The method for dynamic trajectory reconstruction within a database according to claim 1 or 2, characterized in that, The step of performing spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions specifically includes: Spatial range filtering of the clipped data subset is performed using Z-ORDER spatiotemporal index or S2 grid secondary index; By quickly locating the index item that intersects with the query space range, a preliminary set of trajectory points can be obtained; For each trajectory point in the initially selected trajectory point set, the geometric coordinates are precisely calculated to determine whether it is within the query space range conditions, and the final candidate trajectory point set is selected.
4. The database-based trajectory dynamic reconstruction method according to claim 3, characterized in that, The step of grouping the candidate trajectory points according to trajectory object identifiers and sorting each group of trajectory points according to time attributes to form an ordered sequence of trajectory points specifically includes: The candidate trajectory points are logically grouped according to the trajectory object identifier column using the GROUPBY statement of the structured query language, and the trajectory points of the same moving entity are merged into the same group. Within each group, the trajectory points are sorted chronologically by the timestamp column using the ORDERBY statement. The sorting direction is either ascending from oldest to newest or descending from newest to oldest, depending on business requirements, to form a continuous and ordered sequence of trajectory points in the time dimension.
5. The database-based trajectory dynamic reconstruction method according to claim 4, characterized in that, The step of performing geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object specifically includes: By performing geometric calculations on an ordered sequence of trajectory points for the same trajectory object using geometric space aggregation functions, the resulting continuous trajectory line object is internally expressed using geometric data types supported by the database, fully describing the geometric shape of the target object's motion path within a specified time and space range.
6. The database-based trajectory dynamic reconstruction method according to claim 5, characterized in that, The process of using the continuous trajectory line object as the trajectory reconstruction result and obtaining it in a structured segment for dynamic display or subsequent processing specifically includes: encapsulating the generated continuous trajectory line object according to the database standard geometric data type to form a structured trajectory result set; logically dividing the trajectory line according to a preset segmentation strategy, which includes dividing by a fixed time window or dividing by the number of trajectory points; and returning the segmented trajectory results to the client application in batches through a database query interface. Each trajectory segment contains complete geometric attributes and timestamp information to support dynamic visualization playback, trajectory analysis, or further spatiotemporal data processing of the trajectory.
7. The method for dynamic trajectory reconstruction within a database according to claim 6, characterized in that, Before performing geometric aggregation calculations on the ordered trajectory point sequence, the method further includes: Anomaly detection is performed on the ordered trajectory point sequence, and isolated noise points with abrupt changes in spatial position are eliminated based on velocity continuity constraints; For trajectory point loss caused by acquisition interval, linear interpolation compensation is performed based on trajectory points within the time neighborhood.
8. A device for dynamic trajectory reconstruction within a database, characterized in that, The device includes: A query request receiving module is configured to receive trajectory query requests, the trajectory query requests including time range conditions and spatial range conditions; The time-based cropping module is configured to perform time-dimension cropping on the stored trajectory point data according to the time range conditions, thereby obtaining a cropped subset of data. A spatial filtering module is configured to perform spatial filtering on the cropped data subset to select a set of candidate trajectory points that meet the spatial range conditions. The grouping and sorting module is configured to group the candidate trajectory point set according to the trajectory object identifier, and sort each group of trajectory points according to the time attribute to form an ordered trajectory point sequence; The geometric aggregation module is configured to perform geometric aggregation calculations on the ordered trajectory point sequence to generate a continuous trajectory line object. The result output module is configured to use the continuous trajectory line object as the trajectory reconstruction result and obtain it in segments in a structured form for dynamic display or subsequent processing.
9. A computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to perform the steps of the method as claimed in any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Vehicle track data indexing method based on space-time interpolation
CN110083599A
Trajectory determination method, apparatus and device, and storage medium
CN112632058A
Track data processing method and device
CN117591757A
Track query method and device based on adaptive space segmentation
CN120144643A
Vehicle track dynamic display method and system, medium and electronic equipment
CN120561201A