Data processing method and device

By constructing a hybrid encoding set and utilizing a multi-level index database to query the temporal and spatial information of trajectory points, the problems of low accuracy and high complexity in trajectory similarity queries are solved, achieving efficient and accurate trajectory similarity queries.

CN114357313BActive Publication Date: 2025-10-21HUAWEI TECH CO LTD

Patent Information

Application Number
CN202011066444.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2025-10-21
Estimated Expiration
2040-09-30

AI Technical Summary

Technical Problem

Existing trajectory similarity query schemes lack time information for trajectories, resulting in low query accuracy and high complexity in similarity calculation.

Method used

By acquiring spatial location and temporal data of trajectory points, a hybrid encoding set is constructed, and a multi-level index database is used for querying. By combining the temporal and spatial information of the trajectory, the computational complexity of similarity is reduced and the query efficiency is improved.

Benefits of technology

It improves the accuracy of trajectory query, reduces the complexity of similarity calculation, and improves the efficiency of querying similar trajectories.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114357313B_ABST
    Figure CN114357313B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data processing method and equipment, wherein the method comprises: based on the space position data and time position data of the track points of one track, encoding according to the encoding rule of the hybrid encoding of the preset level in the index database to obtain the hybrid encoding of each track point, the hybrid encoding comprising the time information and space position information of the track point, and then querying the similar track of the one track based on the hybrid encoding of each track point in the index database. The index database comprises hybrid encoding of multiple levels, the index database comprises hybrid encoding with track information, and the track information comprises track identification and track length. The present application can improve the accuracy of track query, reduce the complexity of track similarity calculation, and improve the query efficiency of similar tracks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method and device. Background Art

[0002] The rapid development of mobile internet technology has spawned a vast amount of trajectory data reflecting the location and behavior of individuals and groups. Due to its rich spatiotemporal location and semantic information, it has been widely applied in various fields, including intelligent transportation, urban computing, and social perception. Trajectory similarity query, as one of the foundations of trajectory data mining, has gradually become a research hotspot both domestically and internationally, and has received widespread attention and application from all walks of life. Applications include commuting pattern recognition, traffic condition prediction, abnormal behavior detection, criminal behavior tracking, and major epidemic prevention and control. It holds significant significance for urban transportation, urban planning, and public health.

[0003] However, existing trajectory similarity query solutions either lack temporal information about trajectories or have high similarity calculation complexity. Therefore, how to add temporal information to trajectory similarity queries to improve the accuracy of trajectory queries while reducing the complexity of trajectory similarity calculation is a technical problem that technicians in this field urgently need to solve. Summary of the Invention

[0004] The present application provides a data processing method and device that can improve the accuracy of trajectory query, reduce the complexity of trajectory similarity calculation, and improve the efficiency of querying similar trajectories.

[0005] In a first aspect, the present application provides a data processing method, comprising:

[0006] Acquire first information, where the first information includes spatial position data and time data of one or more trajectory points of the first trajectory;

[0007] A first mixed code set is obtained according to the first information, the first mixed code set including a mixed code for each trajectory point of the first information, the mixed code being obtained by encoding according to a mixed code rule of a preset level in an index database; the mixed code including a time code of the trajectory point and a space code of the trajectory point, the time code being obtained according to the time data, and the space code being obtained according to the spatial position data; the index database being a multi-level index structure, including mixed codes of multiple levels, the mixed codes of each level being divided into sets according to the mixed codes of the level to which it belongs, an indexed relationship existing between the mixed codes of each level and the mixed codes of the level to which it belongs, the mixed codes of the multiple levels including mixed codes having trajectory information, the trajectory information being used to indicate a trajectory identifier and a trajectory length of the trajectory to which the mixed code belongs, the trajectory length of a trajectory being the number of mixed codes having the same trajectory identifier stored in the index database;

[0008] A second mixed code set is obtained by querying each mixed code in the first mixed code set in the index database according to a query method of a multi-level index structure, wherein the mixed codes in the second mixed code set are mixed codes with trajectory information; and the mixed codes in the second mixed code set are mapped to trajectory information of m candidate similar trajectories, where m is an integer;

[0009] N similar trajectories are obtained according to the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories, where N is an integer less than or equal to m.

[0010] This application combines the temporal information and spatial information encoding of the trajectory points to obtain a hybrid code, and constructs a multi-level index database based on the hybrid code as an index. The hybrid code of the index database maps the above-mentioned trajectory information, and on this basis, the candidate similar trajectories are queried in the index database, and the similar trajectory of the target trajectory is calculated based on the candidate similar trajectories, thereby improving the accuracy of trajectory query, reducing the complexity of trajectory similarity calculation, and improving the query efficiency of similar trajectories.

[0011] In a possible implementation, the querying of each mixed code in the first mixed code set in the index database according to a query method of a multi-level index structure to obtain the second mixed code set includes:

[0012] According to the query method of the multi-level index structure, each mixed code in the above-mentioned first mixed code set is compared with the mixed code in the above-mentioned index database to obtain the above-mentioned second mixed code set. The mixed codes in the above-mentioned second mixed code set are the mixed codes in the above-mentioned index database that are the same as the mixed codes in the above-mentioned first mixed code set, and / or the low-level and / or high-level mixed codes corresponding to the mixed codes in the above-mentioned index database that are the same as the mixed codes in the above-mentioned first mixed code set.

[0013] This application introduces the process of querying the encoding set corresponding to candidate similar trajectories, so as to obtain candidate similar trajectories. By screening the candidate similar trajectories and then further calculating the similarity between the trajectories, the number of similarity calculations can be reduced and the calculation efficiency can be improved.

[0014] In a possible implementation, the first information further includes attribute data of the first trajectory, and the trajectory information further includes attribute information of the trajectory indicated by the trajectory information, and the attribute information is obtained based on the attribute data of the trajectory indicated by the trajectory information;

[0015] The above-mentioned querying of each mixed code in the above-mentioned first mixed code set in the above-mentioned index database according to the query method of the multi-level index structure to obtain the second mixed code set includes:

[0016] Comparing each mixed code in the first mixed code set with the mixed codes in the index database according to a query method of a multi-level index structure to obtain a first matching mixed code, where the first matching mixed code is the same mixed code in the index database as the mixed code in the first mixed code set, and / or a lower-level and / or higher-level mixed code corresponding to the same mixed code in the index database as the mixed code in the first mixed code set;

[0017] The second mixed coding set is obtained according to the first matched mixed coding, wherein the mixed coding in the second mixed coding set is the mixed coding whose attribute information in the first matched mixed coding includes the attribute information of the first trajectory.

[0018] In this application, in addition to the above-mentioned hybrid coding as an index, attribute information is further added as filtering information. The attribute information can further filter unnecessary trajectories when querying similar trajectories, thereby more efficiently and accurately querying matching similar trajectories.

[0019] In a possible implementation, the query method according to the multi-level index structure compares each mixed code in the first mixed code set with mixed codes in the index database, including:

[0020] Determining a mixed code of a target level according to a first mixed code in the first mixed code set, where the target level is the level to which the preset level belongs;

[0021] Searching according to the mixed coding of the target level to obtain a first candidate mixed coding set;

[0022] The first mixed code is compared with the first candidate mixed code set.

[0023] In this application, the indexing efficiency can be improved by first obtaining the low-level mixed coding as the index.

[0024] In a possible implementation, the obtaining of the first mixed coding set according to the first information includes:

[0025] According to the spatial coding rules of the hybrid coding in the preset level, the spatial position data of the one or more trajectory points are encoded to obtain the spatial codes of the one or more trajectory points;

[0026] According to the coding rules of the time coding of the mixed coding in the preset level, the time data of the one or more track points are encoded to obtain the time codes of the one or more track points;

[0027] The spatial code and the temporal code of each of the one or more trajectory points are combined to obtain a hybrid code for each of the one or more trajectory points.

[0028] This application describes the encoding process of hybrid coding, which is a mixture of time coding and space coding of trajectory points. Therefore, compared with the existing technology that only uses space coding to represent trajectory points, this application uses this hybrid coding to represent trajectory points more accurately.

[0029] In a possible implementation, the first information further includes attribute data of the first trajectory, and the step of obtaining the first mixed coding set according to the first information includes:

[0030] According to the spatial coding rules of the hybrid coding in the preset level, the spatial position data of the one or more trajectory points are encoded to obtain the spatial codes of the one or more trajectory points;

[0031] According to the coding rules of the time coding of the mixed coding in the preset level, the time data of the one or more track points are encoded to obtain the time codes of the one or more track points;

[0032] Encoding the attribute data of the first trajectory to obtain the attribute code of the first trajectory;

[0033] The spatial code, the temporal code and the attribute code of each of the one or more trajectory points are combined to obtain a hybrid code of each of the trajectory points.

[0034] In this application, in addition to the temporal and spatial information of the trajectory points, the hybrid coding can also include the attribute information of the trajectory corresponding to the trajectory point. The attribute information can further filter out unnecessary trajectories when querying similar trajectories, thereby more efficiently and accurately querying matching similar trajectories.

[0035] In a possible implementation, the step of obtaining N similar trajectories based on the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories includes:

[0036] Calculate the number of i-th codes, where the number of i-th codes is calculated based on the number of mixed codes in the second mixed code set mapped with the i-th identifier, the i-th identifier being the trajectory identifier of the i-th candidate similar trajectory, and the value of i ranges from 1 to m;

[0037] Obtaining an i-th length, where the i-th length is based on the trajectory length of the first trajectory, or is calculated based on the trajectory length of the i-th candidate similar trajectory and the trajectory length of the first trajectory;

[0038] Calculate the ratio of the i-th number of codes to the i-th length, where the ratio is the similarity between the i-th candidate similar trajectory and the first trajectory;

[0039] The N similar trajectories are selected based on the m similarities calculated above.

[0040] In this application, trajectory similarity is calculated directly based on the hybrid encoding in the index database and the trajectory information mapped to the hybrid encoding. This improves computational efficiency compared to the prior art method of calculating trajectory similarity using latitude and longitude vectors. Furthermore, because similarity calculations do not require the use of the trajectory's raw data—the spatial position data and time data of the trajectory points included in the trajectory—the calculation eliminates the need for extensive disk read operations to access the raw trajectory data, thereby reducing disk performance losses caused by disk reads and further improving the efficiency of similar trajectory queries.

[0041] In a possible implementation, in a first preset scenario, the i-th number of codes is the number of trajectory identifiers of the i-th candidate similar trajectory in the hybrid coding mapping in the first hybrid coding set, the i-th length is the difference between the sum of the lengths and the i-th number of codes, the sum of the lengths is the sum of the first length and the trajectory length of the first trajectory, the first length is the product of the trajectory length of the i-th candidate similar trajectory and a coefficient K, where K is greater than 0;

[0042] In the second preset scenario, the number of the i-th code is twice the number of trajectory identifiers of the i-th candidate similar trajectory in the hybrid coding mapping in the first hybrid coding set, the i-th length is the sum of the second length and the trajectory length of the first trajectory, and the second length is the product of the trajectory length of the i-th candidate similar trajectory and the coefficient K;

[0043] In the third preset scenario, the i-th number of codes is the number of trajectory identifiers of the i-th candidate similar trajectory mapped by the hybrid coding in the first hybrid coding set, and the i-th length is the trajectory length of the first trajectory;

[0044] In the case where the first matched mixed code includes a mixed code in the index database that is identical to a mixed code in the first mixed code set, K is equal to 1;

[0045] In a case where the first matched mixed code includes a lower-level mixed code corresponding to the same mixed code as the mixed code in the first mixed code set in the index database, K is greater than 1;

[0046] In the case that the first matched mixed code includes a high-level mixed code corresponding to the mixed code in the index database that is the same as the mixed code in the first mixed code set, K is greater than 0 and less than 1.

[0047] In this application, different scenarios use different trajectory similarity calculation methods, so that the matching similarity can be found more accurately and the accuracy of the similar trajectory found can be improved.

[0048] In a possible implementation, the first mixed coding set further includes mixed coding of interpolation trajectory points, where the interpolation trajectory points are obtained based on the one or more trajectory points according to a preset interpolation method.

[0049] In the present application, hybrid codes of more trajectory points are obtained by interpolation based on existing trajectory points, so that the relationship between trajectory points is closer, and thus matching similar trajectories can be better found during similar trajectory query.

[0050] In one possible implementation, the above-mentioned index database is a database constructed based on a space-time grid model, and the above-mentioned space-time grid model includes multiple levels of space-time grids, each space-time grid level is determined according to the set spatial level and time division granularity, and each space-time grid mapping has a mixed code; the multiple levels of the above-mentioned index database are r levels, the above-mentioned r is greater than 1, and the r levels of the above-mentioned index database correspond to r space-time grid levels respectively.

[0051] In this application, by expanding the hybrid coding of existing trajectory points, the adjacent hybrid coding is also attributed to the hybrid coding of the trajectory, which can avoid missing potential similar trajectories and thus ensure the robustness of the trajectory similarity query algorithm.

[0052] In a possible embodiment, the above-mentioned index database is a database constructed based on a space-time grid model, and the above-mentioned space-time grid model includes multiple levels of space-time grids, each space-time grid level is determined according to the set spatial level and time division granularity, and each space-time grid mapping has a mixed code; the multiple levels of the above-mentioned index database are r levels, and the above-mentioned r is greater than 1. The mixed codes of the r levels of the above-mentioned index database are respectively the mixed codes of the space-time grid mappings in the r space-time grid levels. The r levels of the above-mentioned index database are mapped one-to-one with the above-mentioned r space-time grid levels, and the above-mentioned r space-time grid levels are r levels among the multiple levels of the above-mentioned space-time grid model that are pre-set.

[0053] The index database constructed in this application is a multi-level and multi-dimensional database. Multi-dimensional refers to the fact that the index hybrid coding in the index database includes the time information and spatial information of the trajectory, and optionally, it can also include the attribute information of the trajectory, so it is a multi-dimensional index. Multi-level refers to the fact that the index database includes multiple levels of index coding, and each level is also mapped to the level of the space-time grid model. The index database constructed based on the space-time grid model also has the properties of the space-time grid model. For example, the spatial coding part of the hybrid coding has the high-level spatial coding prefix including the properties of the corresponding low-level spatial coding, and the time coding part of the hybrid coding has the high-level time coding prefix including the properties of the corresponding low-level time coding. Due to these properties, similar trajectories can be efficiently queried during the similar trajectory query process.

[0054] In one possible implementation, the index database is mapped to a trajectory database. The trajectory database is used to store raw data of the multiple trajectories included in the index database. The raw data includes multiple items of time data, spatial location data, and attribute data of the multiple trajectories. The identifiers of the multiple trajectories included in the index database are mapped one-to-one with the raw data of the multiple trajectories in the trajectory database.

[0055] In this application, a trajectory database is also constructed accordingly so that the original data of the trajectory can be queried when needed.

[0056] In a second aspect, the present application provides a method for constructing a trajectory expression model, the method comprising:

[0057] Acquire trajectory data of the second trajectory, the trajectory data including spatial position data and time data of one or more trajectory points of the second trajectory;

[0058] A third mixed code set expressing the second trajectory is obtained according to the trajectory data encoding. The third mixed code set includes mixed codes of one or more trajectory points of the second trajectory, and the mixed codes are obtained according to mixed coding rules of preset levels in the index database. The mixed codes include time codes of the trajectory points and space codes of the trajectory points. The time codes are obtained according to the time data, and the space codes are obtained according to the spatial position data. The index database includes r levels of mixed codes, where r is greater than 1. The r levels of mixed codes are mixed codes of space-time grid mappings in r space-time grid levels, and the r levels are mapped one-to-one with the r space-time grid levels. The r space-time grid levels are r levels among the multiple levels included in a preset space-time grid model. Each space-time grid level in the space-time grid model is determined according to the set spatial level and time division granularity.

[0059] The present application expresses a trajectory by combining a hybrid coding set of temporal information and spatial information of the trajectory. Such a trajectory expression model combined with the above-mentioned index database can quickly and accurately find matching similar trajectories in similar trajectory queries.

[0060] In a possible implementation, the third mixed code set expressing the second trajectory obtained by encoding the trajectory data includes:

[0061] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain spatial codes of the one or more trajectory points;

[0062] Encoding the time data of the one or more track points according to the time coding rules of the mixed coding in the preset level to obtain respective time codes of the one or more track points;

[0063] The spatial code and the temporal code of each of the one or more trajectory points are combined to obtain a mixed code of each of the one or more trajectory points. The mixed codes of the one or more trajectory points constitute the third mixed code set.

[0064] This application describes the encoding process of hybrid coding, which is a mixture of time coding and space coding of trajectory points. Therefore, compared with the existing technology that only uses space coding to represent trajectory points, this application uses this hybrid coding to represent trajectory points more accurately.

[0065] In a possible implementation, the trajectory data further includes attribute data of the second trajectory, and the third mixed code set expressing the second trajectory obtained by encoding the trajectory data includes:

[0066] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain spatial codes of the one or more trajectory points;

[0067] Encoding the time data of the one or more track points according to the time coding rules of the mixed coding in the preset level to obtain respective time codes of the one or more track points;

[0068] encoding the attribute data of the second trajectory to obtain the attribute code of the second trajectory;

[0069] The spatial code, the temporal code and the attribute code of each of the one or more trajectory points are combined to obtain a hybrid code of each of the one or more trajectory points. The hybrid codes of the one or more trajectory points constitute the third hybrid code set.

[0070] In this application, in addition to the temporal and spatial information of the trajectory points, the hybrid coding can also include the attribute information of the trajectory corresponding to the trajectory point. The attribute information can further filter out unnecessary trajectories when querying similar trajectories, thereby more efficiently and accurately querying matching similar trajectories.

[0071] In a possible implementation, the third mixed coding set further includes mixed coding of interpolated trajectory points, where the mixed coding of the interpolated trajectory points is a mixed coding of the trajectory points calculated based on the mixed coding of the one or more trajectory points according to a preset interpolation method.

[0072] In the present application, hybrid codes of more trajectory points are obtained by interpolation based on existing trajectory points, so that the relationship between trajectory points is closer, and thus matching similar trajectories can be better found during similar trajectory query.

[0073] In a third aspect, the present application provides a data processing device, the device comprising:

[0074] a first acquiring unit, configured to acquire first information, wherein the first information includes spatial position data and time data of one or more trajectory points of the first trajectory;

[0075] a second acquisition unit, configured to acquire a first mixed code set based on the first information, the first mixed code set including a mixed code for each trajectory point of the first information, the mixed code being obtained by encoding according to a mixed code rule of a preset level in an index database; the mixed code including a time code of the trajectory point and a space code of the trajectory point, the time code being obtained according to the time data, and the space code being obtained according to the spatial position data; the index database being a multi-level index structure, including mixed codes of multiple levels, the mixed codes of each level being divided into sets according to the mixed codes of the level to which they belong, an indexed relationship existing between the mixed codes of each level and the mixed codes of the level to which they belong, the mixed codes of the multiple levels including mixed codes having trajectory information, the trajectory information being used to indicate a trajectory identifier and a trajectory length of the trajectory to which the mixed code belongs, the trajectory length of a trajectory being the number of mixed codes having the same trajectory identifier stored in the index database;

[0076] a query unit, configured to query the index database according to a multi-level index structure based on each mixed code in the first mixed code set to obtain a second mixed code set, wherein the mixed codes in the second mixed code set are mixed codes having trajectory information; the mixed codes in the second mixed code set are mapped to trajectory information of m candidate similar trajectories, where m is an integer;

[0077] The third acquiring unit is configured to acquire N similar trajectories according to the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories, where N is an integer less than or equal to m.

[0078] In a possible implementation, the query unit is specifically configured to:

[0079] The query device according to the multi-level index structure compares each mixed code in the above-mentioned first mixed code set with the mixed code in the above-mentioned index database to obtain the above-mentioned second mixed code set, where the mixed codes in the above-mentioned second mixed code set are the same mixed codes in the above-mentioned index database as those in the above-mentioned first mixed code set, and / or the low-level and / or high-level mixed codes corresponding to the mixed codes in the above-mentioned index database as those in the above-mentioned first mixed code set.

[0080] In a possible implementation, the first information further includes attribute data of the first trajectory, and the trajectory information further includes attribute information of the trajectory indicated by the trajectory information, and the attribute information is obtained based on the attribute data of the trajectory indicated by the trajectory information;

[0081] The query unit is specifically used for:

[0082] The query device according to the multi-level index structure compares each mixed code in the first mixed code set with the mixed codes in the index database to obtain a first matching mixed code, where the first matching mixed code is the same mixed code in the index database as the mixed code in the first mixed code set and / or a lower-level and / or higher-level mixed code corresponding to the same mixed code in the index database as the mixed code in the first mixed code set;

[0083] The second mixed coding set is obtained according to the first matched mixed coding, wherein the mixed coding in the second mixed coding set is the mixed coding whose attribute information in the first matched mixed coding includes the attribute information of the first trajectory.

[0084] In a possible implementation, the query unit is specifically configured to:

[0085] Determining a mixed code of a target level according to a first mixed code in the first mixed code set, where the target level is the level to which the preset level belongs;

[0086] Searching according to the mixed coding of the target level to obtain a first candidate mixed coding set;

[0087] The first mixed code is compared with the first candidate mixed code set.

[0088] In a possible implementation manner, the second acquiring unit is specifically configured to:

[0089] According to the spatial coding rules of the hybrid coding in the preset level, the spatial position data of the one or more trajectory points are encoded to obtain the spatial codes of the one or more trajectory points;

[0090] According to the coding rules of the time coding of the mixed coding in the preset level, the time data of the one or more track points are encoded to obtain the time codes of the one or more track points;

[0091] The spatial code and the temporal code of each of the one or more trajectory points are combined to obtain a hybrid code for each of the one or more trajectory points.

[0092] In a possible implementation, the first information further includes attribute data of the first trajectory, and the second acquiring unit is specifically configured to:

[0093] According to the spatial coding rules of the hybrid coding in the preset level, the spatial position data of the one or more trajectory points are encoded to obtain the spatial codes of the one or more trajectory points;

[0094] According to the coding rules of the time coding of the mixed coding in the preset level, the time data of the one or more track points are encoded to obtain the time codes of the one or more track points;

[0095] Encoding the attribute data of the first trajectory to obtain the attribute code of the first trajectory;

[0096] The spatial code, the temporal code and the attribute code of each of the one or more trajectory points are combined to obtain a hybrid code of each of the trajectory points.

[0097] In a possible implementation manner, the third obtaining unit is specifically configured to:

[0098] Calculate the number of i-th codes, where the number of i-th codes is calculated based on the number of mixed codes in the second mixed code set mapped with the i-th identifier, the i-th identifier being the trajectory identifier of the i-th candidate similar trajectory, and the value of i ranges from 1 to m;

[0099] Obtaining an i-th length, where the i-th length is based on the trajectory length of the first trajectory, or is calculated based on the trajectory length of the i-th candidate similar trajectory and the trajectory length of the first trajectory;

[0100] Calculate the ratio of the i-th number of codes to the i-th length, where the ratio is the similarity between the i-th candidate similar trajectory and the first trajectory;

[0101] The N similar trajectories are selected based on the m similarities calculated above.

[0102] In a possible implementation, the first mixed coding set further includes mixed coding of interpolation trajectory points, where the interpolation trajectory points are obtained based on the one or more trajectory points according to a preset interpolation device.

[0103] In a possible implementation, the first mixed coding set further includes mixed coding of extended trajectory points, where the extended trajectory points are obtained through a preset expansion device based on the one or more trajectory points and the interpolation trajectory points.

[0104] In one possible implementation, the above-mentioned index database is a database constructed based on a space-time grid model, and the above-mentioned space-time grid model includes multiple levels of space-time grids, each space-time grid level is determined according to the set spatial level and time division granularity, and each space-time grid mapping has a mixed code; the multiple levels of the above-mentioned index database are r levels, the above-mentioned r is greater than 1, and the r levels of the above-mentioned index database correspond to r space-time grid levels respectively.

[0105] In a possible implementation, the index database is mapped to a trajectory database, and the trajectory database is used to store raw data of the multiple trajectories included in the index database, where the raw data includes multiple items of time data, spatial location data, and attribute data of the multiple trajectories.

[0106] In a fourth aspect, the present application provides a device for constructing a trajectory expression model, the device comprising:

[0107] an acquiring unit, configured to acquire trajectory data of the second trajectory, wherein the trajectory data includes spatial position data and time data of one or more trajectory points of the second trajectory;

[0108] an encoding unit configured to obtain, based on the trajectory data encoding, a third mixed code set expressing the second trajectory, the third mixed code set including a mixed code for each trajectory point of the second trajectory, the mixed code being obtained by encoding according to a mixed coding rule of a preset level in an index database; the mixed code including a time code of the trajectory point and a space code of the trajectory point, the time code being obtained based on the time data, and the space code being obtained based on the spatial position data; the index database including r levels of mixed codes, where r is greater than 1, the r levels of mixed codes being mixed codes of space-time grid mappings in r space-time grid levels, the r levels being mapped one-to-one with the r space-time grid levels, the r levels being r levels among a plurality of levels included in a preset space-time grid model, each space-time grid level in the space-time grid model being determined based on a set spatial level and a set time division granularity.

[0109] In a possible implementation, the encoding unit is specifically configured to:

[0110] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain spatial codes of the one or more trajectory points;

[0111] Encoding the time data of the one or more track points according to the time coding rules of the mixed coding in the preset level to obtain respective time codes of the one or more track points;

[0112] The spatial code and the temporal code of each of the one or more trajectory points are combined to obtain a mixed code of each of the one or more trajectory points. The mixed codes of the one or more trajectory points constitute the third mixed code set.

[0113] In a possible implementation, the trajectory data further includes attribute data of the second trajectory, and the encoding unit is specifically configured to:

[0114] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain spatial codes of the one or more trajectory points;

[0115] Encoding the time data of the one or more track points according to the time coding rules of the mixed coding in the preset level to obtain respective time codes of the one or more track points;

[0116] encoding the attribute data of the second trajectory to obtain the attribute code of the second trajectory;

[0117] The spatial code, the temporal code and the attribute code of each of the one or more trajectory points are combined to obtain a hybrid code of each of the one or more trajectory points. The hybrid codes of the one or more trajectory points constitute the third hybrid code set.

[0118] In a possible implementation, the third mixed coding set further includes mixed coding of interpolated trajectory points, where the mixed coding of the interpolated trajectory points is based on the mixed coding of the one or more trajectory points and is calculated according to a preset interpolation device.

[0119] In a fifth aspect, the present application provides a data processing device comprising a processor, a communication interface and a memory, wherein the memory is used to store program instructions and / or data, and the processor is used to execute the program instructions stored in the memory, so that the device executes the method described in any one of the first aspects above.

[0120] In a sixth aspect, the present application provides a device for constructing an expression model of a trajectory, comprising a processor, a communication interface, and a memory, wherein the memory is used to store program instructions and / or data, and the processor is used to execute the program instructions stored in the memory, so that the device executes the method described in any one of the second aspects above.

[0121] In the seventh aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method described in any one of the first aspects above; or, the computer program is executed by a processor to implement the method described in any one of the second aspects above.

[0122] In an eighth aspect, the present application provides a computer program product. When the computer program product is read and executed by a computer, the method described in any one of the first aspects or any one of the second aspects will be executed.

[0123] In a ninth aspect, the present application provides a device comprising a processor, a communication interface, and a memory, and the device is configured to execute the method described in any one of the first aspects or any one of the second aspects.

[0124] In one possible implementation, the device is a chip or a system on chip (SoC).

[0125] To sum up, the present application combines the temporal information and spatial information encoding of the trajectory points of the trajectory to obtain a hybrid code, and constructs a multi-level index database based on the hybrid code as an index, and maps the above-mentioned trajectory information in the hybrid code of the index database. On this basis, similar trajectories of the target trajectory are queried in the index database, thereby improving the accuracy of trajectory query, reducing the complexity of trajectory similarity calculation, and improving the query efficiency of similar trajectories. BRIEF DESCRIPTION OF THE DRAWINGS

[0126] The following is an introduction to the drawings required for use in the embodiments of this application.

[0127] Figure 1 The figure shows a scenario diagram provided by an embodiment of the present application;

[0128] Figure 2 The figure shows a schematic diagram of spatial grid division provided by an embodiment of the present application;

[0129] Figure 3 FIG2 is a schematic diagram of a spatial level coding provided by an embodiment of the present application;

[0130] Figure 4 The figure shows a schematic diagram of a space-time grid structure provided by an embodiment of the present application;

[0131] Figure 5 The figure shows a time division diagram provided by an embodiment of the present application;

[0132] Figure 6 and Figure 7 The figure shows a schematic diagram of a space-time grid based on time granularity division provided by an embodiment of the present application;

[0133] Figure 8 The figure shows a schematic diagram of a space-time grid model structure provided by an embodiment of the present application;

[0134] Figure 9 Schematic diagram showing the structure and coding relationship between the spatial time grid layers provided by an embodiment of the present application;

[0135] Figure 10 FIG2 is a flow chart of a data processing method provided in an embodiment of the present application;

[0136] Figure 11A Shown is a schematic diagram of trajectories at different spatial levels provided by an embodiment of the present application;

[0137] Figure 11B FIG2 is a schematic diagram of mapping a trajectory to a space-time grid provided by an embodiment of the present application;

[0138] Figure 12 The figure shows a schematic diagram of an index tree structure provided by an embodiment of the present application;

[0139] Figure 13 FIG2 is a flow chart of another data processing method provided in an embodiment of the present application;

[0140] Figure 14 Shown is a schematic diagram of adjacent grids provided by an embodiment of the present application;

[0141] Figure 15 Shown is a schematic diagram of a trajectory extension provided by an embodiment of the present application;

[0142] Figure 16 A schematic diagram of the logical structure of a device provided in an embodiment of the present application;

[0143] Figure 17 A schematic diagram of the logical structure of another device provided in an embodiment of the present application;

[0144] Figure 18 A schematic diagram of the hardware structure of a device provided in an embodiment of the present application;

[0145] Figure 19 A schematic diagram of the hardware structure of another device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0146] The embodiments of the present application are described below with reference to the accompanying drawings.

[0147] Figure 1 The figure shows a possible application system architecture diagram applicable to the data processing method provided in the embodiment of the present application. Figure 1 As shown, the system architecture may include one or more servers 100 and one or more user terminals (or devices) 110, wherein:

[0148] The server 100 may include, but is not limited to, a backend server or a data processing server. The server 100 can communicate with multiple user terminals 110 via the Internet. The server 100 provides data processing services to the user terminals 110. The server 100 needs to run corresponding server-side programs to provide corresponding data processing services, such as database services, data calculations, and decision execution.

[0149] The user terminal 110 can install and run relevant applications (or APPs). Applications are programs that provide local services to customers. For example, the local services may include but are not limited to: obtaining the spatial location information of the user and sending it to the server 100, and receiving similar trajectory information sent by the server 100.

[0150] The user terminal 110 in the embodiment of the present solution may include but is not limited to any vehicle, vehicle-mounted equipment, handheld electronic products based on intelligent operating systems, etc., which can interact with the user through input devices such as keyboards, virtual keyboards, touch pads, touch screens, and voice control devices, for example, smart phones, tablet computers, personal computers, etc. Among them, intelligent operating systems include but are not limited to any operating system that enriches the functions of mobile devices by providing various mobile applications to mobile devices, such as Android. TM ), iOS TM 、Windows Phone TM In addition, the user terminal 110 may also include transportation vehicles such as airplanes or ships, or positioning devices carried by these transportation vehicles, etc.

[0151] It should be noted that the system architecture for the application of the data method provided in the embodiment of the present application is not limited to the scenario described above. As long as the data processing method provided in the embodiment of the present application is applied, it is a scenario applicable to the embodiment of the present application and will not be repeated here.

[0152] Before introducing the data processing method provided in the embodiments of the present application, the relevant concepts involved in the present application are first introduced.

[0153] 1. Global Discrete Grid Model

[0154] Using a specific partitioning model, the Earth's space is partitioned into a multi-level discrete system of similar areas and shapes, infinitely subdividable, and seamless, non-overlapping patches. This creates a hierarchical, recursive partitioning of space and a multi-scale nested relationship between the partitioned patches within Earth space. Each of these multi-scale grids or grid bodies can be assigned a unique code, which serves as a location identifier in Earth space. All information and data on Earth can be located in one or more grids and assigned a corresponding grid code, thus enabling the unified organization, computation, and services of Earth Big Data.

[0155] In a specific embodiment, the global discrete grid can be divided into multiple methods, such as a grid division method with equal longitude and latitude, a grid division method with space-filling curves, and a grid division method with regular polyhedrons.

[0156] This embodiment takes the equal longitude and latitude quadtree grid system as an example. First, the Earth's spatial plane is divided into four equal parts with the intersection of the prime meridian and the equator as the center. This is the first-level grid. In each grid, the quadtree subdivision method is used to continue to subdivide to obtain a secondary grid, and so on, until the subdivision level of the required granularity is reached. During the subdivision process, based on the space filling curve, each grid forms a mapping relationship with the actual geographic space and is assigned a unique grid code. Based on this discrete grid system, all objects on the earth can be mapped to the grid code of the corresponding geographic location. For ease of understanding, please refer to Figure 2 .

[0157] exist Figure 2 In the figure, assume that region ABCD is a flattened plane region formed by flattening the Earth's surface, i.e., this plane region includes all the areas on Earth. A quadtree grid system is used to grid this region ABCD. Assuming that line segment FH represents the prime meridian, line segment IG represents the equator, and E represents the intersection of prime meridian FH and equator IG, then the four grid regions obtained by dividing the Earth's spatial plane into four equal parts with the intersection of prime meridian FH and equator IG as the center are region AFEI, region FBGE, region EGCH, and region IEHD. Furthermore, each of these four regions is further divided into four equal grid regions. Taking region AFEI as an example, the four grid regions obtained by dividing region AFEI into four equal parts are region AJOQ, region JFKO, region OKEL, and region QOLI. Furthermore, each of the four regions obtained by equally dividing region AFEI is further divided into four grid regions. For example, region AJOQ is divided into four grid regions: region AMSR, region MJNS, region SNOP, and region RSPQ. This process is repeated until the smallest region obtained by the division reaches the required granularity.

[0158] The division of the above-mentioned areas can be regarded as the division of the regional hierarchy. For example, the area ABCD is divided into four areas. The four areas obtained by the division can be called the first-level areas. The four areas included in the first level can be assigned unique codes. The codes can be binary numbers, quaternary numbers, decimal numbers, or characters, etc. The embodiment of the present application is introduced using binary numbers as an example. Then, the unique codes of the above-mentioned areas AFEI, FBGE, EGCH, and IEHD can be assumed to be 00, 01, 10, and 11.

[0159] Furthermore, the four regions obtained by equally dividing the above region AFEI into regions AJOQ, JFKO, OKEL and QOLI can be called second-level regions, and the unique coding assumptions of regions AJOQ, JFKO, OKEL and QOLI can be 0000, 0001, 0010 and 0011.

[0160] Furthermore, the four regions obtained by equally dividing the region AJOQ into the region AMSR, the region MJNS, the region SNOP, and the region RSPQ can be called the third-level regions, and the unique coding assumptions of the region AMSR, the region MJNS, the region SNOP, and the region RSPQ can be 000000, 000001, 000010, and 000011.

[0161] The above examples give the division and coding of the three grid area levels of level 1, level 2 and level 3, wherein level 1, level 2 and level 3 can be levels from low to high, and the higher the grid area level, the smaller the range of the grid area. Moreover, the coding prefix of the high-level grid area includes the coding of the corresponding low-level grid area. In the present application, the low-level coding corresponding to the high-level coding refers to the low-level coding to which the high-level coding belongs. For example, the coding prefix of the above-mentioned second-level grid area AJOQ is the coding 00 of the first-level grid area AFEI, the coding prefix of the third-level grid area AMSR is the coding 0000 of the second-level grid area AJOQ, and so on.

[0162] exist Figure 2 The division of the higher-level grids and the coding rules of each level of the first-level grid area FBGE, area EGCH and area IEHD can be found in the detailed description of the grid area AJOQ, and can be found in Figure 3 The levels and encoding shown are not described here in detail.

[0163] In this application, the above regional level can be called the spatial level, and the above coding of each grid area can be called spatial coding. The above coding of the grid area is only an example, and this solution does not make any specific restrictions on the coding of each grid.

[0164] In addition, other global grid partitioning methods such as the space-filling curve grid partitioning method and the regular polyhedron grid partitioning method also have the above-mentioned regional area change rules and coding rules for each level of grid, which will not be repeated here.

[0165] In another possible implementation, in the global discrete grid model provided in the embodiment of the present application, the grid area sizes at the same level may be different. Figure 2 For example, in Figure 2In the 1st level grid, there are only three grid regions: AFEI, FBGE, and IGCD. This means that grid regions of different sizes can belong to the same grid level. Then, based on the 1st level grid regions, higher-level grids can be further divided. Within a higher-level grid, grids of the same level can also have different sizes.

[0166] 2. Space-time grid model

[0167] The space-time grid model is a global unified discrete grid coding model that further considers the time dimension information on the basis of the global discrete grid and integrates the spatial and temporal attributes. For easier understanding, please refer to Figure 4 .exist Figure 4 As can be seen in the figure, the space-time grid can be a three-dimensional grid composed of three dimensions: longitude, latitude and time. Figure 2 AMSR example of grid area in Figure 4 When only longitude and latitude are considered, the grid obtained is the AMSR of the grid area. When the time dimension is considered, the grid obtained is a three-dimensional grid.

[0168] In this embodiment, the spacetime grid is divided into two parts. The first is the spatial grid. On this basis, the time dimension is added to form a three-dimensional spacetime grid. The spatial grid division can be referred to the description of the global discrete grid model above. The following describes the division of the time grid.

[0169] In the embodiment of the present application, the division of time is also divided according to the preset time hierarchy. First, the statistical time period is determined. The statistical time period refers to the time period for planning data collection and storage. For example, the embodiment of the present application needs to establish a trajectory database, and it is assumed that it has been determined to collect and store various trajectory data nationwide from 1999 to 2019, then the statistical time period is from 1999 to 2019. Then, the statistical time can be divided into levels according to the granularity of year, month, day, hour, minute or second. The time granularity of the division can also be a user-defined time period, which is not limited by this solution. For example, still taking the statistical time period from 1999 to 2019 as an example, you can refer to Figure 5 .

[0170] exist Figure 5 Assuming that the smallest division granularity is day, the statistical time period can be divided into 20 years from 1999 to 2019. Each year in the 20-year time period can correspond to a grid. For example, see Figure 6 , Figure 6In the figure, a schematic diagram of a space-time grid is shown by combining spatial information and time information. Figure 5 In the example, the time period of each year is divided into months, and then the time period of each month is divided into days. The example of the grid with a granularity of month can be seen in Figure 7 , Figure 7 The schematic diagram of the space-time grid with a time division granularity of month is shown by taking 1999 as an example. The schematic diagram of the space-time grid with a time division granularity of day can also refer to the schematic diagram with a time division granularity of month, which will not be repeated here.

[0171] Each space-time grid can correspond to a time code. There are many ways to encode time. In the embodiment of the present application, the time code is exemplarily represented by the intuitive mode of "yyyymmddhhmmss", where "yyyy" represents the year, "mm" represents the month, "dd" represents the day, "hh" represents the hour, "mm" represents the minute, and "ss" represents the second. For example, assuming that the time segmentation granularity is set to 1 hour, and the time to be encoded is 10:00 on June 1, 2020, then the time code of this time can be represented as "2020060110". Similarly, the time code can be a binary number, a quaternary number, a decimal number, or in the form of characters, etc.

[0172] In an embodiment of the present application, the time code of the time period obtained by coarse-grained division can be called a low-level time code, and the time code of the time period obtained by fine-grained division can be called a high-level time code. For example, relative to the time code with a division granularity of month, the time code with a division granularity of year can be called a low-level time code, and the time code with a division granularity of day can be called a high-level time code, etc. The prefix of the high-level time code includes the corresponding low-level time code. Here, the corresponding low-level time code refers to the low-level time code to which the high-level time code belongs, that is, the time indicated by the high-level time code is included in the time range indicated by the low-level time code.

[0173] Taking 1999 as an example, for each level within the 1999 time period, such as the monthly and daily levels, the prefix of the time codes for the grids within these levels includes the time code of the space-time grid of 1999. Assuming the time code for the space-time grid of 1999 is 1999, then the time codes for the 12 space-time grids obtained by dividing 1999 at the monthly granularity are 199901, 199902, 199903, ..., 199911, and 199912. The time codes for the 30 space-time grids obtained by dividing January 1999 at the daily granularity are 19990101, 19990102, 19990103, ..., 19990129, and 19990130. As can be seen, the prefix of the time code for a higher level includes the time code for the corresponding lower level.

[0174] It should be noted that the time code may be represented in other ways, for example, time may be mapped to other identifiers for representation. This solution does not limit the representation of the time code.

[0175] Based on the above introduction, after determining the spatial level and time division granularity, a space-time grid model can be constructed. For example, the space-time grid model can be found in Figure 8 . Figure 8 Each space-time grid in includes corresponding space information and time information. Figure 8 The dotted space-time grid a corresponds to the longitude and latitude of the Tiananmen Square area in Beijing, and the time information corresponding to the space-time grid a is June 1, 2019. In other words, the spatial information mapped by the space-time grid a is the longitude and latitude information passing through Tiananmen Square in Beijing, and the time information mapped is June 1, 2019.

[0176] In an embodiment of the present application, each space-time grid in the space-time grid model corresponds to a unique space-time hybrid code, which can be composed of the above-mentioned coding of the spatial grid area, i.e., spatial coding, and coding of time information, i.e., time coding.

[0177] Specifically, based on the above description, the spatial and temporal codes for each space-time grid can be calculated, and these spatial and temporal codes can be combined to obtain a hybrid space-time code for the space-time grid. Specific ways to combine spatial and temporal codes include collinear space-time, collinear space-time, collinear space-time-time, and cross-spatiotemporal hybrid collinearity.

[0178] The spatiotemporal collinear merging method involves combining the time code first and the spatial code second to create a spatiotemporal hybrid code. The resulting spatiotemporal hybrid code can be in the form of an integer or a string. For example, if the acquired time code is "2019100313" and the spatial code is 100101101110, then concatenating "2019100313" and 100101101110 to create the spatiotemporal hybrid code 2019100313100101101110 or "2019100313100101101110" is in the form of an integer, while the spatiotemporal hybrid code "2019100313100101101110" is in the form of a string. Alternatively, the time code can be converted to binary before concatenation.

[0179] The space-time collinear merging method involves concatenating the spatial code first and the temporal code second to create a space-time hybrid code. For example, the spatial code 100101101110 and the temporal code "2019100313" can be concatenated to create the space-time hybrid code 1001011011102019100313. Similarly, the resulting space-time hybrid code can be in the form of an integer or a string. For specific examples, see the description in the previous paragraph.

[0180] The spatiotemporal collinear merging method involves embedding the spatial code within the temporal code. For example, embedding the spatial code 100101101110 within the temporal code "2019100313" yields the spatiotemporal hybrid code 2019100101101110100313. The specific bit position for embedding can be pre-defined and is not restricted in this solution. Similarly, the resulting spatiotemporal hybrid code can be in the form of an integer or a string. For specific examples, see the description in the previous paragraph.

[0181] The space-time cross-mixed collinear merging method refers to converting both the space code and the time code into the same type of number such as binary, quaternary or decimal, and then performing a Morton cross operation on the converted space code and time code to obtain the space-time mixed code. The Morton cross operation can be a back-and-forth crossover of the space code and the time code, or a back-and-forth crossover of the time code and the space code. Optionally, after obtaining the space-time mixed code through the Morton cross operation, the space-time mixed code can also be converted into an integer of another base or into a string form.

[0182] For example, for the above Figure 8The space-time network a in the figure is encoded according to the latitude and longitude of the Tiananmen Square in Beijing, and the time code is encoded according to June 1, 2019. The space code and the time code are then merged in the above-mentioned merging method to obtain a space-time mixed code. The space-time mixed code is the unique code corresponding to the space-time network a.

[0183] In the embodiment of the present application, the space-time grid is also hierarchical, and the hierarchical division can be determined according to the preset spatial level and time division granularity. For example, assuming that the preset spatial levels include n1, n2, n3 and n4 levels, the n1, n2, n3 and n4 levels are from low to high levels, and the time division granularity includes year, month, day and hour, then the space-time grid mapped by the spatial grid of the spatial level n1 and the time grid obtained by dividing the time division granularity by year is the space-time grid of the first level, the space-time grid mapped by the spatial grid of the spatial level n2 and the time grid obtained by dividing the time division granularity by month is the space-time grid of the second level, the space-time grid mapped by the spatial grid of the spatial level n3 and the time grid obtained by dividing the time division granularity by day is the space-time grid of the third level, and the space-time grid mapped by the spatial grid of the spatial level n4 and the time grid obtained by dividing the time division granularity by hour is the space-time grid of the fourth level.

[0184] For the space-time hybrid coding of space-time grid mapping, the space coding part of the space-time hybrid coding still has the properties of the high-level space coding prefix including the corresponding low-level space coding, and the time coding part of the space-time hybrid coding still has the properties of the high-level time coding prefix including the corresponding low-level time coding. The low-level space-time hybrid coding corresponding to the high-level space-time hybrid coding can also be said to be: the low-level space-time hybrid coding to which the high-level space-time hybrid coding belongs. For ease of understanding, you can refer to the example Figure 9 .

[0185] exist Figure 9 In the space-time network layer (a), (a) and (b) are two adjacent space-time network layers. In the space-time network layer (a), it is assumed that there are 8 space-time networks, and the space-time hybrid codes of the 8 space-time networks are 002018, 012018, 102018, 112018, 002019, 012019, 102019 and 112019. Among them, 00, 01, 10 and 11 are space codes. Figure 3 The spatial hierarchical division method shown in the figure is as follows: 00, 01, 10, and 11 are level 1 spatial codes. Among the eight spatiotemporal mixed codes, 2018 and 2019 are time codes, and the division granularity is year.

[0186] In the space-time network level (b), the high-level space-time networks of the space-time networks 102018 and 112018 are exemplarily shown, wherein (b1) is the space-time network of the next higher level corresponding to the space-time network 102018, or the space-time mixed code 102018 is the mixed code to which the space-time mixed code in (b1) belongs; (b2) is the space-time network of the next higher level corresponding to the space-time network 112018, or the space-time mixed code 112018 is the mixed code to which the space-time mixed code in (b2) belongs. (b1) includes 48 space-time mixed codes, of which 1000, 1001, 1010 and 1011 are spatial codes. Assuming Figure 3 The spatial hierarchical division method shown in the figure is as follows: 1000, 1001, 1010, and 1011 are level 2 spatial codes. Among the 48 spatiotemporal mixed codes, 20181, ..., 201811, and 201812 are time codes with a division granularity of months, thus 1 to 12 months can be obtained.

[0187] It can be seen that the prefix (10) of the spatial code in the space-time hybrid code included in (b1) includes the spatial code (10) of the space-time hybrid code of the space-time network at the corresponding lower level (level (a)); the prefix (2018) of the time code in the space-time hybrid code included in (b1) includes the time code (2018) of the space-time hybrid code of the space-time network at the corresponding lower level (level (a)). For (b2), please refer to the relevant description of (b1) and will not be repeated here.

[0188] It should be noted that only the space (time) coding prefix of the high-level space-time network divided from the space-time network included in the low-level space-time network includes the space (time) coding of the low-level space-time network, and the space (time) coding prefix of the high-level space-time network does not include the space (time) coding of other low-level space-time networks. Figure 9 In the example, the prefix (10) of the spatial code in (b1) only includes the spatial code (10) of the space-time grid 102018 in level (a), but does not include the spatial code (11) of the space-time grid 112018 in level (a).

[0189] In addition, the number of bits of the prefix of the spatial code is determined by the number of bits of the spatial code at the lower level, for example Figure 9 In the example, if the spatial code of the lower level (level (a)) is two bits, then the prefix of the spatial code of the higher level (level (b)) is also two bits. Similarly, the number of bits of the prefix of the time code is determined by the number of bits of the time code of the lower level, for example, Figure 9 In the example, if the time code of the lower level (level (a)) is four bits, then the prefix of the time code of the higher level (level (b)) is also four bits.

[0190] above Figure 9 The space-time hybrid coding is introduced as an example of the coding obtained by splicing the space-time collinear merging method. It can also be the coding obtained by splicing the space-time collinear or space-time cross-mixed collinear merging methods. This solution does not limit this.

[0191] In another possible implementation, the spatial grid in the space-time grid model provided in the embodiment of the present application is not limited to being obtained based on the above-mentioned global discrete grid model, but can also be obtained based on a regional discrete grid model. The regional discrete grid model refers to performing spatial grid division and coding only for a certain preset area. The specific implementation of its grid division and spatial coding can refer to the grid division method and spatial coding method in the global discrete grid model. A certain preset area can be, for example, an area under the jurisdiction of a certain country or an area under the jurisdiction of a certain province, etc. The division and coding of time in the space-time grid model constructed based on the regional discrete grid model can be referred to the above-mentioned specific introduction, which will not be repeated here.

[0192] Based on the above description, the data processing method provided by the present application is described below through several embodiments. The execution subject of the data processing method provided in the embodiments of the present application can be a server that establishes a communication connection with a user terminal, or can be the user terminal itself. The following description takes the execution subject as an example of a server that establishes a communication connection with a user terminal.

[0193] Example 1

[0194] The following first introduces the data processing method for constructing and updating the database provided by the embodiment of the present application. Figure 10 The method may include but is not limited to the following steps:

[0195] S1001. The server obtains trajectory data of a trajectory.

[0196] In a specific embodiment, the trajectory can be a trajectory consisting of one trajectory point or a trajectory consisting of multiple trajectory points. The trajectory data obtained above can be the trajectory data of a recorded historical trajectory, or the trajectory data obtained can be the trajectory data regularly sent to the server by the user terminal. The server can be, for example, Figure 1 The server 100 shown, the user terminal can be, for example Figure 1 The user terminal 110 is shown.

[0197] The trajectory data may include the spatial location information of one or more trajectory points and the time information at that spatial location. In one possible implementation, the trajectory data may also include some attribute information of the object generating the trajectory. For example, if the object generating the trajectory is a vehicle, the attribute information may include one or more of the vehicle's license plate number, vehicle body color, passenger capacity, and vehicle price.

[0198] For the trajectory data of the recorded historical trajectory, if this data is stored in the server's memory, it can be read directly from the memory. If this data is stored in another device, the server can obtain the data by communicating with the device, and so on.

[0199] In the case where the user terminal regularly sends trajectory data to the server, the user terminal can record the trajectory data of its own trajectory through the positioning module and send it to the server. For ease of understanding, the following describes two scenarios by way of example.

[0200] Scenario 1: Ride-sharing Service

[0201] In the ride-sharing service scenario, the user terminal can be a vehicle or other devices in the vehicle, such as smart phones, tablet computers, etc. The user terminal can locate its own spatial position through its own positioning module, and record the time at the current spatial position, and then regularly send the located spatial position information and recorded time information to the server. The positioning module here can be a vehicle-mounted global positioning system (GPS) device or a positioning device in other devices in the vehicle. In one possible implementation, the vehicle and other related attribute information can also be sent to the server together.

[0202] Scenario 2: Companion Analysis Service Scenario

[0203] Companions here refer to people with similar travel trajectories. In the companion analysis service scenario, user terminals can be mobile terminals such as smartphones, smartwatches, and tablets. Similarly, user terminals can use their own positioning modules to locate their own spatial position, record the time spent in the current spatial position, and then periodically send their own spatial position information and recorded time information to the server. In one possible implementation, pedestrian-related attribute information can also be sent to the server.

[0204] S1002: The server encodes the acquired trajectory data to obtain a code of the corresponding trajectory.

[0205] In a specific embodiment, the server can encode the spatial position information and time information of one or more trajectory points passed by the above-mentioned trajectory, and then combine the spatial coding and time coding to obtain the space-time mixed coding corresponding to each trajectory point. The set of space-time mixed coding corresponding to one or more trajectory points passed by the trajectory is the coding of the trajectory.

[0206] Before encoding, the server needs to determine which space-time grid layer to encode at. Based on the previous description, different space-time grid layers have different spatial levels and time division granularity. Therefore, the same information will be encoded differently at different space-time grid layers.

[0207] In a possible implementation manner, the space-time grid level of the space-time hybrid coding may be pre-set and uniformly coded as a code of a certain space-time grid level.

[0208] In another possible implementation, the setting of the encoded space-time grid level can be set differently according to the different scenes in which the trajectory is located. For example, assuming that the trajectory is the trajectory of a pedestrian, since the speed of the pedestrian's trajectory is low and the range of the trajectory is not large, then the space-time grid level can be set to a higher level number. The higher the level number, the smaller the granularity of space and time division, which is convenient for expressing the trajectory more accurately. For another example, assuming that the trajectory is the trajectory of a vehicle or an airplane, since the speed of such trajectories is high and the range of the trajectory is relatively large, then the space-time grid level can be set to a lower level number. The lower the level number, the larger the granularity of space and time division, which can ensure that the trajectory is accurately expressed while saving the storage data of the trajectory, thereby saving storage space. In a specific embodiment, the scene to which the trajectory belongs can be analyzed by the acquired trajectory data, and then the corresponding space-time grid level can be matched. Alternatively, the trajectory data of each trajectory point of the same trajectory can be preprocessed to determine the moving speed and moving range of the trajectory, and then the corresponding space-time grid level can be determined according to the corresponding speed and range. For ease of understanding, the following is combined with Figure 11A Example introduction.

[0209] For ease of observation, Figure 11A The spatial grid is used as an example for introduction. The spatial grid can be mapped to the space-time grid. Figure 11AIn the figure, the bolded spatial grids represent the grids mapped to the area through which the trajectory passes. As can be seen, for the same trajectory, from level 1 to level 3, the higher the level, the more grids the trajectory occupies, meaning the more codes are required for the trajectory. Therefore, for trajectories with faster speeds and larger ranges, a lower-level space-time grid can be selected for encoding and mapping, saving storage space when storing the trajectory data. For trajectories with slower speeds and smaller ranges, a higher-level space-time grid can be selected for encoding and mapping, accurately representing the trajectory.

[0210] After determining the space-time grid level for coding, the server may obtain the space-time hybrid coding of the trajectory at the determined space-time grid level according to the trajectory data obtained above.

[0211] The following first introduces the process of the server encoding the spatial position information of one or more trajectory points passed by the above trajectory to obtain the spatial code.

[0212] This embodiment uses the global discrete equal latitude and longitude quadtree grid encoding method as an example. Specifically, the spatial location information of one or more trajectory points received by the server may be the longitude and latitude of these trajectory points. The spatial location of a trajectory point can be represented by longitude and latitude coordinates (lat, lon), where lat represents the latitude of the trajectory point and lon represents the longitude of the trajectory point.

[0213] Assuming that the spatial level in the determined coding space-time grid hierarchy is level n, where n is an integer, the spatial coding of the trajectory point (lat, lon) at level n can be directly calculated. The following example describes the calculation process of the spatial coding of the trajectory point (lat, lon).

[0214] First, calculate the row number of the trajectory point in the n-th level spatial grid and column number Among them, the symbol Indicates rounding down. Then, convert the row number Row and column number Col into binary numbers (Row)2 and (Col)2, respectively. Perform a Morton crossover operation with the parallel number (Row)2 first and the column number (Col)2 last to obtain the spatial code (GS)2 of the trajectory point. For example, assuming (Row)2 = 100111 and (Col)2 = 011010, then (GS)2 = 100101101110.

[0215] In this embodiment, the cross-space encoding method belongs to the encoding method of the Z-order space filling curve. In other possible embodiments, it can also be an encoding method based on the Hilbert curve, etc.

[0216] In a possible implementation, the row number Row and the column number Col may be converted into quaternary numbers, decimal numbers or character strings, and then a Morton crossover operation is performed to calculate the spatial code of the trajectory point.

[0217] Other methods may also be used to calculate the spatial encoding of the trajectory points, and this solution does not impose any restrictions on this.

[0218] Furthermore, as we've seen from the previous introduction to related concepts, time can be segmented at different granularities, such as year, month, day, hour, minute, and second, or it can be segmented according to user-defined time periods. User-defined time periods can be 30 minutes, 2.5 hours, and so on, and this solution doesn't impose any restrictions on this. Time information can then be encoded based on the pre-set time segmentation granularity. The specific time encoding method can be found in the description of the space-time grid model in the previous introduction to related concepts and will not be elaborated here.

[0219] After the server obtains the spatial and temporal codes for the aforementioned trajectory points (lat, lon), it can combine them to create a hybrid spatiotemporal code. The method for combining spatial and temporal codes can be found in the description of the space-time grid model in the previous related concept introduction and will not be repeated here. Using the above method, the hybrid spatiotemporal code for each trajectory point can be obtained.

[0220] S1003: When the trajectory includes multiple trajectory points, the server constructs a coding model of the trajectory by interpolation.

[0221] In a specific embodiment, the server pre-builds a space-time network model, which can be found in the description of the above-mentioned related concept introduction and Figure 8 The schematic diagram of the space-time grid model is shown, and will not be further described here. Each space-time grid in this space-time grid model is mapped to a unique space-time hybrid code. Therefore, after the server calculates the space-time hybrid code for each trajectory point, it can map each trajectory point to the space-time grid corresponding to its space-time hybrid code. If the space-time grids where the trajectory points are located are not continuous and adjacent, the server uses interpolation to approximate the actual trajectory of the trajectory.

[0222] If the space-time grid where each trajectory point is located is not continuous and adjacent, please refer to Figure 11B .exist Figure 11BIn the example, assume that the trajectory has three points, mapped to space-time grid 1, space-time grid 4, and space-time grid 7, respectively. As can be seen, these three space-time grids are not continuous and adjacent. If a broken line connects the three points, and this broken line is considered a trajectory, then the trajectory also passes through four space-time grids: space-time grid 2, space-time grid 3, space-time grid 5, and space-time grid 6. Therefore, the server needs to obtain the spatial position and time information mapped by these four space-time grids through interpolation, thereby obtaining the spatiotemporal hybrid encoding of these four space-time grids. This allows the trajectory to be mapped into the space-time grid model, passing through the seven grids: space-time grid 1, 2, 3, 4, 5, 6, and 7, to approximate the actual running trajectory.

[0223] Exemplarily, in a specific embodiment, the server can obtain new trajectory data by calculating the average value of the trajectory data of every two adjacent trajectory points of the multiple trajectory points, and the new trajectory data can represent the trajectory points of the trajectory. For example, assuming that the trajectory includes three trajectory points, the trajectory data of the three trajectory points include latitude, longitude and time, and are represented by three coordinates respectively: (lat1, lon1, t1), (lat2, lon2, t2) and (lat3, lon3, t3). Then, the average value of (lat1, lon1, t1) and (lat2, lon2, t2) can be calculated to obtain (lat4, lon4, t4), where lat4 = (lat1 + lat2) / 2, lon4 = (lon1 + lon2) / 2, and t4 = (t1 + t2) / 2. Then, the average of (lat2, lon2, t2) and (lat3, lon3, t3) is calculated to obtain (lat5, lon5, t5), where lat5 = (lat2 + lat3) / 2, lon5 = (lon2 + lon3) / 2, and t5 = (t2 + t3) / 2. Finally, the trajectory is represented by the five trajectory points (lat1, lon1, t1), (lat4, lon4, t4), (lat2, lon2, t2), (lat3, lon3, t3), and (lat5, lon5, t5). If the space-time grid mapped by the five trajectory points is still not a continuous and adjacent space-time grid, the server can calculate the average of the trajectory data of every two adjacent trajectory points based on the trajectory data of the five trajectory points to obtain the data of the new trajectory point, and use the obtained new trajectory point and the original five trajectory points to represent the above trajectory. The above method of calculating the average of the trajectory data of every two adjacent trajectory points to obtain new trajectory data can be iterated until the space-time grid mapped by the trajectory points of the trajectory is continuously adjacent.

[0224] In another possible implementation, the server may also calculate a continuous function of multiple trajectory points passing through the above trajectory, and then calculate multiple new trajectory points through the continuous function. These new trajectory points and the original trajectory points can be mapped to continuous adjacent space-time grids.

[0225] Here, the method of obtaining the interpolation of the new trajectory points of the above trajectory is introduced as an example. It can also be achieved through other methods, and this solution does not limit this.

[0226] Furthermore, the new trajectory points calculated using the interpolation method can also be encoded using the aforementioned spatiotemporal hybrid coding method to obtain spatiotemporal hybrid codes for these new trajectory points. These spatiotemporal hybrid codes can then be used to map the new trajectory points to the corresponding spatiotemporal grid. The code set consisting of the spatiotemporal hybrid codes of these new trajectory points and the spatiotemporal hybrid codes of the original trajectory points is the code for the trajectory. This code set can also be called the coding model for the trajectory, or in other words, the expression model for the trajectory.

[0227] In a possible implementation, the server may directly use the spatiotemporal mixed encoding of one or more trajectory points included in the trajectory data obtained in the above S1001 as the encoding of the trajectory, without the need for the above interpolation to obtain the continuous adjacent encodings mapped to the spatiotemporal space grid as the encoding of the trajectory.

[0228] S1004: The server constructs an index database based on the spatiotemporal hybrid coding of the acquired trajectory.

[0229] The index database can be a multi-level, multi-dimensional index tree. A multi-level index refers to a space-time grid index consisting of multiple levels from a low level to a high level. Multi-dimensional refers to an index encompassing multiple dimensions, including time and space. In some possible implementations, a multi-dimensional index can also include attribute dimensions. The levels of the index tree can be pre-defined. For example, the index tree can be a k-level index tree, where the kth level is the highest level of the index tree, and k is an integer greater than 1. Each level of the index tree can include one or more nodes.

[0230] The levels of the index tree have a mapping relationship with the space-time grid levels of the above-mentioned space-time grid model, and this mapping relationship is optional. For ease of understanding, let's take an example. For example, assuming that the above-mentioned space-time grid model includes 10 levels, and the levels of the index tree can be 5 levels, the 1st, 2nd, 3rd, 4th, and 5th levels of the index tree can be mapped to the 6th, 7th, 8th, 9th, and 10th levels of the space-time grid model, respectively. Alternatively, the 1st, 2nd, 3rd, 4th, and 5th levels of the index tree can be mapped to the 5th, 6th, 7th, 8th, and 9th levels of the space-time grid model, respectively. The hierarchical mapping between the index tree and the space-time grid model is selected and determined based on actual conditions, and this solution does not impose any restrictions on this.

[0231] The hierarchical mapping between the index tree and the space-time lattice model means that the nodes of the hierarchical levels in the index tree are associated one-to-one with some or all of the space-time hybrid codes in the corresponding space-time lattice level of the hierarchical mapping. For example, the nodes of the first level of the index tree are associated one-to-one with some or all of the space-time hybrid codes included in the sixth level of the space-time lattice model, and the nodes of the second level of the index tree are associated one-to-one with some or all of the space-time hybrid codes included in the seventh level of the space-time lattice model, etc.

[0232] In a specific embodiment, the index tree can be constructed by gradually adding the spatiotemporal hybrid codes of newly acquired trajectories. Specifically, the spatiotemporal hybrid codes of the acquired trajectories are encoded according to a preset spatial hierarchy and a preset temporal granularity. The preset spatial hierarchy and the preset temporal granularity are mapped to a certain spatiotemporal grid level. The certain spatiotemporal grid level is mapped to a certain level in the index tree. The certain level can be any level in the index tree. Hereinafter, the certain level is referred to as the preset index level.

[0233] In one possible implementation, according to the relevant description in S1002 above, the spatiotemporal hybrid coding of trajectories of different scenes may correspond to different spatiotemporal grid levels, so the spatiotemporal hybrid coding of trajectories of different scenes may also correspond to different levels of the index tree.

[0234] After the preset index level is determined, the spatiotemporal hybrid code obtained by encoding the preset spatial level and the preset time granularity can be used as the index of the preset index level of the index tree, or as the node of the preset index level of the index tree.

[0235] Assuming that the spatiotemporal hybrid codes of the acquired trajectories are the first batch of codes used to construct the index tree, and the spatiotemporal hybrid codes of the acquired trajectories are different, the server can add these spatiotemporal hybrid codes to the index tree as nodes of the preset index level.

[0236] In addition, the server also stores the trajectory identification and trajectory metadata of the above-mentioned trajectory together in the storage space corresponding to the node of the preset index level. Specifically, the server stores the trajectory identification and trajectory metadata of the trajectory in the nodes corresponding to all spatiotemporal hybrid codes of the trajectory, that is, the trajectory identification and trajectory metadata of the trajectory are stored in each spatiotemporal hybrid code node belonging to the same trajectory. In this application, the trajectory identification and trajectory metadata of the trajectory can be collectively referred to as trajectory information. The trajectory information stored in the node corresponding to the spatiotemporal hybrid code can be said to be the trajectory information mapped by the spatiotemporal hybrid code.

[0237] The track identifier is used to uniquely identify a track in the index database. For example, for a vehicle track, the track identifier may be a license plate number or the like.

[0238] The above-mentioned trajectory metadata includes the trajectory length, which is the number of consecutive space-time grids mapped to the trajectory points of a trajectory described in step S1003 in the space-time grid model. In other words, the trajectory length is the total number of new trajectory points of a trajectory obtained by the interpolation method in step S1003 and the original trajectory points of the trajectory. In other words, the trajectory length is the number of spatiotemporal hybrid codes of a trajectory in the code set obtained in step S1003.

[0239] In one possible implementation, the trajectory metadata also includes other information, such as the number of levels of the space-time grid of the hybrid space-time coding mapping, the minimum bounding box, and the duration of the trajectory. This information can be stored in the corresponding space-time hybrid coding node along with the trajectory identifier and trajectory length. The minimum bounding box refers to the spatial location information mapped by the space-time grid of the hybrid space-time coding mapping, for example, the latitude and longitude of the upper left corner and the latitude and longitude of the lower right corner of the spatial location mapped by the space-time grid.

[0240] If the acquired trajectories have identical spatiotemporal hybrid codes, then for the identical spatiotemporal hybrid codes, only one spatiotemporal hybrid code is added to the above-mentioned index tree as a node at the preset index level. However, the server stores the trajectory identifiers and trajectory metadata of the multiple trajectories to which the identical spatiotemporal hybrid code belongs in the node of the spatiotemporal hybrid code. For example, if the code set of the first trajectory and the code set of the second trajectory have the same spatiotemporal hybrid code, the service adds the identical spatiotemporal hybrid code to the above-mentioned index tree as a node at the preset index level, and stores the trajectory identifiers and trajectory metadata of the first and second trajectories in the node.

[0241] After the above operations, the server has constructed multiple nodes in the index tree at the preset index level. Furthermore, based on the foregoing description, it can be seen that the spatial coding portion of the spatiotemporal hybrid coding has the attributes of a high-level spatial coding prefix including the corresponding low-level spatial coding, and the temporal coding portion of the spatiotemporal hybrid coding has the attributes of a high-level temporal coding prefix including the corresponding low-level temporal coding. Therefore, based on the spatiotemporal hybrid coding of the nodes at the preset index level in the index tree, the spatiotemporal hybrid coding of the nodes at each level below the preset index level in the index tree can be constructed.

[0242] Specifically, first construct the space-time mixed code of the node one level lower than the preset index level. The server can determine the number of bits of the spatial coding prefix (assuming it is w1 bits, w1 is an integer) and the number of bits of the time coding prefix (assuming it is w2 bits, w2 is an integer) of the space-time mixed code in the preset index level according to the number of spatial coding bits and time coding bits of the space-time mixed code of the space-time grid level mapped one level lower than the preset index level in the index tree.

[0243] Then, the server can search for the existence of the same first w1 bits of code in the spatial coding part of the space-time mixed code of the preset index level, and search for the existence of the same first w2 bits of code in the time coding part of the space-time mixed code of the preset index level. If both exist, the spatial code with the same first w1 bits and the time code with the same first w2 bits are merged together by the above-mentioned merging method of spatial coding and time coding to obtain a new space-time mixed code. The merging method of spatial coding and time coding here is the same as the merging method of space-time mixed coding of the preset index level, that is, the coding rules of space-time mixed coding need to be consistent. The server adds the new space-time mixed code to the index tree as a node one level lower than the preset index level. The node is the parent node of the space-time mixed code with the same first w1 bits of spatial coding and the same first w2 bits of time coding in the space-time mixed code of the preset index level.

[0244] If a space-time hybrid code exists in the space-time hybrid codes at the preset index level, and no other space-time hybrid code has the same first w1 bits of its spatial code as the space-time hybrid code, and the same first w2 bits of its temporal code, then the server can construct a parent node in the index tree for the space-time hybrid code alone. The method for constructing this parent node is described in the previous paragraph and is not repeated here.

[0245] After the server has created parent nodes for all spatiotemporal hybrid codes at the preset index level, these parent nodes form multiple nodes in the index tree one level below the preset index level. If the index level one level below the preset index level is not already the lowest level in the index tree, the server continues to construct nodes two levels below the preset index level.

[0246] Specifically, based on the above-constructed spatiotemporal mixed coding of multiple nodes one level lower than the preset index level, the spatiotemporal mixed coding of nodes two levels lower than the preset index level is constructed. Similarly, the server can determine the number of bits of the spatial coding prefix (assuming it is w3 bits, w3 is an integer) and the number of bits of the time coding prefix (assuming it is w4 bits, w4 is an integer) of the spatiotemporal mixed coding in the preset index level according to the number of spatial coding bits and time coding bits of the spatiotemporal mixed coding of the spatiotemporal grid level mapped two levels lower than the preset index level in the index tree.

[0247] Then, the server can search for the existence of the same first w3 bits of code in the spatial coding part of the spatiotemporal mixed code of the multiple nodes one level lower than the preset index level, and search for the existence of the same first w4 bits of code in the time coding part. If both exist, the spatial code with the same first w3 bits and the time code with the same first w4 bits are merged together by the above-mentioned merging method of spatial coding and time coding to obtain a new spatiotemporal mixed code. The merging method of spatial coding and time coding here is the same as the merging method of spatiotemporal mixed code of the preset index level, that is, the coding rules of spatiotemporal mixed code need to be consistent. The server adds the new spatiotemporal mixed code to the index tree as a node two levels lower than the preset index level. The node is the parent node of the spatiotemporal mixed code with the same first w1 bits of spatial coding and the same first w2 bits of time coding in the above-mentioned spatiotemporal mixed code one level lower than the preset index level.

[0248] Similarly, if there is a space-time hybrid code in the space-time hybrid code at a level lower than the preset index level, and no other space-time hybrid code has the same first w3 bits of its spatial code as the space-time hybrid code, and the same first w4 bits of its temporal code, then the server can construct a parent node in the index tree for the space-time hybrid code alone. The method for constructing this parent node is described in the previous paragraph and will not be repeated here.

[0249] The server can construct the index tree layer by layer according to the above method of constructing the nodes at the lower level of the index tree until the nodes at the lowest level of the index tree, i.e., the first level, are constructed, thereby completing the construction of the preliminary index tree. Figure 12 , Figure 12The schematic diagram of the structure of the constructed preliminary index tree is shown as an example. Figure 12 It is assumed that the index tree has three levels, the third level is the above-mentioned preset index level, the second level is the above-mentioned index level one level lower than the preset index level, and the first level is the above-mentioned index level two levels lower than the preset index level, which is also the lowest level of the index tree.

[0250] The index tree constructed above is only a preliminary index tree. The server will periodically obtain more trajectory data, then perform spatiotemporal encoding on more trajectories, and add the spatiotemporal mixed encoding of these newly obtained trajectories to the index tree.

[0251] By way of example, the following describes a process of adding the spatiotemporal hybrid encoding of a newly acquired trajectory to the index tree.

[0252] Taking one of the spatiotemporal hybrid codes of a newly acquired trajectory as an example, this code can be referred to as the first spatiotemporal hybrid code. The server can compare the prefix of the spatial code of the first spatiotemporal hybrid code with the spatial codes of the spatiotemporal hybrid codes at each level in the index tree layer by layer, and compare the prefix of the time code of the first spatiotemporal hybrid code with the time codes of the spatiotemporal hybrid codes at each level in the index tree layer by layer.

[0253] If there are two such levels in the index tree, assuming they are called L level and H level respectively, and the H level is one level higher than the L level in the index tree, the spatial coding prefix of the first spatiotemporal mixed code includes the spatial coding of a certain spatiotemporal mixed code of the L level, and the time coding prefix of the first spatiotemporal mixed code also includes the time coding of the certain spatiotemporal mixed code; however, none of the spatial coding (or time coding) of all the spatiotemporal mixed codes of the H level is included in the prefix of the spatial coding (or time coding) of the first spatiotemporal mixed code. Then, the server adds the first spatiotemporal mixed code to the H level as a node of the H level, and configures the above-mentioned spatiotemporal mixed code as the parent node of the first spatiotemporal mixed code node. At the same time, the server stores the trajectory identifier and trajectory metadata of the trajectory to which the first spatiotemporal mixed code belongs in the storage space corresponding to the first spatiotemporal mixed code node.

[0254] If none of the spatial codes (or time codes) of the spatiotemporal hybrid codes at all levels in the index tree are included in the prefix of the spatial code (or time code) of the first spatiotemporal hybrid code, then the server adds the first spatiotemporal hybrid code to the highest level of the index tree as a node of the highest level, and then constructs the index code nodes of the lower levels corresponding to the code based on the first spatiotemporal hybrid code. The specific method of constructing the lower-level nodes is described above and will not be repeated here. At the same time, the server stores the trajectory identifier and trajectory metadata of the trajectory to which the first spatiotemporal hybrid code belongs in the storage space corresponding to the first spatiotemporal hybrid code node.

[0255] If there is a spatiotemporal hybrid code in the index tree that is the same as the first spatiotemporal hybrid code, the server directly stores the track identifier and track metadata of the track to which the first spatiotemporal hybrid code belongs in the storage space corresponding to the spatiotemporal hybrid code node.

[0256] In summary, the server can gradually improve the index database through the methods introduced above.

[0257] In a possible implementation, the server may also store the attribute information of the trajectory in the storage space corresponding to the corresponding spatiotemporal hybrid coding node. The above S101 has a description of the attribute information of the trajectory, which will not be repeated here.

[0258] In a specific embodiment, the server may directly store the attribute information of the trajectory in the storage space corresponding to each spatiotemporal hybrid coded node of the trajectory in the index tree.

[0259] Alternatively, the server can first encode the attribute information of the trajectory and then store the attribute information encoding in the storage space corresponding to each spatiotemporal hybrid encoding node of the trajectory in the index tree. For example, the server can also segment the range of the attribute value, and each segment can be assigned a code. If the attribute information cannot be represented by a numerical value, the attribute information can be categorized, and each category can be assigned a code, and so on, to achieve the encoding of the attribute information. For example, assuming that the attribute information includes the color of the vehicle and the number of passengers it can carry, for the vehicle color attribute, each color can be represented by a code, for example, white is coded as 00, red is coded as 01, and so on. For the number of passengers, the range can be divided into ranges, and each range can be represented by a code. For example, the number of passengers in the range of 1 to 4 can be coded as 10, the number of passengers in the range of 5 to 10 can be coded as 11, and so on. This is just an example. The specific range, classification, and coding will be determined according to actual circumstances and are not limited by this solution.

[0260] S1005: The server constructs a trajectory database based on the trajectory data obtained in S1001.

[0261] In an embodiment of the present application, a trajectory database is used to store the trajectory data of each trajectory acquired by the server. When constructing the trajectory database, the trajectory identifier can be used as an index for the corresponding trajectory data. That is, the identifiers of multiple trajectories included in the index database are associated with the trajectory data of multiple trajectories in the trajectory database in a one-to-one correspondence.

[0262] In a possible implementation, the server may also store the spatiotemporal hybrid encoding of the trajectory in a trajectory database.

[0263] In addition, to solve the storage consistency problem of indefinite-length trajectories (where the data lengths of different trajectories vary greatly), a segmented trajectory storage method can be used. Trajectories are segmented according to the spatiotemporal range corresponding to the spatiotemporal grid and stored in a trajectory identifier plus segment identifier mode. The segmented metadata of the trajectory can also be stored. The segmented metadata includes but is not limited to the time range of the trajectory segment, the spatiotemporal grid to which it belongs, the length of the trajectory segment, and other attributes.

[0264] In an embodiment of the present application, the index database can be stored in a high-speed storage medium, such as memory, a solid-state disk (SSD), or other storage medium. A solid-state drive (SSD) is also known as a solid-state hard disk. This facilitates faster search for similar trajectories during trajectory similarity queries, thereby improving query efficiency. The trajectory database can also be stored in a low-speed storage medium, such as a mechanical disk.

[0265] Example 2

[0266] The following first introduces another data processing method for constructing and updating a database provided by an embodiment of the present application.

[0267] In one possible implementation, the trajectory attribute information can be encoded to obtain an attribute code, which can then be incorporated into the spatiotemporal hybrid code to obtain a multi-dimensional hybrid code. For details on the encoding of the trajectory attribute information, refer to the description of the attribute information encoding in step S1004 above and will not be repeated here.

[0268] If the attribute information includes multiple pieces of information, then the multiple pieces of information can be encoded separately to obtain multiple codes, and then the multiple codes can be combined together in a preset order to form a code sequence. This code sequence is the attribute code of the trajectory. For example, suppose the attribute information of the trajectory includes the color of the vehicle and the number of passengers it can carry. The color of the vehicle is white and the number of passengers it can carry is 4. Then, assuming that according to the preset coding rules, the color of the vehicle is white and the number of passengers it can carry is coded as 00, and the number of passengers 4 falls within the range of 1 to 4 and can be coded as 10. Assuming that the code of the attribute of the vehicle color is placed first and the code of the attribute of the number of passengers is placed last, the code sequence of 0010 can be obtained. This code sequence is the attribute code of the trajectory.

[0269] After the server obtains the spatiotemporal hybrid code and the attribute code of each track point in the trajectory through the method described above, it can merge the attribute code of the track into the spatiotemporal hybrid code of each track point to obtain a multi-dimensional hybrid code for each track point. For example, the attribute code of the track can be directly spliced ​​into the spatiotemporal hybrid code of each track point in the trajectory as a suffix or prefix of the spatiotemporal hybrid code. For example, assuming the spatiotemporal hybrid code is 11002018 and the attribute code is 0010, then the attribute code can be spliced ​​after the spatiotemporal hybrid code as a suffix, resulting in a multi-bit hybrid code of 110020180010. Alternatively, the attribute code can be spliced ​​before the spatiotemporal hybrid code as a prefix, resulting in a multi-bit hybrid code of 001011002018. Of course, this is only an example of how to merge the spatiotemporal hybrid code with the attribute code. The spatiotemporal hybrid code and the attribute code can also be merged in other ways, and this solution does not limit this.

[0270] In this application, the multidimensional hybrid code can also be mapped one-to-one to the space-time grid in the above-mentioned space-time grid model. In one possible implementation, the space-time grid mapped to the multidimensional hybrid code and the space-time hybrid code in the multidimensional hybrid code is the same grid, so that the multidimensional hybrid code can be mapped one-to-one to the space-time grid of the space-time grid model.

[0271] After the server obtains the multidimensional hybrid codes for each trajectory, it constructs an index database and a trajectory database based on these multidimensional hybrid codes. The specific construction methods can be found in the corresponding descriptions of S1004 and S1005 above and will not be repeated here. It should be noted that the index database constructed in this embodiment 2 does not need to include the attribute information of the trajectory.

[0272] Example 3

[0273] Based on the index database constructed above, similar trajectory queries can be performed. The following describes the data processing method for similar trajectory queries. Figure 13 The method may include but is not limited to the following steps:

[0274] S1301: The server obtains first information, where the first information includes spatial position data and time data of one or more track points of a first track.

[0275] In a specific embodiment, the first information may be sent from a user terminal to the server, or may be information input by a user and obtained by the server through a user interface (UI) displayed on its own device. The first trajectory may be any trajectory for which a similar trajectory is to be queried. The spatial location data of the trajectory point may include the latitude and longitude information of the trajectory point, and the time data of the trajectory point may include the time when the object generating the first trajectory was at the spatial location of the trajectory point.

[0276] For example, in a ride-sharing service scenario, the above-mentioned first trajectory can be the itinerary entered by the user on a user terminal such as a mobile phone or smart watch, and then the server uses the itinerary as the first trajectory to search for vehicles with a current passenger-carrying vehicle itinerary similar to the first trajectory. The itinerary can include the departure place, destination point, departure time, etc., so the departure place and destination point are the two trajectory points of the trajectory. In the companion analysis scenario, the first trajectory can be the trajectory of a specific user in a certain time period, which can be obtained by querying the corresponding database, and then the server uses the trajectory as the first trajectory to query which users are traveling with the user in the same time period (i.e., with similar trajectories).

[0277] The server may be, for example, Figure 1 The server 100 shown, the user terminal can be, for example, Figure 1 The user terminal 110 is shown.

[0278] In a possible implementation, the first information may further include attribute data associated with the first trajectory. The attribute data is the attribute information of the trajectory described above, which will not be described in detail here.

[0279] S1302: The server obtains a first mixed coding set according to the first information. The first mixed coding set is used to search the index database for a trajectory similar to the first trajectory.

[0280] The index database is the index tree described in the above-mentioned embodiment 1 and embodiment 2.

[0281] In one possible implementation, the first hybrid code set includes a spatiotemporal hybrid code at a preset level in the index database for each trajectory point in the first information. For a description of spatiotemporal hybrid coding, see Example 1 above. In another possible implementation, where the first information also includes attribute data associated with the first trajectory, the first hybrid code set includes a multidimensional hybrid code at a preset level in the index database for each trajectory point in the first trajectory. For a description of multidimensional hybrid coding, see Example 2 above. The following describes two different scenarios.

[0282] In the first case, the first mixed coding set includes a temporal and spatial mixed coding of each trajectory point in the first information at a preset level in the index database. This case can be implemented based on the index database constructed in the first embodiment.

[0283] In a specific embodiment, the server can encode the spatial position data and time data of one or more trajectory points of the above-mentioned first trajectory to obtain the spatiotemporal mixed coding of the one or more trajectory points. Specifically, the server can first determine which spatiotemporal grid level the coding is for. Since the spatiotemporal grid level has a mapping relationship with the level of the index database, i.e., the index tree, after the spatiotemporal grid level is determined, the level of the index tree is also determined. Assuming that the level of the determined index tree is the above-mentioned preset level, the preset level can be any level in the index tree. Then, spatial coding and time coding are performed on each trajectory point of the first trajectory respectively, and then the spatial coding and time coding of each trajectory point are merged to obtain the spatiotemporal mixed coding of the trajectory point. The specific coding process can be referred to the description in S1002 in the above-mentioned embodiment 1, which will not be repeated here.

[0284] In the second case, the first mixed code set includes a multi-dimensional mixed code of a preset level in the index database for each trajectory point in the first information. This case can be implemented based on the index database constructed in the second embodiment.

[0285] Based on the description of Example 2, it can be seen that the multidimensional hybrid coding is obtained by combining the spatiotemporal coding, spatial coding and attribute coding of the trajectory points. The specific encoding process of the multidimensional hybrid coding can be found in the description of Example 2 above and will not be repeated here.

[0286] S1303: The server searches the index database for trajectory information of m candidate similar trajectories similar to the first trajectory according to the first mixed coding set, where m is an integer.

[0287] In a specific embodiment, after obtaining the first hybrid code set for the first trajectory, the server may search the index database for codes identical to the codes in the first hybrid code set. If the found hybrid codes are mapped to trajectory information, the multiple hybrid codes mapped to the trajectory information may be referred to as a second hybrid code set.

[0288] The following describes a specific search process by taking a certain code in the first mixed code set as an example, assuming that the certain code is called the first code.

[0289] Based on the above description, it can be seen that no matter whether it is spatiotemporal mixed coding or multi-dimensional mixed coding, the prefix of the spatial coding in the high-level mixed coding in the index tree includes the corresponding low-level spatial coding, and the prefix of the time coding in the high-level mixed coding includes the corresponding low-level time coding. Spatiotemporal mixed coding and multi-dimensional mixed coding are collectively referred to as mixed coding below. Then, the server can start from the lowest level of the index tree, that is, the first-level mixed coding, and find the mixed coding with the same spatial prefix and time prefix as the first coding, and then continue to search for the mixed coding with the same spatial prefix and time prefix as the first coding in the second-level mixed coding with the node of the mixed coding as the parent node, and search layer by layer until a code that is exactly the same as the first code is found.

[0290] For easier understanding, see Figure 12Assuming that the first code is 00000120180512, the server can compare the spatial code of the first-level code, i.e., the first two digits, with the first two digits of the spatial code of the first code 00000120180512, i.e., 00, and compare the time code of the first-level code, i.e., the last four digits, with the first four digits of the time code of the first code 00000120180512, i.e., 2018, to determine that 002018 is the matching mixed code of the first level. Then, in the second-level mixed code with 002018 as the parent node, namely 0000201805 and 0011201808, the server can compare the spatial codes of the two codes, namely the first 4 bits of the code, with the first 4 bits of the spatial code of the first code 00000120180512, namely 0000, and compare the time codes of the two codes, namely the last 6 bits of the code, with the first six bits of the time code of the first code 00000120180512, namely 201805, to determine that 0000201805 is the matching second-level mixed code. Then, in the third-level mixed code with 0000201805 as the parent node, namely 00000120180512, 00001020180520 and 00001120180528, the server can compare the spatial codes of the three codes, namely the first 6 bits of the code, with the first 6 bits of the spatial code of the first code 00000120180512, namely 000012, and compare the time codes of the three codes, namely the last 8 bits of the code, with the first 8 bits of the time code of the first code 00000120180512, namely 20180512, and finally find the first code 00000120180512.

[0291] Alternatively, the server can obtain the lower-level mixed code corresponding to the first code based on the first code according to the coding rules of the mixed codes at each level of the index tree, and then query and compare level by level based on the obtained lower-level mixed code, and finally find the candidate mixed code of the level corresponding to the first code, and then compare the first code with the candidate mixed code until a code that is exactly the same as the first code is found.

[0292] For easier understanding, see Figure 12Assuming the first code is 00000120180512, the corresponding lower-level mixed code can be obtained based on the first code, that is, the second-level code is 0000201805, and the first-level code is 002018. Then, the server can find 002018 in the first level, and then find 0000201805 in the second-level codes corresponding to 002018, namely 0000201805 and 0011201808. Then, the server can compare and find 00000120180512, 00001020180520, and 00001120180528 in the third-level codes corresponding to 0000201805 to find 00000120180512.

[0293] If no code that is exactly the same as the first code is found after comparison, it indicates that the first code does not exist in the index tree.

[0294] Each code in the first mixed code set is searched in the index tree as described above. If an identical code is found in the index tree, all trajectory identifiers and trajectory lengths stored in the node storage space of the identical code are read. After reading the trajectory identifiers and trajectory lengths stored in all nodes with the same code, the server can distinguish each trajectory by trajectory identifier, and these trajectories are then identified as candidate similar trajectories.

[0295] In another possible implementation, the trajectory information of candidate similar trajectories is not necessarily stored in the storage space corresponding to the nodes of the encoding that is the same as the encoding of the first hybrid encoding set in the index tree, but can also be stored in the storage space of the lower-level and / or higher-level encoding nodes corresponding to these same encodings.

[0296] Based on the description of the previous embodiment, it can be seen that for trajectory points in trajectories with faster speeds and wider movement ranges, they can be encoded according to the space-time grid coding rules of a lower level and mapped to nodes at a lower level in the index tree. However, for trajectory points in trajectories with slower speeds and narrower movement ranges, they can be encoded according to the space-time grid coding rules of a higher level and mapped to nodes at a higher level in the index tree. The server can then use the trajectory corresponding to the trajectory identifier stored in the storage space of the lower-level and / or higher-level nodes corresponding to the nodes in the index tree that have the same coding as the coding of the first hybrid coding set as candidate similar trajectories.

[0297] For example, for the lower level, assuming that a code in the fifth level of the index tree is the same as a code in the first mixed code set, and the storage space of the parent node of the node of the code in the fifth level stores information such as the trajectory identifier and trajectory length, then the server can determine the trajectory corresponding to the trajectory identifier stored in the storage space of the parent node as a candidate similar trajectory. If the storage space of the parent node still stores the trajectory identifier and trajectory length, it can also be determined as a candidate similar trajectory.

[0298] For another example, for a high-level node, suppose a code in the fifth level of the index tree is the same as a code in the first mixed code set, and the child node of the node of the fifth level code, i.e., the node in the corresponding next level, stores information such as the trajectory identifier and trajectory length. In this case, the server can determine the trajectory corresponding to the trajectory identifier stored in the storage space of the child node as a candidate similar trajectory. If the storage space of the child node still stores the trajectory identifier and trajectory length, it can also be determined as a candidate similar trajectory.

[0299] In one possible implementation, for the first case in S1302 above, the codes in the first hybrid coding set are spatiotemporal hybrid codes and do not include attribute information of the first trajectory. However, the first information also includes attribute information of the first trajectory, and candidate similar trajectories matching the attribute information need to be screened based on the attribute information. In this case, the server may perform screening based on the attribute information of the first trajectory again based on the multiple trajectories found above.

[0300] Specifically, if the index database directly stores the attribute information of the trajectory in the storage space corresponding to the hybrid-coded node, the server can directly compare the attribute information of the first trajectory with the attribute information of the multiple trajectories found above. If the attribute information of the first trajectory is the same as the attribute information of a certain trajectory or falls within the range of the attribute information of the certain trajectory, then the certain trajectory can be determined as a candidate similar trajectory.

[0301] If the index database stores the encoding of trajectory attribute information in the storage space corresponding to the hybrid-encoded node, the server must first encode the attribute information of the first trajectory. The specific encoding process is described in S1004 of the first embodiment and will not be repeated here. The encoding of the attribute information of the first trajectory is then compared with the encoding of the attribute information of the multiple trajectories found above. If the encoding of the attribute information of the first trajectory and the encoding of the attribute information of a particular trajectory are the same, the particular trajectory can be determined as a candidate similar trajectory.

[0302] If the index database does not store the attribute information of a certain track among the multiple tracks found above, the server may determine the certain track as a candidate similar track, or the server may determine that the certain track does not belong to the candidate similar track.

[0303] Through the above method, the server can screen out the m candidate similar trajectories and obtain the trajectory information of the candidate similar trajectories from the storage space of the corresponding encoding node.

[0304] S1304: The server calculates similarities between the first trajectory and the m candidate similar trajectories according to the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories.

[0305] After obtaining the candidate similar trajectories, the server calculates the similarity between the first trajectory and the candidate similar trajectories based on the identifiers and lengths of each of the candidate similar trajectories and the length of the first trajectory. The following describes the similarity calculation process using one of the candidate similar trajectories (referred to as the first candidate trajectory) as an example.

[0306] Specifically, the server can calculate the number of times the trajectory identifier of the first candidate trajectory appears in the trajectory identifier read above, that is, calculate the number of times the trajectory identifier of the first candidate trajectory appears in all the trajectory identifiers read. In other words, the server can calculate the number of mixed codes in the second mixed code set obtained above that map the trajectory identifier of the first candidate trajectory. Since each trajectory identifier read corresponds to a mixed code, and each mixed code corresponds to a trajectory point, the number of occurrences of the trajectory identifier of the first candidate trajectory is the number of the same mixed codes in the first candidate trajectory and the first trajectory, and also the number of the same trajectory points in the first candidate trajectory and the first trajectory. Then, the server calculates the similarity of the two trajectories based on the number of the same mixed codes and the trajectory lengths of the first candidate trajectory and the first trajectory according to the actual needs of different scenarios.

[0307] Before introducing the calculation of similarity, we first define the corresponding amount of calculation.

[0308] Assume that the first hybrid coding set of the first trajectory is C A In addition, assuming that the trajectory length of the first candidate trajectory read above is |C B |, C B The number of the same mixed codes in the mixed code of the first candidate trajectory and the first trajectory is |C A ∩C B The following example introduces the calculation of trajectory similarity for several scenarios.

[0309] The first scenario is a general application scenario with no special features.

[0310] In this scenario, the similarity between the first candidate trajectory and the first trajectory can be calculated using the following formula:

[0311]

[0312] In this formula, GSIM represents similarity, and K is greater than 0. The coefficient K is added here to take into account the situation where similarity calculations are performed between trajectories corresponding to mixed codes at different levels. When K is equal to 1, it indicates that the mixed code of the first trajectory and the mixed code of the first candidate trajectory are mixed codes at the same level in the index tree. When K is greater than 1, it indicates that the level of the mixed code of the first candidate trajectory in the index tree is lower than the level of the mixed code of the first trajectory in the index tree. When K is greater than 0 and less than 1, it indicates that the level of the mixed code of the first candidate trajectory in the index tree is higher than the level of the mixed code of the first trajectory in the index tree. The two cases of K being greater than 1 and K being greater than 0 and less than 1 correspond to the case described in S1303 above that "the server can use the trajectory corresponding to the trajectory identifier stored in the storage space of the low-level and / or high-level nodes corresponding to the nodes with the same code as the code of the above-mentioned first mixed code set in the index tree as candidate similar trajectories."

[0313] Optionally, the above K can be 2 q , where q is an integer. q represents the level difference between the hybrid encoding of the first candidate trajectory and the hybrid encoding of the first trajectory in the index tree. When q is a negative integer, it corresponds to the case where K is greater than 0 and less than 1; when q is 0, it corresponds to the case where K is equal to 1; when q is a positive integer, it corresponds to the case where K is greater than 1. K can be used to balance the impact of inconsistent space-time grids and actual path lengths between trajectory mappings at different levels.

[0314] The second scenario focuses on the accompanying features between trajectories, such as ride-sharing or crime tracking.

[0315] In this scenario, the similarity between the first candidate trajectory and the first trajectory can be calculated using the following formula:

[0316]

[0317] This calculation can improve the accuracy of the similarity calculation between the two trajectories in the second scenario.

[0318] The third scenario focuses on the similarity with the source trajectory, such as epidemic analysis and tracking.

[0319] In this scenario, the similarity between the first candidate trajectory and the first trajectory can be calculated using the following formula:

[0320]

[0321] The formulas for similar calculations in the embodiments of the present application are not limited to the ones introduced above. The specific calculation formulas are determined according to actual conditions, and this solution does not impose any restrictions on this.

[0322] S1305: The server selects trajectory data of N similar trajectories, where N is an integer greater than or equal to m.

[0323] Based on the above description, after the server calculates the similarity between each candidate similar trajectory and the first trajectory based on the corresponding scenario, it can sort these similarities from high to low and filter out the N candidate similar trajectories corresponding to the top N similarities. These N candidate similar trajectories are the N similar trajectories finally found. To facilitate understanding of the correspondence between similarity and candidate trajectories, let's assume that the similarity between the first candidate trajectory and the first trajectory is the first similarity. Then, the candidate trajectory corresponding to the first similarity is the first candidate trajectory.

[0324] In another possible implementation, the server may also filter out the N similar trajectories based on a preset threshold. For example, assuming that the preset threshold for similarity is 0.6, then as long as the calculated similarity between two trajectories is greater than or equal to 0.6, the candidate trajectory corresponding to the similarity is a trajectory similar to the first trajectory.

[0325] This is just an example of how to filter similar trajectories. This solution does not limit the specific filtering method.

[0326] After the server has screened the N similar trajectories, if the first information comes from a user terminal, the server may send the trajectory data of the N similar trajectories, such as the trajectory identifier and trajectory attribute information, to the user terminal. If the first information comes from the UI of the server's own device, the server may display the trajectory data of the N similar trajectories on the display interface of the server's own device.

[0327] In addition, it should be noted that the above-mentioned N can be specified by the user. For example, the specific value of N can be sent or input to the server together with the above-mentioned first information. Alternatively, the specific value of N can be obtained by the user terminal from a separate instruction input by the user and sent to the server, or the server itself can obtain the specific value from a separate instruction input by the user, etc.

[0328] Example 4

[0329] In another possible implementation, to ensure the robustness of the trajectory similarity query algorithm and avoid missing potential similar trajectories, the first mixed code set of the first trajectory in the third embodiment is a set of mixed codes after the first trajectory is expanded.

[0330] In a specific embodiment, the server may expand the first trajectory according to a preset trajectory expansion rule. For example, the preset trajectory expansion rule may be: in the space-time grid model, the hybrid codes corresponding to the space-time grid directly adjacent to the space-time grid mapped by the hybrid code of the first trajectory are all hybrid codes based on the expansion of the first trajectory. Then, the hybrid code of the first trajectory expansion and the hybrid code before expansion together constitute the above-mentioned first hybrid code set. Directly adjacent means that there is a common boundary or vertex contact between the two grids, for example, see Figure 14 , Figure 14 (a), (b), (c) and (d) in the figure are schematic diagrams showing two space-time grids that are directly adjacent to each other.

[0331] Alternatively, for example, the preset trajectory extension rule may be to extend the first trajectory based on a preset space-time structure. The preset space-time structure represents a set of space-time grids adjacent to each other. The shape of the preset space-time structure is determined according to different application scenarios, and is commonly a grid cube composed of multiple space-time grids. The grid structure in the preset space-time structure is represented by the offset of each grid in the structure relative to the central grid of the structure. For example, see Figure 15 In the structure shown in (b) of FIG, in this embodiment, the expansion of the first trajectory can adopt a preset space-time structure with a structure size of 3×3×3 space-time grid. The spatial level and time division granularity of the grid of this preset space-time structure in the space-time grid model must be the same as the spatial level and time division granularity corresponding to the hybrid coding of the first trajectory. That is, the space-time grid level of the grid of this preset space-time structure is the same as the space-time grid level of the hybrid coding mapping of the first trajectory.

[0332] In a specific embodiment, first, the server may obtain a continuous adjacent space-time grid mapped by the first trajectory based on the first information encoding and interpolation of the first trajectory, for example, see Figure 15 In (a), assuming that Figure 15 (a) shows the continuous adjacent space-time grid of the hybrid coding mapping of the first trajectory. Assume Figure 15 The structure shown in (b) is the preset space-time structure. Then, the server can use Figure 15 The structure traversal shown in (b) Figure 15 Specifically, the traversal operation includes: the central grid of the preset space-time structure can be respectively connected to Figure 15The space-time network of (a) in the above example overlaps, and then the space-time network that does not overlap with the preset space-time structure is overlapped. Figure 15 The space-time grid that overlaps the space-time grid of (a) is used as the extended space-time grid. Finally, the grid structure obtained by expanding the space-time grid of the first trajectory can be seen in Figure 15 The structure shown in (c).

[0333] So, Figure 15 The hybrid code corresponding to the space-time grid included in the structure shown in (c) is the code of the first trajectory after expansion, that is, Figure 15 The mixed codes corresponding to the space-time grid included in the structure shown in (c) constitute the first mixed code set mentioned above. It can be seen that Figure 15 The number of space-time grids in the trajectory mapping of (a) is 5. After expansion, the number of space-time grids in the trajectory mapping can be expanded to 69, as shown in Figure 15 As shown in (c) in the figure, the hybrid coding set of this trajectory includes 69 hybrid codes, which are expanded from the original 5.

[0334] Since each mixed code can be regarded as corresponding to a track point, the above-mentioned expansion of the number of mixed codes of the first track can also be regarded as an expansion of the number of track points of the first track.

[0335] After obtaining the first hybrid coding set for the first trajectory based on the method of the fourth embodiment, the server may similarly query candidate similar trajectories based on the first hybrid coding set. The specific query process can be found in the corresponding description of S1303 in the third embodiment, and will not be repeated here.

[0336] After finding candidate similar trajectories, the similarity between these candidate similar trajectories and the first trajectory is calculated. The following describes the process of calculating trajectory similarity based on the expanded encoding set of the first trajectory. Similarly, the similarity calculation between the first candidate trajectory and the first trajectory described in the third embodiment is used as an example.

[0337] Similarly, before introducing the calculation of similarity, the corresponding calculation amount should be defined first.

[0338] Assume that the first hybrid coding set of the first trajectory is C A According to the expansion process of the first trajectory described above in the fourth embodiment, the first mixed code set includes the mixed codes of the trajectory points of the first trajectory initially obtained by the server and the mixed codes obtained by the server based on the trajectory data of these initially obtained trajectory points. Assume that the mixed code set of the trajectory points of the first trajectory initially obtained by the server is denoted by C A1 To express, the server uses C to expand the hybrid coding set obtained based on the trajectory data of these initially acquired trajectory pointsA2 To express, CA=C A1 +C A2 .

[0339] In addition, assuming that the trajectory length of the first candidate trajectory read above is |C B |, C B The number of the same mixed codes between the first candidate trajectory and the first trajectory point mixed codes obtained by the server at the beginning is |C A1 ∩C B The number of identical mixed codes between the first candidate trajectory and the mixed code obtained by the server based on the trajectory data of the initially acquired trajectory points is |C A2 ∩C B |.

[0340] The following is an example of how to calculate trajectory similarity for several scenarios.

[0341] The first scenario is a general application scenario with no special features.

[0342] In this scenario, the similarity between the first candidate trajectory and the first trajectory can be calculated using the following formula:

[0343]

[0344] In this formula, GSIM represents the similarity, and K is greater than or equal to 1. The coefficient K is increased here to take into account the situation where similarity calculations are performed between trajectories corresponding to mixed codes at different levels. When K is equal to 1, it indicates that the mixed code of the first trajectory and the mixed code of the first candidate trajectory are mixed codes at the same level in the index tree. When K is greater than 1, it indicates that the mixed code of the first candidate trajectory is at a lower level in the index tree than the mixed code of the first trajectory. This situation corresponds to the situation described in S1303 above that "the server can use the trajectory corresponding to the trajectory identifier stored in the storage space of the low-level node corresponding to the node with the same code as the code of the above-mentioned first mixed code set in the index tree as a candidate similar trajectory."

[0345] Optionally, the above K can be 2 q , where q is an integer greater than or equal to 0. q represents the level difference between the hybrid encoding of the first candidate trajectory and the hybrid encoding of the first trajectory in the index tree. K can be used to balance the impact of inconsistent space-time grids and actual path lengths between trajectory mappings at different levels.

[0346] The second scenario focuses on the accompanying features between trajectories, such as ride-sharing or crime tracking.

[0347] In this scenario, the similarity between the first candidate trajectory and the first trajectory can be calculated using the following formula:

[0348]

[0349] This calculation can improve the accuracy of the similarity calculation between the two trajectories in the second scenario.

[0350] The third scenario focuses on the similarity with the source trajectory, such as epidemic analysis and tracking.

[0351] In this scenario, the similarity between the first candidate trajectory and the first trajectory can be calculated using the following formula:

[0352]

[0353] The formulas for similar calculations in the embodiments of the present application are not limited to the ones introduced above. The specific calculation formulas are determined according to actual conditions, and this solution does not impose any restrictions on this.

[0354] After calculating the similarities between each candidate similar trajectory and the first trajectory, the server may filter out the trajectory data of the N similar trajectories according to the similarities. The specific implementation process can be found in the detailed description of S1305 in the above embodiment 3, which will not be repeated here.

[0355] In summary, the present embodiment first divides space and time into a grid and uses a space-time grid coding method to express trajectories in a multi-scale space-time grid coding manner, achieving dimensionality reduction and collinearity of the high-dimensional space-time information of the trajectories, reducing the difficulty of organization, management, and analysis, and reducing storage space usage. Furthermore, a multi-level, multi-dimensional index database construction scheme is proposed, allowing trajectory similarity queries to be conducted simultaneously across time and space, as well as across multiple attribute dimensions. Furthermore, a multi-dimensional trajectory similarity measurement method is proposed to implement multi-dimensional trajectory similarity queries, and an adaptive similarity algorithm is proposed for different scenarios to improve the accuracy of trajectory similarity matching. The algorithm can be calculated based on different levels, improving computational efficiency and reducing algorithm complexity.

[0356] The above mainly introduces the data processing method provided by the embodiment of the present application. It is understandable that, in order to realize the corresponding functions mentioned above, each device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0357] The embodiment of the present application can divide the functional modules of the device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. In actual implementation, there may be other division methods.

[0358] In the case of dividing each functional module into corresponding functional modules, Figure 16 A schematic diagram of a possible logical structure of a device is shown. The device can be the server in each of the above embodiments, or can be a chip in the above server, or can be a processing system in the above server, etc. The device 1600 includes a first acquisition unit 1601, a second acquisition unit 1602, a query unit 1603, and a third acquisition unit 1604. Among them:

[0359] A first acquiring unit 1601 is configured to acquire first information, where the first information includes spatial position data and time data of one or more trajectory points of a first trajectory;

[0360] A second obtaining unit 1602 is configured to obtain a first mixed code set based on the first information, the first mixed code set including a mixed code for each trajectory point of the first information, the mixed code being obtained by encoding according to a mixed coding rule of a preset level in an index database; the mixed code including a time code of the trajectory point and a spatial code of the trajectory point, the time code being obtained according to the time data, and the spatial code being obtained according to the spatial position data; the index database being a multi-level index structure including multiple levels of mixed codes, the mixed codes of each level being divided into sets according to the mixed codes of the level to which they belong, the mixed codes of each level being indexed to the mixed codes of the level to which they belong, the mixed codes of each level being indexed to the mixed codes of the level to which they belong, the mixed codes of the multiple levels including mixed codes having trajectory information, the trajectory information being used to indicate a trajectory identifier and a trajectory length of the trajectory to which the mixed code belongs, the trajectory length of a trajectory being the number of mixed codes having the same trajectory identifier stored in the index database;

[0361] A query unit 1603 is configured to query the index database according to a query device of a multi-level index structure based on each mixed code in the first mixed code set to obtain a second mixed code set, where the mixed codes in the second mixed code set are mixed codes with trajectory information; the mixed codes in the second mixed code set are mapped to trajectory information of m candidate similar trajectories, where m is an integer;

[0362] The third acquiring unit 1604 is configured to acquire N similar trajectories according to the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories, where N is an integer less than or equal to m.

[0363] In a possible implementation, the query unit 1603 is specifically configured to:

[0364] The query device according to the multi-level index structure compares each mixed code in the first mixed code set with the mixed code in the index database to obtain the second mixed code set, where the mixed codes in the second mixed code set are the same mixed codes in the index database as those in the first mixed code set, and / or the low-level and / or high-level mixed codes corresponding to the mixed codes in the index database that are the same as those in the first mixed code set.

[0365] In a possible implementation, the first information further includes attribute data of the first trajectory, and the trajectory information further includes attribute information of the trajectory indicated by the trajectory information, where the attribute information is obtained based on the attribute data of the trajectory indicated by the trajectory information;

[0366] The query unit 1603 is specifically configured to:

[0367] The query device according to the multi-level index structure compares each mixed code in the first mixed code set with the mixed codes in the index database to obtain a first matching mixed code, where the first matching mixed code is the same mixed code in the index database as the mixed code in the first mixed code set, and / or a lower-level and / or higher-level mixed code corresponding to the same mixed code in the index database as the mixed code in the first mixed code set;

[0368] The second mixed coding set is obtained according to the first matched mixed coding, where the mixed coding in the second mixed coding set is the mixed coding whose attribute information in the first matched mixed coding includes the attribute information of the first trajectory.

[0369] In a possible implementation, the query unit 1603 is specifically configured to:

[0370] determining a mixed code of a target level according to a first mixed code in the first mixed code set, where the target level is the level to which the preset level belongs;

[0371] Searching according to the mixed coding of the target level to obtain a first candidate mixed coding set;

[0372] The first hybrid code is compared with the first set of candidate hybrid codes.

[0373] In a possible implementation, the second acquiring unit 1602 is specifically configured to:

[0374] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points;

[0375] Encoding the time data of the one or more track points according to the encoding rules of the time encoding of the mixed encoding in the preset level to obtain the time codes of the one or more track points;

[0376] The spatial encoding and the temporal encoding of each of the one or more trajectory points are combined to obtain a hybrid encoding of each trajectory point.

[0377] In a possible implementation, the first information further includes attribute data of the first trajectory, and the second acquiring unit 1602 is specifically configured to:

[0378] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points;

[0379] Encoding the time data of the one or more track points according to the encoding rules of the time encoding of the mixed encoding in the preset level to obtain the time codes of the one or more track points;

[0380] Encoding the attribute data of the first trajectory to obtain an attribute code of the first trajectory;

[0381] The spatial coding, the temporal coding and the attribute coding of each of the one or more trajectory points are combined to obtain a hybrid coding of each trajectory point.

[0382] In a possible implementation, the third obtaining unit 1604 is specifically configured to:

[0383] Calculate the number of i-th codes, where the number of i-th codes is calculated based on the number of mixed codes in the second mixed code set mapped with the i-th identifier, where the i-th identifier is the trajectory identifier of the i-th candidate similar trajectory, and the value of i ranges from 1 to m;

[0384] Obtaining an i-th length, where the i-th length is based on the trajectory length of the first trajectory, or is calculated based on the trajectory length of the i-th candidate similar trajectory and the trajectory length of the first trajectory;

[0385] Calculate the ratio of the i-th number of codes to the i-th length, where the ratio is the similarity between the i-th candidate similar trajectory and the first trajectory;

[0386] The N similar trajectories are screened out according to the m similarities obtained by the calculation.

[0387] In a possible implementation, the first mixed code set further includes mixed codes of interpolation trajectory points, where the interpolation trajectory points are obtained based on the one or more trajectory points according to a preset interpolation device.

[0388] In a possible implementation, the first hybrid coding set further includes hybrid coding of extended trajectory points, where the extended trajectory points are obtained through a preset expansion device based on the one or more trajectory points and the interpolation trajectory points.

[0389] In one possible implementation, the index database is a database constructed based on a space-time grid model, which includes multiple levels of space-time grids, each level of which is determined according to the set spatial level and time division granularity, and each space-time grid mapping has a mixed code; the multiple levels of the index database are r levels, where r is greater than 1, and the r levels of the index database correspond to r space-time grid levels respectively.

[0390] In a possible implementation, the index database is mapped to a trajectory database, and the trajectory database is used to store original data of the multiple trajectories included in the index database, where the original data includes multiple items of time data, spatial position data, and attribute data of the multiple trajectories.

[0391] Figure 16 The specific operation and beneficial effects of each unit in the device 1600 can be found in the above Figure 13 The description of the method and its possible implementation methods will not be repeated here.

[0392] In the case of dividing each functional module into corresponding functional modules, Figure 17 A possible logical structure diagram of a device is shown. The device can be the server in each of the above embodiments, or can be a chip in the above server, or can be a processing system in the above server, etc. The device 1700 includes an acquisition unit 1701 and an encoding unit 1702. Among them:

[0393] An acquiring unit 1701 is configured to acquire trajectory data of a second trajectory, where the trajectory data includes spatial position data and time data of one or more trajectory points of the second trajectory;

[0394] Coding unit 1702 is configured to obtain a third hybrid code set expressing the second trajectory based on the trajectory data encoding, the third hybrid code set including a hybrid code for each trajectory point of the second trajectory, the hybrid code obtained by encoding according to a preset hierarchical hybrid coding rule in an index database; the hybrid code including a time code of the trajectory point and a spatial code of the trajectory point, the time code obtained based on the time data, and the spatial code obtained based on the spatial position data; the index database including r levels of hybrid codes, where r is greater than 1, the r levels of hybrid codes being hybrid codes of space-time grid mappings in r levels of space-time grid, the r levels being mapped one-to-one with the r levels of space-time grid, the r levels being r levels of a plurality of levels included in a preset space-time grid model, each space-time grid level in the space-time grid model being determined based on a preset spatial level and time division granularity.

[0395] In a possible implementation, the encoding unit 1702 is specifically configured to:

[0396] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points;

[0397] Encoding the time data of the one or more track points according to the time coding rule of the mixed coding in the preset level to obtain respective time codes of the one or more track points;

[0398] The spatial code and the temporal code of each of the one or more trajectory points are combined to obtain a hybrid code of each trajectory point. The hybrid codes of the one or more trajectory points constitute the third hybrid code set.

[0399] In a possible implementation, the trajectory data further includes attribute data of the second trajectory, and the encoding unit 1702 is specifically configured to:

[0400] Encoding the spatial position data of the one or more trajectory points according to the spatial coding rules of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points;

[0401] Encoding the time data of the one or more track points according to the time coding rule of the mixed coding in the preset level to obtain respective time codes of the one or more track points;

[0402] encoding the attribute data of the second track to obtain an attribute code of the second track;

[0403] The spatial code, the temporal code and the attribute code of each of the one or more trajectory points are combined to obtain a hybrid code of each trajectory point. The hybrid codes of the one or more trajectory points constitute the third hybrid code set.

[0404] In a possible implementation, the third mixed coding set further includes mixed coding of interpolated trajectory points, where the mixed coding of the interpolated trajectory points is a mixed coding of the trajectory points calculated based on the mixed coding of the one or more trajectory points according to a preset interpolation device.

[0405] Figure 17 The specific operation and beneficial effects of each unit in the device 1700 can be found in the above Figure 10 The description of the method and its possible implementation methods will not be repeated here.

[0406] Figure 18 The figure shows a possible hardware structure diagram of a device provided by this application, which can be a server in the method described in the above embodiment. The device 1800 includes: a processor 1801, a memory 1802, and a communication interface 1803. The processor 1801, the communication interface 1803, and the memory 1802 can be connected to each other or to each other via a bus 1804.

[0407] Exemplarily, the memory 1802 is used to store computer programs and data of the device 1800. The memory 1802 may include, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or portable read-only memory (CD-ROM). Figure 16 In the case of the embodiment shown, and Figure 16 When each unit described in the embodiment is implemented by software, Figure 16 The software or program code required for the functions of each unit in the system is stored in the memory 1802.

[0408] The communication interface 1803 is used to support the device 1800 to communicate, such as receiving or sending data or signals.

[0409] Exemplarily, the processor 1801 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The processor 1801 may be used to read the program stored in the memory 1802 and execute the above-mentioned Figure 13 The operations performed by the server in the method and possible implementation methods described above.

[0410] Figure 18 The specific operations and beneficial effects performed by the device 1800 shown can be found in the descriptions of the above-mentioned various method embodiments and their possible implementation methods, and will not be repeated here.

[0411] Figure 19 The figure shows a possible hardware structure diagram of a device provided by this application, which can be a server in the method described in the above embodiment. The device 1900 includes: a processor 1901, a memory 1902, and a communication interface 1903. The processor 1901, the communication interface 1903, and the memory 1902 can be connected to each other or to each other via a bus 1904.

[0412] Exemplarily, the memory 1902 is used to store computer programs and data of the device 1900. The memory 1902 may include, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or portable read-only memory (CD-ROM). Figure 17 In the case of the embodiment shown, and Figure 17 When each unit described in the embodiment is implemented by software, Figure 17 Software or program codes required for the functions of each unit in the system may be stored in the memory 1902 .

[0413] The communication interface 1903 is used to support the device 1900 to communicate, such as receiving or sending data or signals.

[0414] Exemplarily, the processor 1901 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The processor 1901 may be used to read the program stored in the memory 1902 and execute the above-mentioned Figure 10 The operations performed by the device in the method and possible embodiments described above.

[0415] Figure 19 The specific operations and beneficial effects performed by the device 1900 can be found in the descriptions of the above-mentioned various method embodiments and their possible implementation methods, and will not be repeated here.

[0416] The embodiment of the present application also provides a device, which includes a processor, a communication interface and a memory, and is configured to execute the above Figure 13 The method described and possible embodiments thereof.

[0417] In one possible implementation manner, the device is a chip or a system on a chip (SoC).

[0418] The embodiment of the present application also provides a device, which includes a processor and a communication interface, and is configured to perform the above Figure 10 The method described and possible embodiments thereof.

[0419] In one possible implementation, the device is a chip or a system-on-chip (SoC).

[0420] The present application also provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above Figure 13 The method described and possible embodiments thereof.

[0421] The present application also provides a computer-readable storage medium storing a computer program, which is executed by a processor to implement the above Figure 10 The method described and possible embodiments thereof.

[0422] The present application also provides a computer program product. When the computer program product is read and executed by a computer, the above Figure 13 The method described and possible embodiments thereof will be performed.

[0423] The present application also provides a computer program product. When the computer program product is read and executed by a computer, the above Figure 10 The method described and possible embodiments thereof will be performed.

[0424] The present application also provides a computer program, which, when executed on a computer, enables the computer to implement the above Figure 13 The method described and possible embodiments thereof.

[0425] The present application also provides a computer program, which, when executed on a computer, enables the computer to implement the above Figure 10 The method described and possible embodiments thereof.

[0426] To sum up, the present application combines the temporal information and spatial information encoding of the trajectory points of the trajectory to obtain a hybrid code, and constructs a multi-level index database based on the hybrid code as an index, and maps the above-mentioned trajectory information in the hybrid code of the index database. On this basis, similar trajectories of the target trajectory are queried in the index database, thereby improving the accuracy of trajectory query, reducing the complexity of trajectory similarity calculation, and improving the query efficiency of similar trajectories.

[0427] In this application, the terms "first", "second", etc. are used to distinguish between identical or similar items having substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on quantity or execution order. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of the various described examples, a first trajectory may be referred to as a second trajectory, and similarly, a second trajectory may be referred to as a first trajectory. Both the first trajectory and the second trajectory may be trajectories, and in some cases, may be separate and different trajectories.

[0428] It should also be understood that in the various embodiments of the present application, the size of the serial number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0429] It will also be understood that the term “comprise” (also known as “includes,” “including,” “comprises,” and / or “comprising”) when used in this specification specifies the presence of stated features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0430] It should also be understood that references throughout this specification to "one embodiment," "an embodiment," or "one possible implementation" mean that specific features, structures, or characteristics associated with that embodiment or implementation are included in at least one embodiment of the present application. Therefore, the appearance of "in one embodiment," "in an embodiment," or "one possible implementation" throughout this specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0431] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A data processing method, characterized in that: include: Acquire first information, where the first information includes spatial position data and time data of one or more trajectory points of the first trajectory; Obtaining a first hybrid coding set based on the first information, the first hybrid coding set including a hybrid coding set for each trajectory point of the first information, the hybrid coding being obtained by encoding according to a hybrid coding rule of a preset level in an index database; the preset level being mapped to a space-time grid level of a space-time grid model, the coding rule being a coding rule corresponding to the space-time grid level; the hybrid coding including a time code of the trajectory point and a space code of the trajectory point, the time code being obtained based on the time data, and the space code being obtained based on the spatial position data; the index database being a multi-level index structure, the index database including hybrid coding sets of multiple levels, the hybrid coding of each level being divided into sets based on the hybrid coding of the level to which it belongs, an index relationship existing between the hybrid coding of each level and the hybrid coding of the level to which it belongs, the hybrid coding sets of the multiple levels being mapped with trajectory information, the trajectory information being used to indicate a trajectory identifier and a trajectory length of the trajectory to which the hybrid coding belongs, the trajectory length of a trajectory being the number of hybrid codes having the same trajectory identifier stored in the index database; A second mixed code set is obtained by querying the index database according to a query method of a multi-level index structure based on each mixed code in the first mixed code set, wherein the mixed codes in the second mixed code set are mapped to trajectory information; the mixed codes in the second mixed code set are mapped to trajectory information of m candidate similar trajectories, where m is an integer; N similar trajectories are obtained according to the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories, where N is an integer less than or equal to m.

2. The method according to claim 1, characterized in that The step of querying the index database according to a multi-level index structure query method based on each mixed code in the first mixed code set to obtain a second mixed code set includes: According to the query method of the multi-level index structure, each mixed code in the first mixed code set is compared with the mixed code in the index database to obtain the second mixed code set, where the mixed codes in the second mixed code set are the same mixed codes as those in the first mixed code set in the index database, and / or the low-level and / or high-level mixed codes corresponding to the mixed codes in the index database that are the same as those in the first mixed code set.

3. The method according to claim 1, characterized in that The first information further includes attribute data of the first trajectory, and the trajectory information further includes attribute information of the trajectory indicated by the trajectory information, wherein the attribute information is obtained according to the attribute data of the trajectory indicated by the trajectory information; The step of querying the index database according to a multi-level index structure query method based on each mixed code in the first mixed code set to obtain a second mixed code set includes: Comparing each mixed code in the first mixed code set with the mixed codes in the index database according to a query method of a multi-level index structure to obtain a first matching mixed code, where the first matching mixed code is a mixed code in the index database that is identical to the mixed code in the first mixed code set and / or a low-level and / or high-level mixed code corresponding to the mixed code in the index database that is identical to the mixed code in the first mixed code set; The second mixed coding set is obtained according to the first matching mixed coding, where the mixed coding in the second mixed coding set is a mixed coding whose attribute information in the first matching mixed coding includes the attribute information of the first trajectory.

4. The method according to claim 2 or 3, characterized in that The query method according to the multi-level index structure compares each mixed code in the first mixed code set with the mixed codes in the index database, including: Determining a hybrid code of a target level according to a first hybrid code in the first hybrid code set, where the target level is the level to which the preset level belongs; Searching according to the hybrid coding of the target layer to obtain a first candidate hybrid coding set; The first hybrid code is compared with the first set of candidate hybrid codes.

5. The method according to any one of claims 1 to 3, characterized in that The obtaining a first mixed coding set according to the first information includes: encoding the spatial position data of the one or more trajectory points according to a spatial coding rule of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points; encoding the time data of the one or more track points according to the encoding rules of the time encoding of the mixed encoding in the preset level to obtain the time codes of the one or more track points; The spatial encoding and the temporal encoding of each of the one or more trajectory points are combined to obtain a hybrid encoding of each trajectory point.

6. The method according to claim 1 or 2, characterized in that The first information further includes attribute data of the first trajectory, and obtaining a first hybrid coding set according to the first information includes: encoding the spatial position data of the one or more trajectory points according to a spatial coding rule of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points; encoding the time data of the one or more track points according to the encoding rules of the time encoding of the mixed encoding in the preset level to obtain the time codes of the one or more track points; encoding the attribute data of the first trajectory to obtain an attribute code of the first trajectory; The spatial coding, the temporal coding and the attribute coding of each of the one or more trajectory points are combined to obtain a hybrid coding of each trajectory point.

7. The method according to any one of claims 1 to 3, characterized in that The obtaining N similar trajectories according to the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories includes: Calculate the number of i-th codes, where the number of i-th codes is calculated based on the number of mixed codes in the second mixed code set mapped with the i-th identifier, where the i-th identifier is the trajectory identifier of the i-th candidate similar trajectory, and the value of i ranges from 1 to m; Obtaining an i-th length, where the i-th length is based on the trajectory length of the first trajectory, or is calculated based on the trajectory length of the i-th candidate similar trajectory and the trajectory length of the first trajectory; Calculating a ratio of the i-th number of codes to the i-th length, where the ratio is a similarity between the i-th candidate similar trajectory and the first trajectory; The N similar trajectories are screened out according to the m similarities obtained by calculation.

8. The method according to any one of claims 1 to 3, characterized in that The first hybrid coding set further includes hybrid coding of interpolation trajectory points, where the interpolation trajectory points are obtained based on the one or more trajectory points according to a preset interpolation method.

9. The method according to claim 8, characterized in that The first hybrid coding set further includes hybrid coding of extended trajectory points, where the extended trajectory points are obtained by a preset extension method based on the one or more trajectory points and the interpolation trajectory points.

10. The method according to any one of claims 1 to 3, characterized in that The index database is a database constructed based on a space-time grid model, which includes multiple levels of space-time grids. Each space-time grid level is determined according to the set spatial level and time division granularity, and each space-time grid mapping has a mixed code; the multiple levels of the index database are r levels, where r is greater than 1, and the r levels of the index database correspond to r space-time grid levels respectively.

11. The method according to any one of claims 1 to 3, characterized in that The index database is mapped to the trajectory database, and the trajectory database is used to store original data of the multiple trajectories included in the index database, where the original data includes multiple items of time data, spatial position data, and attribute data of the multiple trajectories.

12. A data processing device, characterized in that: include: a first acquiring unit, configured to acquire first information, wherein the first information includes spatial position data and time data of one or more trajectory points of the first trajectory; a second acquisition unit, configured to acquire a first hybrid coding set based on the first information, the first hybrid coding set including a hybrid coding set for each trajectory point of the first information, the hybrid coding being obtained by encoding according to a hybrid coding rule of a preset level in an index database; the preset level being mapped to a space-time grid level of a space-time grid model, the coding rule being a coding rule corresponding to the space-time grid level; the hybrid coding including a time code of the trajectory point and a space code of the trajectory point, the time code being obtained based on the time data, and the space code being obtained based on the spatial position data; the index database being a multi-level index structure, including hybrid codes of multiple levels, the hybrid codes of each level being grouped according to the hybrid codes of the level to which they belong, an index relationship existing between the hybrid codes of each level and the hybrid codes of the level to which they belong, the hybrid codes of the multiple levels being mapped with trajectory information, the trajectory information being used to indicate a trajectory identifier and a trajectory length of the trajectory to which the hybrid code belongs, the trajectory length of a trajectory being the number of hybrid codes having the same trajectory identifier stored in the index database; a query unit, configured to query the index database according to a query device of a multi-level index structure based on each mixed code in the first mixed code set to obtain a second mixed code set, wherein the mixed codes in the second mixed code set are mapped to trajectory information; the mixed codes in the second mixed code set are mapped to trajectory information of m candidate similar trajectories, where m is an integer; The third acquiring unit is configured to acquire N similar trajectories according to the trajectory length of the first trajectory and the trajectory information of the m candidate similar trajectories, where N is an integer less than or equal to m.

13. The device according to claim 12, characterized in that The query unit is specifically used for: The query device according to the multi-level index structure compares each mixed code in the first mixed code set with the mixed code in the index database to obtain the second mixed code set, where the mixed codes in the second mixed code set are the same mixed codes in the index database as the mixed codes in the first mixed code set, and / or the low-level and / or high-level mixed codes corresponding to the mixed codes in the index database that are the same as the mixed codes in the first mixed code set.

14. The device according to claim 12, characterized in that The first information further includes attribute data of the first trajectory, and the trajectory information further includes attribute information of the trajectory indicated by the trajectory information, wherein the attribute information is obtained according to the attribute data of the trajectory indicated by the trajectory information; The query unit is specifically used for: The query device according to the multi-level index structure compares each mixed code in the first mixed code set with the mixed codes in the index database to obtain a first matching mixed code, where the first matching mixed code is the same mixed code in the index database as the mixed code in the first mixed code set and / or a lower-level and / or higher-level mixed code corresponding to the same mixed code in the index database as the mixed code in the first mixed code set; The second mixed coding set is obtained according to the first matching mixed coding, where the mixed coding in the second mixed coding set is a mixed coding whose attribute information in the first matching mixed coding includes the attribute information of the first trajectory.

15. The device according to claim 13 or 14, characterized in that The query unit is specifically used for: Determining a hybrid code of a target level according to a first hybrid code in the first hybrid code set, where the target level is the level to which the preset level belongs; Searching according to the hybrid coding of the target layer to obtain a first candidate hybrid coding set; The first hybrid code is compared with the first set of candidate hybrid codes.

16. The device according to any one of claims 12 to 14, characterized in that The second acquiring unit is specifically configured to: encoding the spatial position data of the one or more trajectory points according to a spatial coding rule of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points; encoding the time data of the one or more track points according to the encoding rules of the time encoding of the mixed encoding in the preset level to obtain the time codes of the one or more track points; The spatial encoding and the temporal encoding of each of the one or more trajectory points are combined to obtain a hybrid encoding of each trajectory point.

17. The device according to claim 12 or 13, characterized in that The first information further includes attribute data of the first trajectory, and the second acquiring unit is specifically configured to: encoding the spatial position data of the one or more trajectory points according to a spatial coding rule of the hybrid coding in the preset level to obtain respective spatial codes of the one or more trajectory points; encoding the time data of the one or more track points according to the encoding rules of the time encoding of the mixed encoding in the preset level to obtain the time codes of the one or more track points; encoding the attribute data of the first trajectory to obtain an attribute code of the first trajectory; The spatial coding, the temporal coding and the attribute coding of each of the one or more trajectory points are combined to obtain a hybrid coding of each trajectory point.

18. The device according to any one of claims 12 to 14, characterized in that The third acquiring unit is specifically configured to: Calculate the number of i-th codes, where the number of i-th codes is calculated based on the number of mixed codes in the second mixed code set mapped with the i-th identifier, where the i-th identifier is the trajectory identifier of the i-th candidate similar trajectory, and the value of i ranges from 1 to m; Obtaining an i-th length, where the i-th length is based on the trajectory length of the first trajectory, or is calculated based on the trajectory length of the i-th candidate similar trajectory and the trajectory length of the first trajectory; Calculating a ratio of the i-th number of codes to the i-th length, where the ratio is a similarity between the i-th candidate similar trajectory and the first trajectory; The N similar trajectories are screened out according to the m similarities obtained by calculation.

19. The device according to any one of claims 12 to 14, characterized in that The first hybrid coding set further includes hybrid coding of interpolation trajectory points, where the interpolation trajectory points are obtained based on the one or more trajectory points according to a preset interpolation device.

20. The device according to claim 19, characterized in that The first hybrid coding set further includes hybrid coding of extended trajectory points, where the extended trajectory points are obtained through a preset expansion device based on the one or more trajectory points and the interpolation trajectory points.

21. The device according to any one of claims 12 to 14, characterized in that The index database is a database constructed based on a space-time grid model, which includes multiple levels of space-time grids. Each space-time grid level is determined according to the set spatial level and time division granularity, and each space-time grid mapping has a mixed code; the multiple levels of the index database are r levels, where r is greater than 1, and the r levels of the index database correspond to r space-time grid levels respectively.

22. The device according to any one of claims 12 to 14, characterized in that The index database is mapped to the trajectory database, and the trajectory database is used to store original data of the multiple trajectories included in the index database, where the original data includes multiple items of time data, spatial position data, and attribute data of the multiple trajectories.

23. A data processing device, characterized in that: The device comprises a processor, a communication interface and a memory, wherein the memory is used to store program instructions and / or data, and the processor is used to execute the program instructions stored in the memory, so that the device executes the method according to any one of claims 1 to 11.

24. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 11.

25. A computer program product, characterized in that When the computer program product is read and executed by a computer, the method according to any one of claims 1 to 11 will be performed.

26. A device comprising a processor, a communication interface, and a memory, wherein: The apparatus is configured to perform the method according to any one of claims 1 to 11.

27. The device according to claim 26, characterized in that The device is a chip or a system-on-chip (SoC).

Citation Information

Patent Citations

  • Track coding method based on bitmap

    CN107247761A

  • Trajectory data processing method, processing device, processing system and computer program product

    CN110427360A

Cited By

  • Data processing method and device

    WO2022068745A1