Data storage method and device and data query method and device

By GeoHash encoding of the latitude and longitude information and time information in the trajectory data and storing it with the vehicle identification in the NoSQL database, the trajectory data storage and query problems in the prior art are solved, and efficient data storage and multi-condition query are realized .

CN119415033AInactive Publication Date: 2025-02-11江苏绿色智行科技有限公司 +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411485957.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing trajectory data processing methods cannot effectively meet the storage of large data volumes and multi-condition query requirements, especially in time- and spatial-range queries.

Method used

By GeoHash encoding of the latitude and longitude information and time information in the trajectory data, the space-time GeoHash encoding is obtained, and it is stored with the vehicle identification in the NoSQL database. At the same time, NoSQL database is used for data query, and row keys are built based on vehicle identification and query scope to achieve efficient data retrieval.

Benefits of technology

This method effectively reduces the space requirements for data storage, simplifies the data storage and query process, improves the indexing and retrieval efficiency of data, and can meet the query requirements under various query conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415033A_ABST
    Figure CN119415033A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a data storage method. The method comprises the steps of obtaining track data; preprocessing the trajectory data to obtain a vehicle identifier, latitude and longitude information and time information; performing GeoHash coding on the longitude and latitude information and the time information to obtain a space-time GeoHash code; and the vehicle identifier and the space-time GeoHash code are correspondingly stored in an NoSQL database. According to the method, the space-time data is subjected to GeoHash coding and stored, so that the storage difficulty is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data storage and management, and in particular to a data storage method, a data query method and a device. Background Art

[0002] Vehicle trajectory information refers to the location change data of a vehicle over a period of time, which usually includes timestamp, latitude and longitude coordinates, speed, direction, etc. Vehicle trajectory information plays an important role and has applications in many fields such as construction and communication management, navigation route planning, and autonomous driving technology testing.

[0003] However, vehicle trajectory data is large in size and contains a lot of information, which causes great difficulties in storage and query. The existing trajectory data processing method cannot meet the storage of large amounts of data and the query of multiple conditions based on time range and / or spatial range. Summary of the invention

[0004] The present application provides a data storage method, which reduces the storage space required for trajectory data storage.

[0005] This application provides the following solutions:

[0006] According to a first aspect, a data storage method is provided, the method comprising: acquiring trajectory data; preprocessing the trajectory data to obtain a vehicle identification, longitude and latitude information, and time information; performing GeoHash encoding on the longitude and latitude information and time information to obtain a spatiotemporal GeoHash encoding; and storing the vehicle identification and the spatiotemporal GeoHash encoding in a NoSQL database correspondingly.

[0007] According to an achievable method in an embodiment of the present application, the trajectory data includes multiple location points, each location point corresponds to a vehicle identification and time information; the trajectory data is preprocessed to obtain longitude and latitude information including: based on the lane information where the location point is located, obtaining the center point of the matrix area where the corresponding lane is located, and using the longitude and latitude of the center point as the longitude and latitude information of the location point; and / or, based on the intersection information where the location point is located, obtaining the center point of the rectangular area where the corresponding intersection is located, and using the longitude and latitude of the center point as the longitude and latitude information of the location point.

[0008] According to an achievable manner in the embodiment of the present application, the method further includes: storing the time information and the GeoHash code in a NoSQL database in correspondence with each other.

[0009] According to an implementable method in an embodiment of the present application, the GeoHash encoding of the longitude and latitude information and the time information to obtain the spatiotemporal GeoHash encoding includes: respectively representing the longitude and latitude information and the time information in binary to obtain a longitude sequence, a latitude sequence and a time series; merging the longitude sequence, the latitude sequence and the time series to obtain a spatiotemporal sequence, and the merging includes: traversing the values ​​of each bit in the longitude sequence, the latitude sequence and the time series in turn, taking the values ​​of the same rank from the longitude sequence, the latitude sequence and the time series, arranging them in turn and adding them to the spatiotemporal sequence until the traversal is completed; encoding the spatiotemporal sequence according to the Base32 encoding table to obtain the spatiotemporal GeoHash encoding.

[0010] According to an achievable manner in an embodiment of the present application, the method further includes: performing GeoHash encoding on the longitude and latitude information to obtain a spatial GeoHash code; and storing the vehicle identification and the spatial GeoHash code in the NoSQL database correspondingly.

[0011] According to an achievable method in an embodiment of the present application, the GeoHash code length is greater than or equal to 9 bits and less than or equal to 12 bits.

[0012] According to a second aspect, a data query method is provided, the method comprising: obtaining query conditions, the query conditions comprising a vehicle identification and a query range; constructing a row key according to the query conditions; performing a query operation in a NoSQL database according to the row key to obtain a query result, the NoSQL database being constructed using any of the methods described in the first aspect above.

[0013] According to an implementable method in an embodiment of the present application, the query range is a time range, and the time range is represented by a start time and an end time; the construction of a row key according to the query condition includes: constructing a row key by a vehicle ID, a start time and an end time; and / or, the query range is a spatial range, and the spatiotemporal range is represented by longitude and latitude information, and the construction of a row key according to the query condition includes: performing GeoHash encoding on the longitude and latitude information to obtain a spatial index range, and constructing a row key using the vehicle ID and the spatial index range; and / or, the query range is a spatiotemporal range, and the spatiotemporal range is represented by time information and longitude and latitude information; the construction of a row key according to the query condition includes: performing GeoHash encoding on the time information and longitude and latitude information to obtain a spatiotemporal index range; and constructing a row key using the vehicle ID and the spatiotemporal index range.

[0014] According to a third aspect, a data storage device is provided, the device comprising: a data acquisition unit, configured to acquire trajectory data; a preprocessing unit, configured to preprocess the trajectory data to obtain a vehicle identification, longitude and latitude information, and time information; an information encoding unit, configured to perform GeoHash encoding on the longitude and latitude information and time information to obtain a spatiotemporal GeoHash encoding; and a coding storage unit, configured to store the vehicle identification and the spatiotemporal GeoHash encoding in a NoSQL database in correspondence.

[0015] According to a fourth aspect, a data query device is provided, the device comprising: a condition acquisition unit, configured to acquire query conditions, the query conditions comprising a vehicle identification and a query range; a row key construction unit, configured to construct a row key according to the query conditions; a result acquisition unit, configured to perform a query operation in a NoSQL database according to the row key to obtain a query result, the NoSQL database being constructed using the device described in the third aspect above.

[0016] According to a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in any one of the first and second aspects are implemented.

[0017] According to a sixth aspect, there is provided an electronic device, comprising:

[0018] One or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions, and the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the first and second aspects above.

[0019] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0020] 1) This application performs GeoHash encoding on the latitude and longitude information and time information obtained from the trajectory data to obtain the spatiotemporal GeoHash encoding, and stores the encoded data in the database. This application combines the time and space dimensions for GeoHash encoding, compactly represents spatiotemporal data, reduces the storage space requirements for data storage, and facilitates data indexing and retrieval.

[0021] 2) This application obtains the center point of the rectangular area where the corresponding lanes and intersections are located, and uses the longitude and latitude information of the center point as the longitude and latitude information of the trajectory data, thereby providing a way to express the positions of lanes and intersections by longitude and latitude, simplifying the difficulty of data storage.

[0022] 3) This application performs GeoHash encoding on the sequence obtained by merging the time series, longitude series and latitude series, and provides a spatiotemporal GeoHash encoding method, which merges time and space information into the same string for storage, reducing the difficulty of data storage.

[0023] 4) The GeoHash encoding length of the time series and spatial sequence of this application is between 9 and 12 bits, which saves storage space while ensuring that the encoding error is small.

[0024] 5) This application queries the information stored in the NoSQL database according to the query conditions, including vehicle identification, spatial range and time range, and can realize queries under various query conditions. The row key is constructed according to the query conditions, which reduces the query difficulty and improves the query efficiency.

[0025] Of course, any product implementing the present application does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 A system architecture diagram applicable to the embodiments of the present application;

[0028] Figure 2 A flowchart of a data storage method provided in an embodiment of the present application;

[0029] Figure 3 A flowchart of a data query method provided in an embodiment of the present application;

[0030] Figure 4 A structural block diagram of a data storage device provided in an embodiment of the present application;

[0031] Figure 5 A structural block diagram of a data query device provided in an embodiment of the present application;

[0032] Figure 6 A schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0034] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0035] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0036] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0037] At present, there are some trajectory data query and storage technologies, which encode the longitude and latitude data separately and store the encoded data in the NoSQL database. However, although these methods reduce the storage space by encoding, the encoded longitude and latitude information and time information still need to be stored separately, which is not convenient for the storage and query of spatial data and spatiotemporal data.

[0038] In view of this, the present application provides a new idea. In order to facilitate the understanding of the present application, the system architecture on which the present application is based is first described. Figure 1 An exemplary system architecture to which the embodiments of the present application can be applied is shown. Figure 1 As shown in , the system architecture may include: a user device and a data query device, a data storage device and a NoSQL database located on the application server side.

[0039] The user can input the vehicle's trajectory data through the user device, and the user device sends the trajectory data to the data storage device on the application server side. Alternatively, the data storage device can also obtain the vehicle's trajectory data from other services on the server side. For example, other services on the server side can collect the vehicle's location information at regular intervals, thereby forming the vehicle's trajectory data and storing it on the server side. After the data storage device performs preprocessing and encoding operations on the trajectory data, it is stored in the NoSQL database.

[0040] The user can also input query conditions through the user device, and the user device sends the query conditions to the data query device on the application server side. After the data query device executes the query, it obtains the query results. The server side sends the query results to the user terminal through the network, and the user device displays them to the user.

[0041] Among them, user equipment may include but is not limited to: smart mobile terminals, smart home devices, wearable devices, PC (Personal Computer), etc. Among them, smart mobile devices may include such as mobile phones, tablet computers, laptops, PDAs (Personal Digital Assistants), Internet cars, etc. Smart home devices may include smart TVs, smart refrigerators, etc. Wearable devices may include such as smart watches, smart glasses, virtual reality devices, augmented reality devices, mixed reality devices (i.e., devices that can support virtual reality and augmented reality), etc. User equipment may also include trajectory data acquisition devices, such as vehicle recorders, road sensing devices, etc.

[0042] The data query device and data storage device can be set up as an independent server, a server group, or a cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product in the cloud computing service system to solve the problems of difficult management and weak service scalability in traditional physical hosts and virtual private servers (VPS). Figure 1 In addition to the shown architecture, the data query device and the data storage device can also be set on a computer terminal with strong computing power.

[0043] It should be understood that Figure 1 The user equipment, data query device, and data storage device in the figure are only illustrative. Any number of user equipment, data query device, and data storage device may be provided according to implementation requirements.

[0044] Figure 2 A flow chart of a data storage method provided in an embodiment of the present application, which can be performed by Figure 1 The data storage device in the system shown is executed. Figure 2 As shown in , the method may include the following steps:

[0045] Step 201: Obtain trajectory data.

[0046] Step 202: pre-process the trajectory data to obtain vehicle identification, latitude and longitude information and time information.

[0047] Step 203: Perform GeoHash encoding on the latitude and longitude information and the time information to obtain a spatiotemporal GeoHash encoding.

[0048] Step 204: The vehicle identification and the spatiotemporal GeoHash code are stored in a NoSQL database in correspondence.

[0049] As can be seen from the above process, this application performs GeoHash encoding on the latitude and longitude information and time information obtained from the trajectory data to obtain the spatiotemporal GeoHash encoding, and stores the encoded data in the database. This application combines the time and space dimensions for GeoHash encoding, compactly represents spatiotemporal data, reduces storage requirements, and facilitates data indexing and retrieval.

[0050] First, the above step 201, namely “obtaining trajectory data”, is described in detail in conjunction with the embodiment.

[0051] The trajectory data records the time and location information of the vehicle's travel. The trajectory data can be obtained from a variety of channels, such as collecting real-time data through sensors installed on the vehicle, collecting trajectory information through the user's mobile phone GPS data through mobile applications, and some data collection devices installed on streets or intersections. The trajectory data can be in a variety of formats, and the data format is related to the data collection device, data storage method, data transmission method, etc., and is not specifically limited here.

[0052] The above step 202, namely "preprocessing the trajectory data to obtain the vehicle identification, longitude and latitude information and time information", is described in detail below in conjunction with the embodiments.

[0053] The trajectory data includes multiple sets of location point information, each of which includes vehicle information, time information and location information, indicating the location of a vehicle at a certain point in time. By performing pre-processing operations such as standardization, format conversion, and data extraction on the trajectory data, the vehicle identification, longitude and latitude information, and time information can be obtained. Among them, the vehicle identification is used to identify and distinguish different vehicles. The vehicle identification can be the license plate number, vehicle identification code, etc. The longitude and latitude information and time information are the longitude and latitude values ​​corresponding to the current location of the vehicle, as well as the current time.

[0054] Due to the different ways of collecting trajectory data, the location information may be longitude and latitude information, or lane information or intersection information, etc. For example, the vehicle sensor can obtain the longitude and latitude of the vehicle's location at any time, and the location information obtained at this time is the longitude and latitude information. When the trajectory data is obtained by a data collection device installed on the street, the location information is lane information, specifically lane name, lane code, and other identifications used to identify the lane. At this time, based on the lane information, the center point of the matrix area where the corresponding lane is located can be obtained, and the longitude and latitude of the center point can be used as the longitude and latitude information of the trajectory data. When the trajectory data is obtained by a data collection device installed at an intersection, the location information is intersection information, specifically intersection codes, and other identifications used to identify the intersection. At this time, based on the intersection information, the center point of the matrix area where the corresponding intersection is located can be obtained, and the longitude and latitude of the center point can be used as the longitude and latitude information of the trajectory data.

[0055] The above step 203, i.e., "performing GeoHash encoding on the longitude and latitude information and the time information to obtain the spatiotemporal GeoHash encoding", is described in detail below in conjunction with an embodiment.

[0056] GeoHash is an address encoding method that can encode two-dimensional spatial longitude and latitude data into a string. GeoHash encoding of longitude and latitude information and time information to obtain spatiotemporal GeoHash encoding can be achieved in a variety of ways. For example, first GeoHash encoding of longitude and latitude information to obtain spatial GeoHash encoding, then encoding of time information to obtain time encoding, and finally concatenating spatial GeoHash encoding and time encoding to form a spatiotemporal GeoHash encoding.

[0057] Preferably, the longitude and latitude information and the time information are respectively represented in binary to obtain a longitude sequence, a latitude sequence and a time series; the longitude sequence, the latitude sequence and the time series are merged to obtain a space-time sequence, and the merging includes: traversing the values ​​of each bit in the longitude sequence, the latitude sequence and the time series in turn, taking the values ​​of the same rank from the longitude sequence, the latitude sequence and the time series, arranging them in turn and adding them to the space-time sequence until the traversal is completed; encoding the space-time sequence according to the Base32 encoding table to obtain the space-time GeoHash code.

[0058] Take a location with longitude and latitude (114.3528769, 22.5467932) as an example. The latitude range of the earth is [-90, 90]. First, divide the interval [-90, 90] into [-90, 0) and [0, 90]. 22.5467932 belongs to the right interval [0, 90], so it is marked as 1; then divide the interval [0, 90] into [0, 45) and [45, 90]. 22.5467932 belongs to the left interval [0, 45), so it is marked as 0; after calculating in sequence, we can get the binary sequence representation of latitude: 1010000000. Similarly, the longitude interval of the earth is [-180, 180]. The longitude value 114.3528769 can be encoded according to this range.

[0059] For time information, it can be divided into time ranges of each day. For example, 15:08:00 is the 54480th second of the day. There are 86400 seconds in total every day, and the time range is [0,86400], with the middle value being 43200 seconds. The interval [0,86400] is divided into [0,43200) and [43201,86400]. If 54480 is in the interval [43200,86400], it is marked as 1; if the interval [43200,86400] is divided into [43200,64800) and [64800,86400], if 54480 is in the interval [43200,64800) it is marked as 0; after calculation, the binary sequence of time is: 1010000101.

[0060] Merge the longitude sequence, latitude sequence and time series to get the space-time sequence. The merging process is: take one digit from the longitude sequence, latitude sequence and time series to form a sequence. That is, the digits in the space-time sequence are: the first digit of the longitude sequence, the first digit of the latitude sequence, the first digit of the time series, the second digit of the longitude sequence, the second digit of the latitude sequence, the second digit of the time series, the third digit of the longitude sequence...

[0061] The present application can also combine only the longitude sequence and the latitude sequence to obtain the spatial sequence, and the combining process is: taking one digit from the longitude sequence and the latitude sequence in turn to form a sequence, which is equivalent to putting the longitude sequence in the odd digits of the spatial sequence and the latitude sequence in the even digits.

[0062] By encoding the spatiotemporal sequence according to the Base32 encoding table, we can get the spatiotemporal GeoHash encoding. By encoding the spatial sequence according to the Base32 encoding table, we can get the spatial GeoHash encoding.

[0063] The Base32 encoding table is encoded with 32 letters 0-9, bz (remove a, i, l, o). The specific operation is to convert each 5-bit binary number in the combined spatiotemporal sequence or spatial sequence obtained in the previous step into a decimal data, and then generate the Base32 code according to the Base32 encoding table. Table 1 is the Base32 encoding table. In the above example, the spatial GeoHash encoding result of the location point with longitude and latitude (114.3528769, 22.5467932) is: ws12.

[0064] Table 1

[0065] Decimal Base32 Decimal Base32 0 0 16 h 1 1 17 j 2 2 18 k 3 3 19 m 4 4 20 n 5 5 21 p 6 6 22 q 7 7 23 r 8 8 24 s 9 9 25 t 10 b 26 u 11 c 27 v 12 d 28 w 13 e 29 x 14 f 30 y 15 g 31 z

[0066] According to the GeoHash encoding principle, the longer the GeoHash, the more times the map is divided. The more times the division is performed, the smaller the divided area is, and the location accuracy is further improved. The longer the GeoHash, the higher the requirements for storage and computing power. Therefore, it is necessary to select an appropriate length based on the actual application scenario. Table 2 shows the error values ​​corresponding to different GeoHash lengths. In this application, the application scenario of intelligent networking needs to be accurate to the lane level. The length of GeoHash should be 9-12 bits. It can be obtained from Table 2 that the maximum error should not exceed 4 meters.

[0067] Table 2

[0068]

[0069]

[0070] The above step 204, namely "storing the vehicle identification and the spatiotemporal GeoHash code correspondingly in the NoSQL database", is described in detail below in conjunction with the embodiments.

[0071] After obtaining the spatiotemporal GeoHash code, the present application stores it together with the corresponding vehicle identification in a NoSQL database. Furthermore, the present application can also store both the time information and the spatial GeoHash code in correspondence with the vehicle identification in a NoSQL database.

[0072] This application also provides a method for querying a NoSQL database. Figure 3 A flow chart of a data query method provided in an embodiment of the present application. The method can be performed by Figure 1 The data query device in the system shown is executed. Figure 3 As shown in , the method may include the following steps:

[0073] Step 301: Obtain query conditions, which include vehicle identification and query range.

[0074] Step 302: Build a row key according to the query condition.

[0075] Step 303: performing a query operation in a NoSQL database according to the row key to obtain a query result, wherein the NoSQL database is constructed by using the data storage method described in any one of the above embodiments.

[0076] As can be seen from the above process, this application queries the information stored in the NoSQL database according to the query conditions, including vehicle identification, spatial range and time range, and can realize queries under various query conditions. Constructing row keys according to the query conditions reduces the query difficulty and improves the query efficiency.

[0077] First, the above step 301, namely "obtaining query conditions, the query conditions including vehicle identification and query range" is described in detail in conjunction with the embodiment.

[0078] The present application performs query operations in a NoSQL database according to query conditions. The query conditions can be obtained in a variety of ways, for example, provided by the user through an application program interface. These conditions can be input in the form of text boxes, drop-down menus, check boxes, etc., and then sent to the data query device. It is also possible that an external system or service may send query requests to the NoSQL database through an API call, and these requests contain query conditions. Among them, the query conditions include vehicle identification and query scope. The query scope can include time range, spatial range, etc.

[0079] The above step 302, namely "building a row key according to the query condition", is described in detail below in conjunction with an embodiment.

[0080] This application constructs a row key according to the query conditions. The row key is the main basis for data query. The row key includes the structure of the row key and the specific row key value to be queried. The row key value is represented by a string.

[0081] Specifically, the present application can implement queries based on time ranges, for example, the query condition is a given vehicle ID and a time point within a time range [time_start, time_end]. The row key structure consists of the vehicle ID and time information, as shown in Table 3. The row key structure is designed as follows:<vhc_id;ctime> .

[0082] Table 3

[0083] vhc_id Delimiter Timestamp information (13 bits)

[0084] vhc_id represents the vehicle ID, and its corresponding row key value is the vehicle ID value given in the query condition. ctime is the query time range, including the start time ctimestart and end time ctime end , the specific calculation method is as follows:

[0085] The given time query range is [time start ,time end ], where times tart , time end The start and end time of the trajectory query represented by a 13-bit long integer timestamp. Because when recording data, the earlier data is recorded first and the later data is recorded later, so when querying, it is necessary to read the earlier data first and then the later data to ensure the correctness of the trajectory timing. Therefore, according to ctime = (Long.MaxValue-time), the long integer time time start 、time end , converted to string time ctime start and ctime end ; Among them, Long.MaxValue is a constant, which represents the maximum value that can be represented by long type data in the programming language, and is used as a very large default value here; According to the above data recording characteristics, it can be concluded that ctime start =(Long.MaxValue-time end ), ctime end =(Long.MaxValue-time start ). Concatenate the vehicle ID and time range to get the row key value corresponding to the query range: [ <vhc_id,ctime start >, <vhc_id,ctime end >].

[0086] This application can also implement queries based on spatial ranges, which are used to query the spatiotemporal data of a vehicle within a spatial range. For example, the query condition is a given vehicle ID and a spatial query range Ploygon(x1,y1,...,x n ,y n ). As shown in Table 4, the row key structure is designed as <vhc_id,GeoHash z2 >.

[0087] Table 4

[0088] vhc_id Delimiter <![CDATA[Spatial information GeoHash z2 >

[0089] Among them, vhc_id represents the vehicle ID, and its corresponding row key value is the vehicle ID value given in the query condition. GeoHash z2Indicates the spatial index range. The specific calculation method of the row key value of the spatial index range is as follows:

[0090] The spatial range Ploygon(x1,y1,...,x n ,y n ) are all spatially GeoHash encoded, and the query range is determined based on the encoded result. Specifically, based on the characteristics of spatial GeoHash encoding, the minimum and maximum values ​​in the encoding result can be determined as the start and end values ​​of the spatial information query range.

[0091] This application can also implement queries based on time and space ranges, which are used to query the time and space data of a vehicle within the time and space range. For example, the query conditions are given vehicle ID, time query range and space query range Ploygon(x1,y1,...,x n ,y n ). As shown in Table 5, the row key structure is designed as follows <vhc_id,GeoHash z3 >.

[0092] Table 5

[0093] vhc_id Delimiter <![CDATA[Spatio-temporal information GeoHash z3 >

[0094] Among them, vhc_id represents the vehicle ID, and its corresponding row key value is the vehicle ID value given in the query condition. GeoHash z3 Indicates the spatiotemporal index range. The specific calculation method of the row key value of the spatiotemporal index range is as follows:

[0095] The time range and space range Ploygon(x1,y1,...,x n ,y n ) is subjected to spatiotemporal GeoHash encoding of the time information and each latitude and longitude value, and the query range is determined according to the encoded result. Specifically, according to the characteristics of spatiotemporal GeoHash encoding, the minimum and maximum values ​​in the encoding result can be determined as the start and end values ​​of the spatiotemporal information query range.

[0096] The above step 303, namely "performing a query operation in the NoSQL database according to the row key to obtain a query result", is described in detail below in conjunction with an embodiment.

[0097] Send the constructed row key structure and the corresponding row key value to the NoSQL database. The database will quickly locate the data based on the row key and return the query results. Specifically, you can use the Scan operation to perform distributed queries, start scanning from the start row key, end the scan when the end row key is encountered, and return the query results. In particular, in the NoSQL database, the time information, spatial information, longitude and latitude information corresponding to the same and adjacent vehicle IDs will be stored in sequence. Under this storage method, the use of Scan technology can achieve efficient data query.

[0098] The above method provided in the embodiment of the present application can be applied to a variety of application scenarios, especially suitable for fields that require real-time monitoring and historical analysis of vehicle location, movement path and time information. For example, in the field of logistics management, the method in this application can track the real-time location and historical trajectory of cargo transport vehicles, optimize logistics routes and scheduling; in the field of intelligent transportation, by collecting and analyzing vehicle flow data, it can be used for traffic planning, congestion analysis and accident prevention; in the field of urban planning, it can provide data support for urban planning and transportation infrastructure construction by analyzing vehicle flow patterns.

[0099] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0100] According to an embodiment of another aspect, a data storage device is provided. Figure 4 FIG. 2 shows a schematic block diagram of the data storage device according to an embodiment. Figure 4 As shown, the device 400 includes:

[0101] The data acquisition unit 401 is configured to acquire trajectory data.

[0102] The preprocessing unit 402 is configured to preprocess the trajectory data to obtain vehicle identification, longitude and latitude information, and time information.

[0103] The information encoding unit 403 is configured to perform GeoHash encoding on the longitude and latitude information and the time information to obtain a spatiotemporal GeoHash encoding.

[0104] The code storage unit 404 is configured to store the vehicle identification and the spatiotemporal GeoHash code in a corresponding manner in a NoSQL database.

[0105] As one of the feasible ways, the trajectory data includes a plurality of location points, each location point corresponds to a vehicle identification and time information; the location information is lane information; when the preprocessing unit 402 preprocesses the trajectory data to obtain the longitude and latitude information and time information, it can be configured as follows: based on the lane information where the location point is located, the center point of the matrix area where the corresponding lane is located is obtained, and the longitude and latitude of the center point is used as the longitude and latitude information of the location point; and / or, based on the intersection information where the location point is located, the center point of the rectangular area where the corresponding intersection is located is obtained, and the longitude and latitude of the center point is used as the longitude and latitude information of the location point.

[0106] As one of the achievable ways, the code storage unit 404 may be configured to store the time information and the GeoHash code in a NoSQL database in correspondence with each other.

[0107] As one of the feasible ways, when the information encoding unit 403 performs GeoHash encoding on the longitude and latitude information and the time information to obtain the spatiotemporal GeoHash encoding, it can be configured as follows: respectively represent the longitude and latitude information and the time information in binary to obtain a longitude sequence, a latitude sequence and a time series; merge the longitude sequence, the latitude sequence and the time series to obtain a spatiotemporal sequence, wherein the merging comprises: sequentially traversing the values ​​of each bit in the longitude sequence, the latitude sequence and the time series, taking the values ​​of the same rank from the longitude sequence, the latitude sequence and the time series, arranging them in sequence and adding them to the spatiotemporal sequence until the traversal is completed; and encoding the spatiotemporal sequence according to the Base32 encoding table to obtain the spatiotemporal GeoHash encoding.

[0108] As one of the achievable methods, the information encoding unit 403 may be configured to perform GeoHash encoding on the latitude and longitude information to obtain a spatial GeoHash encoding; the encoding storage unit 404 may be configured to store the vehicle identification and the spatial GeoHash encoding in the NoSQL database in correspondence.

[0109] As one of the implementable ways, the information encoding unit 403 may be configured such that the GeoHash encoding length is greater than or equal to 9 bits and less than or equal to 12 bits.

[0110] According to another embodiment, a data query device is provided. Figure 5 FIG. 2 shows a schematic block diagram of the data storage device according to an embodiment. Figure 5 As shown, the device 500 includes:

[0111] The condition acquisition unit 501 acquires the query condition, which includes the vehicle identification and the query range.

[0112] The row key construction unit 502 constructs a row key according to the query condition.

[0113] The result acquisition unit 503 performs a query operation in the NoSQL database according to the row key to obtain a query result. The NoSQL database is constructed using the above data storage device.

[0114] As one of the feasible ways, the condition acquisition unit 501 can be configured as follows: the query range is a time range, and the time range is represented by a start time and an end time; the row key construction unit 502 can be configured as follows: a row key is constructed by a vehicle ID, a start time, and an end time.

[0115] As one of the feasible methods, the condition acquisition unit 501 can be configured as follows: the query range is a spatial range, and the spatiotemporal range is represented by longitude and latitude information; the row key construction unit 502 can be configured as follows: GeoHash encoding the longitude and latitude information to obtain a spatial index range, and constructing a row key using the vehicle ID and the spatial index range.

[0116] As one of the feasible methods, the condition acquisition unit 501 can be configured as follows: the query range is the space-time range, and the space-time range is represented by time information and longitude and latitude information; the row key construction unit 502 can be configured as follows: GeoHash encoding the time information and longitude and latitude information to obtain the space-time index range; and constructing the row key using the vehicle ID and the space-time index range.

[0117] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0118] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0119] In addition, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the aforementioned method embodiments are implemented.

[0120] And an electronic device, comprising:

[0121] one or more processors; and

[0122] A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the aforementioned method embodiments.

[0123] The present application also provides a computer program product, including a computer program, which implements the steps of any one of the methods in the aforementioned method embodiments when executed by a processor.

[0124] in, Figure 6 The architecture of the electronic device is shown as an example, which may include a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, and a memory 620. The processor 610, the video display adapter 611, the disk drive 612, the input / output interface 613, the network interface 614, and the memory 620 may be communicatively connected via a communication bus 630.

[0125] Among them, the processor 610 can be implemented by a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., to execute relevant programs to implement the technical solutions provided in this application.

[0126] The memory 620 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 620 can store an operating system 621 for controlling the operation of the electronic device 600, and a basic input and output system (BIOS) 622 for controlling the low-level operation of the electronic device 600. In addition, a web browser 623, a data storage management system 624, and a data storage device / data query device 625, etc. can also be stored. The above-mentioned data storage device / data query device 625 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided by the present application is implemented by software or firmware, the relevant program code is stored in the memory 620 and is called and executed by the processor 610.

[0127] The input / output interface 613 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0128] The network interface 614 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0129] The bus 630 comprises a pathway for transmitting information between the various components of the device (eg, the processor 610, the video display adapter 611, the disk drive 612, the input / output interface 613, the network interface 614, and the memory 620).

[0130] It should be noted that, although the above device only shows a processor 610, a video display adapter 611, a disk drive 612, an input / output interface 613, a network interface 614, a memory 620, a bus 630, etc., in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.

[0131] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a computer program product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0132] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.

Claims

1. A data storage method, characterized in that: The method comprises: Get trajectory data; Preprocessing the trajectory data to obtain vehicle identification, latitude and longitude information, and time information; Performing GeoHash encoding on the latitude and longitude information and the time information to obtain a spatiotemporal GeoHash encoding; The vehicle identification and the spatiotemporal GeoHash code are stored correspondingly in a NoSQL database.

2. The method according to claim 1, characterized in that The trajectory data includes a plurality of location points, each location point corresponding to a vehicle identification and time information; The trajectory data is preprocessed to obtain longitude and latitude information including: Based on the lane information where the position point is located, the center point of the matrix area where the corresponding lane is located is obtained, and the longitude and latitude of the center point are used as the longitude and latitude information of the position point; and / or, Based on the intersection information where the location point is located, the center point of the rectangular area where the corresponding intersection is located is obtained, and the longitude and latitude of the center point are used as the longitude and latitude information of the location point.

3. The method according to claim 1, further comprising: The time information and the GeoHash code are stored in a NoSQL database in correspondence.

4. The method according to any one of claims 1 to 3, characterized in that: The GeoHash encoding of the latitude and longitude information and the time information to obtain the spatiotemporal GeoHash encoding includes: The longitude and latitude information and the time information are represented in binary form respectively to obtain a longitude sequence, a latitude sequence and a time sequence; Merging the longitude sequence, the latitude sequence and the time sequence to obtain a space-time sequence, wherein the merging comprises: sequentially traversing the values ​​of each position in the longitude sequence, the latitude sequence and the time sequence, taking the values ​​of the same rank from the longitude sequence, the latitude sequence and the time sequence, arranging them in sequence and adding them to the space-time sequence until the traversal is completed; The spatiotemporal sequence is encoded according to the Base32 encoding table to obtain the spatiotemporal GeoHash encoding.

5. The method according to any one of claims 1 to 3, further comprising: Performing GeoHash encoding on the latitude and longitude information to obtain a spatial GeoHash encoding; The vehicle identification and the spatial GeoHash code are stored correspondingly in the NoSQL database.

6. The method according to any one of claims 1 to 3, characterized in that The GeoHash code length is greater than or equal to 9 bits and less than or equal to 12 bits.

7. A data query method, characterized in that: The method comprises: Obtaining query conditions, wherein the query conditions include a vehicle identification and a query range; Constructing a row key according to the query condition; A query operation is performed in a NoSQL database according to the row key to obtain a query result, wherein the NoSQL database is constructed by using the method according to any one of claims 1 to 6.

8. The method according to claim 7, characterized in that The query range is a time range, and the time range is represented by a start time and an end time; the constructing a row key according to the query condition includes: constructing a row key by a vehicle ID, a start time and an end time; and / or The query range is a spatial range, and the spatial range is represented by longitude and latitude information. The step of constructing a row key according to the query condition includes: performing GeoHash encoding on the longitude and latitude information to obtain a spatial index range, and constructing a row key using the vehicle ID and the spatial index range; and / or The query range is a spatiotemporal range, which is represented by time information and longitude and latitude information; constructing a row key according to the query condition includes: performing GeoHash encoding on the time information and longitude and latitude information to obtain a spatiotemporal index range; and constructing a row key using a vehicle ID and the spatiotemporal index range.

9. A data storage device, characterized in that: The device comprises: A data acquisition unit, configured to acquire trajectory data; A preprocessing unit is configured to preprocess the trajectory data to obtain vehicle identification, latitude and longitude information, and time information; An information encoding unit, configured to perform GeoHash encoding on the latitude and longitude information and the time information to obtain a spatiotemporal GeoHash encoding; The coding storage unit is configured to store the vehicle identification and the spatiotemporal GeoHash coding in a NoSQL database in correspondence.

10. A data query device, characterized in that: The device comprises: A condition acquisition unit, configured to acquire a query condition, wherein the query condition includes a vehicle identification and a query range; A row key construction unit, configured to construct a row key according to the query condition; The result acquisition unit is configured to perform a query operation in a NoSQL database according to the row key to obtain a query result, and the NoSQL database is constructed using the device according to claim 9.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

12. An electronic device, characterized in that: include: one or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Space-time geographic big data retrieval method and system

    CN105426491A

  • Data processing method and device and storage medium

    CN115858951A