GPS-based real-time bus traffic condition calculation method, device and application
By matching road speeds with bus-mounted GPS data and the Viterbi algorithm, the problem of inaccurate bus route congestion information is solved, and accurate monitoring and optimization of bus routes and road networks are achieved.
Patent Information
- Application Number
- CN202310097457.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-06
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2043-02-06
AI Technical Summary
Existing technologies are unable to accurately grasp the truly congested sections of bus routes and the congested time segments, resulting in unstable bus travel times and difficulty in effectively avoiding congestion.
Using bus-mounted GPS data, combined with the Viterbi algorithm and road section data, the speed of the road section is calculated by matching GPS points to coordinate points, providing more fine-grained road condition analysis.
It has achieved accurate monitoring of bus routes and road networks, can identify congested sections and time periods, support bus route optimization and congestion avoidance, and improve travel efficiency.
Smart Images

Figure CN116153072B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to bus traffic condition analysis, and in particular to a method, device and application for calculating real-time bus traffic conditions based on GPS. Background Art
[0002] Currently, the main source of information on bus congestion is based on bus announcements, which reflect the congestion between bus stops or even the entire line. However, the line speed or the speed between bus stops calculated based on the bus announcement data is an average, which cannot accurately grasp the actual congested sections of the bus line and the time segments of congestion. Therefore, it cannot effectively solve the problem of bus avoiding congestion. Congested sections lead to increased travel time for passengers, slow travel speeds, and unstable waiting times, which are all disadvantages that hinder bus travel.
[0003] Therefore, there is an urgent need for a GPS-based real-time bus traffic condition calculation method and its application, which can provide a more fine-grained traffic condition calculation method, reflect the congestion situation of the bus at the current moment and the current section of the road, and be used as a decision analysis for optimizing bus travel services. Summary of the Invention
[0004] The embodiments of the present application provide a GPS-based method for calculating real-time bus traffic conditions and its application, which addresses the inaccuracy problem of current technology.
[0005] The core technology of the present invention is to use GPS to analyze the real-time traffic conditions of buses.
[0006] In a first aspect, the present application provides a method for calculating real-time bus traffic conditions based on GPS, the method comprising the following steps:
[0007] S00, obtaining the vehicle GPS data and road section data for the current period, and taking the road mileage traveled by the vehicle as the actual mileage for the current period;
[0008] Among them, the road section data is the data composed of a series of connected coordinate points;
[0009] S10, performing abnormal processing on the vehicle GPS data to obtain valid vehicle GPS data;
[0010] S20, matching each GPS point to the coordinate point using the Viterbi algorithm based on the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data, and calculating the road section speed for the current period based on the matching results;
[0011] S30: Take the average of the speeds of each vehicle passing through the road section as the average speed of the current road section and output it.
[0012] Furthermore, in step S00, a window of set duration is created to capture vehicle GPS data. The size of the window is determined by the vehicle GPS reporting frequency. The higher the frequency, the smaller the window.
[0013] Furthermore, in step S00, the road section data and vehicle GPS data are analyzed using only data within the vehicle operating shift time.
[0014] Furthermore, in step S10, exception handling at least includes removing GPS data with empty longitude and latitude and outside the bus network range, deduplicating GPS data with the same longitude and latitude and the same time, filtering messages of multiple GPS points within the same time, filtering supplementary GPS data, and filtering GPS data outside the operating hours.
[0015] Furthermore, in step S20, the specific steps for calculating the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data are as follows:
[0016] Sort each GPS point in chronological order;
[0017] Search for all coordinate points within the set radius of each GPS point;
[0018] Calculate the distance between the GPS point and all coordinate points within the range.
[0019] Furthermore, in step S20, the specific steps of matching each GPS point to a coordinate point using the Viterbi algorithm are as follows:
[0020] Construct the first dictionary to record the maximum value of the current coordinate point, construct the second dictionary to record the path of the current coordinate point, and use all the coordinate points and distances obtained by searching the first GPS point as the maximum value of the current coordinate point;
[0021] Starting from the second GPS point, traverse all possible matching coordinate points of the current GPS point in sequence;
[0022] Calculate the value of all coordinate points in the first dictionary and all possible matching coordinate points of the current GPS point and record them;
[0023] After the traversal is completed, the coordinate point with the largest value is obtained;
[0024] Through the second dictionary, the path is traced back from the coordinate point with the greatest value and the coordinate point corresponding to each GPS point is recorded to obtain the best matching result.
[0025] Furthermore, in step S20, the specific steps for calculating the road speed of the current period based on the matching results are as follows:
[0026] Get the road section to which the point belongs through the coordinates;
[0027] Take the previous GPS point and the next GPS point of the current road section, and use the cumulative distance between the coordinate points matched by the two GPS points as the actual mileage;
[0028] The speed of each vehicle passing through the current road section during the current period is calculated based on the duration of the current period.
[0029] In a second aspect, the present application provides a GPS-based real-time bus traffic condition calculation device, comprising:
[0030] The acquisition module obtains the vehicle GPS data and road section data of the current period, and uses the road mileage traveled by the vehicle as the actual mileage in the current period; the road section data is data composed of a series of connected coordinate points;
[0031] The exception handling module performs exception handling on vehicle GPS data to obtain valid vehicle GPS data;
[0032] The matching calculation module uses the Viterbi algorithm to match each GPS point to the coordinate point based on the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data, and calculates the road section speed for the current period based on the matching results;
[0033] The average speed calculation module takes the average speed of each vehicle passing through the road section as the average speed of the current road section;
[0034] The output module outputs the average speed as the congestion level.
[0035] In a third aspect, the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the above-mentioned GPS-based real-time bus traffic condition calculation method.
[0036] In a fourth aspect, the present application provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute a process, and the process includes the above-mentioned GPS-based real-time bus traffic condition calculation method.
[0037] The main contributions and innovations of the present invention are as follows: 1. Compared with the existing technology, this application uses the bus's own onboard GPS data to calculate the bus speed, with finer granularity. It can calculate speed in the road section dimension, route dimension, and bus network dimension, rather than being limited to the route dimension calculated by vehicle stop announcement data, which has a wider analysis domain. At the same time, the calculated road conditions can accurately monitor the current bus operation status and obtain the spatiotemporal distribution of routes and sections with poor road conditions.
[0038] 2. Compared with the existing technology, this application uses the method of screening out the points with the greatest value. The purpose is to backtrack and find the best matching result. The corresponding road section is indexed by the coordinate point, so that the GPS track can match the correct road section. Knowing the GPS information on each road section, the speed of this road section can be calculated. The road section is the smallest dimension calculated in the road network. The line dimension and the entire bus network are composed of road sections. With the road section speed, the road conditions of the line and the bus network can be analyzed, so that the relevant departments can grasp the time periods and road section locations of frequently congested routes. When optimizing bus routes, the bus can consider combining passenger flow to avoid the congested road section and speed up the line. For sections with severe congestion, it can provide data support for applying for bus lanes.
[0039] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0041] Figure 1 This is a process of a method for calculating real-time bus traffic conditions based on GPS according to an embodiment of the present application;
[0042] Figure 2 is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application;
[0043] Figure 3 This is a schematic diagram of the Viterbi algorithm used in this application. DETAILED DESCRIPTION
[0044] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of one or more embodiments of this specification, as detailed in the appended claims.
[0045] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments, and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0046] Currently, the main source of information on bus congestion is based on bus stop announcements, which reflect the congestion between bus stops or even the entire line. However, the line speed or the speed between bus stops calculated based on the bus stop announcement data is an average, which cannot accurately grasp the actual congested sections of the bus line and the time segments of congestion. Therefore, it cannot effectively solve the problem of buses avoiding congestion.
[0047] Based on this, the present invention performs calculations based on the data of the bus-mounted GPS to solve the problems existing in the prior art.
[0048] Example 1
[0049] This application aims to propose a method for calculating the real-time traffic conditions of public transportation based on GPS. Figure 1 , the method comprises the following steps:
[0050] S00, obtaining the vehicle GPS data and road section data for the current period, and taking the road mileage traveled by the vehicle as the actual mileage for the current period;
[0051] Among them, the road section data is the data composed of a series of connected coordinate points;
[0052] In this embodiment, Flink (generally referring to Apache Flink, an open source stream processing framework developed by the Apache Software Foundation, whose core is a distributed streaming data flow engine written in Java and Scala. Flink executes arbitrary streaming data programs in a data-parallel and pipelined manner. Flink's pipeline runtime system can execute batch and stream processing programs) is used to ensure the real-time output of data. Flink is used to construct a sliding window with a window size of ten minutes and a sliding step of five minutes to capture vehicle GPS data within this time segment. The definition of the window size depends mainly on the reporting frequency of the vehicle's onboard GPS. The higher the frequency, the smaller the window size can be. When the GPS reporting frequency is low, the larger the window size should be, the more GPS data collected. In theory, the more GPS data on vehicles, the more accurate the calculation results. However, to ensure data timeliness, the window size should not be too large.
[0053] In this embodiment, the road segment data is prepared. The road segment is a LineString (a one-dimensional object representing a series of points and the line segments connecting these points) composed of a series of coordinate points. It is stipulated that the distance between the coordinate points on each road segment cannot be greater than 30m to reduce calculation errors.
[0054] Preferably, taking into account the drift and inaccurate positioning of the vehicle-mounted GPS, in order to avoid matching the vehicle GPS to the wrong road section, it is necessary to prepare the static route trajectory and road section matching results in advance, and combine the entire GPS trajectory to correctly match each GPS point to the coordinate point of the road section. Using this constraint can not only improve the accuracy of the matching, but also in this case, there will be errors in calculating the speed using the cumulative mileage of GPS. Using the vehicle's road mileage (the cumulative distance between the matching road section coordinate points) as the actual mileage in the current period will make the result more accurate.
[0055] Preferably, when preparing vehicle route list data, bus road conditions only analyze the road condition information of the road sections within the vehicle operating hours. For vehicles operating under other conditions, no corresponding processing is performed, because considering that there may be vehicles stopping at factories or terminals, or refueling and gas filling, the GPS data under these conditions is meaningless to analyze.
[0056] S10, performing abnormal processing on the vehicle GPS data to obtain valid vehicle GPS data;
[0057] In this embodiment, exception handling includes but is not limited to:
[0058] Remove GPS with empty latitude and longitude, or those that are not within the road network range;
[0059] De-duplicate GPS data with the same latitude, longitude, and time in advance;
[0060] Filter out messages with multiple GPS points at the same time in advance;
[0061] Since the vehicle-mounted equipment may transmit GPS supplementary data, which may affect the judgment of the vehicle's direction, the supplementary GPS data is filtered out.
[0062] Use waybill data to filter out GPS data outside of operating hours.
[0063] S20, matching each GPS point to the coordinate point using the Viterbi algorithm based on the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data, and calculating the road section speed for the current period based on the matching results;
[0064] In this embodiment, each GPS point is sorted in ascending chronological order, and coordinate points within a range of 100 meters around the point are searched, and the distances from the current point to all coordinate points within the range are recorded.
[0065] Ideally, an index should be created in real time to accelerate matching: For each route, all road sections along the route are analyzed. The road network is divided into 100x100 grids, and all coordinate points that make up the road section are assigned to each grid. The grid ID is then used to retrieve the coordinate points within that grid. When searching for coordinate points within 100 meters of a GPS point, the grid to which the current GPS point belongs is first obtained, and then all coordinate points within the nine surrounding grids are directly retrieved.
[0066] In this way, the distance between each coordinate point and the GPS point is calculated, and data outside the range of 100m is filtered out.
[0067] In this embodiment, the best matching result of each GPS is obtained through the Viterbi algorithm, record transfer and backtracking for the matching result:
[0068] Construct the first dictionary to record the maximum value of the current coordinate point (preDict, map (current coordinate point, value)), construct the second dictionary to record the path of the current coordinate point (prePath, map (current coordinate point, previous coordinate point)), and use all the coordinate points and distances obtained by searching (indexing) the first GPS point as the maximum value of the current coordinate point;
[0069] Starting from the second GPS point, traverse all possible matching coordinate points of the current GPS point (all possibilities);
[0070] Calculate the value of all coordinate points in the preDict of the first dictionary and all possible matching coordinate points of the current GPS point and record them;
[0071] The value of the current coordinate point recorded in curDict is val = the value of the previous coordinate point + the value of the current coordinate point + the number of jumps (the subscript of the current coordinate point - the subscript of the previous coordinate point) * 100 (search range) / 15;
[0072] Preferably, the maximum value of the current coordinate point is retained and the path is recorded in prePath. When the value calculation of the current possible coordinate point and a coordinate point in preDict is completed, the coordinate point in preDict needs to be discarded. The discard penalty must be greater than the skip penalty, otherwise the matching results will be more likely to be discarded. The discard value val = preVal.getValue() + 10*100 / 3.
[0073] After the traversal is completed, get the coordinate point with the largest value (preDict);
[0074] The specific steps for calculating the road speed of the current period based on the matching results are as follows:
[0075] Through the second dictionary, the path is traced back from the coordinate point with the greatest value and the coordinate point corresponding to each GPS point is recorded to obtain the best matching result.
[0076] Get the road section to which the point belongs through the coordinates;
[0077] Take the previous GPS point and the next GPS point of the current road section, and use the cumulative distance between the coordinate points matched by the two GPS points as the actual mileage;
[0078] Calculate the speed of each vehicle passing through the current road section in the current period based on the duration of the current period
[0079] S30: Take the average of the speeds of each vehicle passing through the road section as the average speed of the current road section and output it.
[0080] In this embodiment, the average speed of each road segment can be used to determine the congestion situation. Slower average speeds indicate greater congestion. This can be categorized by level, or combined with existing algorithms to calculate congestion. The road segment is the smallest dimension calculated in a road network. Both the route dimension and the entire bus network are composed of road segments. With the speed of each road segment, road conditions can be analyzed for both routes and the bus network.
[0081] In this embodiment, the application uses the Viterbi algorithm to perform record transfer and backtracking to obtain the best matching result for each GPS point. This algorithm defines two local states for recursion. The first local state is the maximum value recorded to the current point, and the second state is the recorded path. Figure 3 As shown in the figure, 1, 2, and 3 represent the coordinate points that each GPS point may match (the coordinate points here refer to the coordinate points on the road section, because in order to match the GPS point to the correct road section, the GPS point must first be matched with the coordinate point of the road section, and then the loop segment is indexed according to the coordinate point). In order to determine which coordinate point each GPS point matches, it is necessary to calculate the value between all the coordinate points indexed by each GPS point and all the coordinate points indexed by the next GPS point, and use preDict to record the maximum value to the current coordinate point, and use pathInv to retain the path for easy backtracking.
[0082] In the figure, between gps1 and gps2, the maximum value to coordinate point 1 in gps2 is 80, recorded in preDict as {1,80} and prePath as {1,2}; the maximum value to coordinate point 2 is 120, recorded in preDict as {2,120} and prePath as {2,3}; the maximum value to coordinate point 3 is 100, recorded in preDict as {3,1}, and so on, with prePath recorded as {3,1}. The calculation continues in this order, from gps2 to gps3. When calculating to gps4, the maximum value of coordinate point 1 is 300, and the maximum value of coordinate point 2 is 320. Therefore, coordinate point 2, with the highest value, is selected and backtracking begins using prePath. The final matching result is 2->1->2->2. By indexing the corresponding road segment based on the coordinate point, each GPS point can be accurately matched to the correct road segment.
[0083] Example 2
[0084] Based on the same concept, this application also proposes a GPS-based real-time bus traffic condition calculation device, comprising:
[0085] The acquisition module obtains the vehicle GPS data and road section data of the current period, and uses the road mileage traveled by the vehicle as the actual mileage in the current period; the road section data is data composed of a series of connected coordinate points;
[0086] The exception handling module performs exception handling on vehicle GPS data to obtain valid vehicle GPS data;
[0087] The matching calculation module uses the Viterbi algorithm to match each GPS point to the coordinate point based on the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data, and calculates the road section speed for the current period based on the matching results;
[0088] The average speed calculation module takes the average speed of each vehicle passing through the road section as the average speed of the current road section;
[0089] The output module outputs the average speed as the congestion level.
[0090] Example 3
[0091] This embodiment also provides an electronic device, referring to Figure 2 , includes a memory 404 and a processor 402, wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to perform the steps in any of the above method embodiments.
[0092] Specifically, the processor 402 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0093] Among them, the memory 404 may include a large-capacity memory 404 for data or instructions. By way of example and not limitation, the memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 404 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 404 may be inside or outside the data processing device. In a specific embodiment, the memory 404 is a non-volatile memory. In a specific embodiment, the memory 404 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (Programmable Read-Only Memory, abbreviated as PROM), an erasable PROM (Erasable Programmable Read-Only Memory, abbreviated as EPROM), an electrically erasable PROM (Electrically Erasable Programmable Read-Only Memory, abbreviated as EEPROM), an electrically alterable ROM (Electrically Alterable Read-Only Memory, abbreviated as EAROM) or a flash memory (FLASH) or a combination of two or more of these. In appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory 404 (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0094] The memory 404 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 402 .
[0095] The processor 402 reads and executes the computer program instructions stored in the memory 404 to implement any GPS-based real-time bus traffic condition calculation method in the above embodiments.
[0096] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408 , wherein the transmission device 406 is connected to the processor 402 , and the input / output device 408 is connected to the processor 402 .
[0097] Transmission device 406 can be used to receive or send data via a network. Specific examples of the aforementioned network may include a wired or wireless network provided by a communications provider of the electronic device. In one embodiment, the transmission device includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, transmission device 406 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0098] The input / output device 408 is used to input or output information. In this embodiment, the input information may be GPS data and road section data, and the output information may be average speed or congestion level.
[0099] Example 4
[0100] This embodiment also provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute a process. The process includes the GPS-based real-time bus traffic condition calculation method according to the first embodiment.
[0101] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be repeated here.
[0102] In general, various embodiments may be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that, as non-limiting examples, the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or a controller or other computing device, or some combination thereof.
[0103] Embodiments of the present invention can be implemented by computer software, which is executable by the data processor of the mobile device, such as in the processor entity, or is implemented by hardware, or is implemented by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product can include one or more computer executable components configured to perform the embodiment when the program is running. One or more computer executable components can be at least one software code or a part thereof. In addition, at this point, it should be noted that any box of the logic flow in the figure can represent a program step, or interconnected logical circuits, boxes and functions, or a combination of program steps and logical circuits, boxes and functions. The software can be stored in physical media such as memory chips or storage blocks implemented in the processor, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and their data variants, CDs. Physical media is non-transient media.
[0104] Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0105] The above embodiments merely illustrate several embodiments of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for calculating real-time bus traffic conditions based on GPS, characterized in that: The following steps are involved: S00, obtaining the vehicle GPS data and road section data for the current period, and taking the road mileage traveled by the vehicle as the actual mileage for the current period; Wherein, the road section data is data consisting of a series of connected coordinate points; S10, performing abnormal processing on the vehicle GPS data to obtain valid vehicle GPS data; Among them, exception handling includes: removing null values, duplicate data, re-transmitted data, and data outside of operating hours; S20, matching each GPS point to a coordinate point using a Viterbi algorithm based on the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data, and calculating the road section speed for the current period based on the matching result; The specific steps for matching each GPS point to a coordinate point using the Viterbi algorithm are as follows: Construct the first dictionary to record the maximum value of the current coordinate point, construct the second dictionary to record the path of the current coordinate point, and use all the coordinate points and distances obtained by searching the first GPS point as the maximum value of the current coordinate point; Starting from the second GPS point, traverse all possible matching coordinate points of the current GPS point in sequence; Calculate and record the values of all possible matching coordinate points of all coordinate points in the first dictionary and the current GPS point; After the traversal is completed, the coordinate point with the largest value is obtained; Through the second dictionary, the path is traced back from the coordinate point with the greatest value and the coordinate point corresponding to each GPS point is recorded to obtain the best matching result; The specific steps to calculate the road speed of the current period based on the matching results are as follows: Get the road section to which the point belongs through the coordinates; Take the previous GPS point and the next GPS point of the current road section, and use the cumulative distance between the coordinate points matched by the two GPS points as the actual mileage; Calculate the speed of each vehicle passing through the current road section during the current period based on the duration of the current period; S30: Take the average of the speeds of each vehicle passing through the road section as the average speed of the current road section and output it.
2. The method for calculating real-time bus traffic conditions based on GPS according to claim 1, wherein: In step S00, a window of set duration is created to capture vehicle GPS data. The window size is determined by the vehicle GPS reporting frequency. The higher the frequency, the smaller the window.
3. The method for calculating real-time bus traffic conditions based on GPS according to claim 1, wherein: In step S00, the road section data and the vehicle GPS data are analyzed using only data within the vehicle operating shift time.
4. The method for calculating real-time bus traffic conditions based on GPS according to claim 1, wherein: In step S10, the exception handling includes at least removing GPS data with empty longitude and latitude and outside the bus network range, deduplicating GPS data with the same longitude and latitude and the same time, filtering messages of multiple GPS points within the same time, filtering supplementary GPS data, and filtering GPS data outside the operating hours.
5. The method for calculating real-time bus traffic conditions based on GPS according to claim 1, wherein: In step S20, the specific steps for calculating the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data are as follows: Sort each GPS point in chronological order; Search for all coordinate points within the set radius of each GPS point; Calculate the distance between the GPS point and all coordinate points within the range.
6. A GPS-based real-time bus traffic condition calculation device, characterized in that: include: The acquisition module obtains the vehicle GPS data and road section data of the current period, and uses the road mileage traveled by the vehicle as the actual mileage in the current period; the road section data is data composed of a series of connected coordinate points; The exception handling module performs exception handling on vehicle GPS data to obtain valid vehicle GPS data; exception handling includes: removing null values, duplicate data, supplementary data, and data outside of operating hours; The matching calculation module uses the Viterbi algorithm to match each GPS point to the coordinate point based on the distance between the GPS point in the vehicle GPS data and each coordinate point in the road section data, and calculates the road section speed for the current period based on the matching results; The specific steps for matching each GPS point to a coordinate point using the Viterbi algorithm are as follows: Construct the first dictionary to record the maximum value of the current coordinate point, construct the second dictionary to record the path of the current coordinate point, and use all the coordinate points and distances obtained by searching the first GPS point as the maximum value of the current coordinate point; Starting from the second GPS point, traverse all possible matching coordinate points of the current GPS point in sequence; Calculate and record the values of all possible matching coordinate points of all coordinate points in the first dictionary and the current GPS point; After the traversal is completed, the coordinate point with the largest value is obtained; Through the second dictionary, the path is traced back from the coordinate point with the greatest value and the coordinate point corresponding to each GPS point is recorded to obtain the best matching result; The specific steps to calculate the road speed of the current period based on the matching results are as follows: Get the road section to which the point belongs through the coordinates; Take the previous GPS point and the next GPS point of the current road section, and use the cumulative distance between the coordinate points matched by the two GPS points as the actual mileage; Calculate the speed of each vehicle passing through the current road section during the current period based on the duration of the current period; The average speed calculation module takes the average speed of each vehicle passing through the road section as the average speed of the current road section; The output module outputs the average speed as the congestion level.
7. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the GPS-based real-time bus traffic condition calculation method according to any one of claims 1 to 5.
8. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which includes a program code for controlling a process to execute a process, and the process includes the GPS-based real-time bus traffic condition calculation method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Road condition information generating method based on bus global position system (GPS) tracking data
CN104318767A