Method for quickly matching bus stops and road sections in electronic map
Technical Field
The invention relates to the technical field of quick generation of computer abstract expressions of urban traffic systems, in particular to a method for quickly matching bus stations and road sections in an electronic map.
Background
With the accelerated development of urbanization in China, the development of urban traffic faces new challenges. The urban public transport has the advantages of high intensive efficiency, energy conservation, environmental protection and the like, the inevitable requirements of relieving traffic jam, changing the urban traffic development mode, improving the quality of life of people and improving the basic public service level of the government for preferentially developing the public transport are necessary requirements, and the strategic selection for constructing the resource-saving and environment-friendly society is provided.
One of the most important problems is to reasonably arrange and plan a city bus network to avoid the situation of too many passengers on some lines, so that a passer is willing to use the bus. The bus passenger flow distribution prediction is carried out in the urban traffic network, so that a good decision basis can be provided for planners, and the method is an important information source for predicting whether the bus route is reasonable in advance. The bus passenger flow distribution means that the obtained bus OD traffic volume is distributed to each bus line in the network according to the known bus network description and a certain rule, so as to calculate the passenger flow volume of the bus line.
In order to accurately predict the selection behavior of the passenger, the real bus travel time is calculated. The ground buses need to travel in a road system, and depend on the attributes and traffic conditions of the traveling road, such as whether there is a bus lane or whether there is congestion. The existing public transport distribution models directly distribute public transport passenger flow on a public transport network, endow each bus with fixed running time and neglect the influence of a road system on the running time of the public transport, so that the distribution result is not very accurate; at present, an urban traffic management department or some map websites have electronic maps and longitude and latitude coordinates of bus stops, but the bus stops and a road network independently exist, the bus stops and the road network do not have any form of association, if the relationship between the bus stops and road sections is matched, the bus stops and the road sections need to be confirmed manually, manpower is wasted, and carelessness is easy to occur.
Disclosure of Invention
In order to solve the existing problems, the invention provides a method for quickly matching bus stops and road sections in an electronic map, the invention automatically matches the road sections to which the stops belong according to the position relationship between the bus stops and the road sections, and finally displays the bus stops which cannot be automatically distinguished by a computer in the map, so that a user can automatically match the road sections to which the bus stops belong, thereby saving the time for manually matching the road sections one by one, improving the matching accuracy, and for the purpose, the invention provides a method for quickly matching the bus stops and the road sections in the electronic map, which comprises the following steps:
converting longitude and latitude coordinates of bus stops and longitude and latitude coordinates of topological points forming road sections in an electronic map into coordinates of a UTM (universal time management) plane coordinate system, wherein the converted coordinate unit is meter; all bus stops in the electronic map form a set S1, and all road sections form a set W;
if the set W is empty, the step (2) is switched to the step (6), otherwise, a road section L is randomly selected from the set W; traversing all topological points forming the road section L, and recording the minimum value of the abscissa, the maximum value of the abscissa, the minimum value of the ordinate and the maximum value of the ordinate as xmin and ymax in the points; searching a rectangular area D by using a bus stop of a road section L consisting of four vertexes, wherein the coordinates of the four vertexes are (xmin-D, ymin-D), (xmin-D, ymax + D), (xmax + D, ymin-D), (xmax + D, ymax + D);
step (3) setting a bus stop set contained in the bus stop search rectangular area D as S2, and setting an initial state S2 as an empty set; sequentially judging whether the bus stops in the set S1 are in the region D or not, if the coordinates (x, y) of the bus stops meet the conditions that xmin-D is less than x and less than xmax + D and ymin-D is less than y and less than ymax + D, placing the bus stops in the region D into the set S2, and if not, continuously judging the next bus stop until all bus stops in S2 are judged once;
step (4) if the S2 is an empty set, deleting the road section L in the set W, returning to the step (2), otherwise, arbitrarily selecting a bus stop B from the S2;
step (5) setting a road section L to be composed of n topological points, and arranging the topological points in sequence to form a set (P1, …, Pn), wherein the starting point is P1, and the end point is Pn; and sequentially judging the relationship between a line segment consisting of the topological points Pi and Pi +1 and the site B, wherein the judgment formula is as follows:
wherein, represents the vector inner product, x represents the vector outer product, x represents the product of two numbers; if the topological points Pi and Pi +1 (i is more than or equal to 1 and less than or equal to n-1, and i is an integer) in the topological point set forming the road section L satisfy the formulas (1), (2), (3) and (4), the bus station B belongs to the road section L, the bus station B is deleted from the set S1 and the set S2 at the same time, the step (4) is returned, otherwise, the bus station B is deleted from the set S2, and the step (4) is returned;
step (6), if the bus stop set S1 is an empty set, the matching is finished, and the matching of the bus stops and the road sections in the electronic map is finished; otherwise, the positions of the sites in S1 are displayed in the electronic map, the road segments to which the sites belong are determined by the user, and each time a road segment to which a site belongs is determined, the site is deleted from S1 until the matching of the bus site and the road segment is finished after S1 is empty set.
In the step (1), the longitude and latitude coordinates of the bus stop in the electronic map and the longitude and latitude coordinates of the topological points forming the road section are converted into UTM plane coordinate system coordinates by adopting a unified horizontal axis mercator projection method in cartography.
In a further improvement of the invention, in the step (2) and the step (3), the farthest vertical distance d of the bus stop deviating from the road section is set to be 15 meters.
The invention discloses a method for quickly matching bus stops and road sections in an electronic map, which comprises the steps of firstly determining a bus stop search area of each road section, taking the bus stops in the area as to-be-detected stops, then judging whether the distances between the to-be-detected stops and a certain road section are within a reasonable deviation range and on the right side of the road section one by one, if so, considering that the road section of the stop is successfully matched, and finally enabling a user to manually match the bus stops and the road sections which are not matched on the map, thereby completing the whole matching process and improving the matching speed and accuracy.
Drawings
FIG. 1 is a flow chart of a method for quickly matching bus stops and road segments in an electronic map according to the present invention;
FIG. 2 is a schematic view of a road segment and a bus stop to be inspected around the road segment in accordance with one embodiment of the present invention;
Detailed Description
The invention is described in further detail below with reference to the following detailed description and accompanying drawings:
the invention provides a method for quickly matching bus stops and road sections in an electronic map, which automatically matches the road sections to which the stops belong according to the position relationship between the bus stops and the road sections, and finally displays the bus stops which cannot be automatically distinguished by a computer in the map, so that a user can automatically match the road sections to which the stops belong, thereby saving the time for manually matching the road sections one by one and improving the matching accuracy.
The invention relates to a method for quickly matching bus stops and road sections in an electronic map, and the flow of the method is shown in figure 1.
Converting longitude and latitude coordinates of bus stops and longitude and latitude coordinates of topological points forming road sections in an electronic map into coordinates of a UTM (universal time management) plane coordinate system, wherein the converted coordinate unit is meter; all bus stops in the electronic map form a set S1, and all road sections form a set W;
if the set W is empty, the step (2) is switched to the step (6), otherwise, a road section L is randomly selected from the set W; traversing all topological points forming the road section L, and recording the minimum value of the abscissa, the maximum value of the abscissa, the minimum value of the ordinate and the maximum value of the ordinate as xmin and ymax in the points; searching a rectangular area D by using a bus stop of a road section L consisting of four vertexes, wherein the coordinates of the four vertexes are (xmin-D, ymin-D), (xmin-D, ymax + D), (xmax + D, ymin-D), (xmax + D, ymax + D);
in this embodiment, a road segment L is arbitrarily selected as shown in fig. 2. The link L is composed of 5 topological points P1, P2, P3, P4 and P5, the coordinates are (1456.79,1113.7), (1698.77,995.185), (2050.62,1044.57), (2235.8,1182.96), (2427.16,1396.42), the minimum value xmin on the abscissa among these points is 1456.79, the maximum value xmax on the abscissa is 2427.16, the minimum value ymin on the ordinate is 995.185, and the maximum value ymax on the ordinate is 1396.42, then the vertex coordinates of the rectangular area D are (1441.79,980.185), (1441.79, 1411.42), (2442.16, 980.185) and (2442.16, 1411.42);
step (3) setting a bus stop set contained in the bus stop search rectangular area D as S2, and setting an initial state S2 as an empty set; sequentially judging whether the bus stops in the set S1 are in the region D or not, if the coordinates (x, y) of the bus stops meet the conditions that xmin-D is less than x and less than xmax + D and ymin-D is less than y and less than ymax + D, placing the bus stops in the region D into the set S2, and if not, continuously judging the next bus stop until all bus stops in S2 are judged once;
in this embodiment, for the road segment L, there are 3 bus stops B1, B2 and B3 in the set S2, and the coordinates thereof are (1710.14,1009), (2016.89, 987.815) and (2415,1361.43), respectively;
step (4) if the S2 is an empty set, deleting the road section L in the set W, returning to the step (2), otherwise, arbitrarily selecting a bus stop B from the S2;
step (5) setting a road section L to be composed of n topological points, and arranging the topological points in sequence to form a set (P1, …, Pn), wherein the starting point is P1, and the end point is Pn; and sequentially judging the relationship between a line segment consisting of the topological points Pi and Pi +1 and the site B, wherein the judgment formula is as follows:
wherein, represents the vector inner product, x represents the vector outer product, x represents the product of two numbers; if the topological points Pi and Pi +1 (i is more than or equal to 1 and less than or equal to n-1, and i is an integer) in the topological point set forming the road section L satisfy the formulas (1), (2), (3) and (4), the bus station B belongs to the road section L, the bus station B is deleted from the set S1 and the set S2 at the same time, the step (4) is returned, otherwise, the bus station B is deleted from the set S2, and the step (4) is returned;
in the present embodiment, the station B1, although satisfying the conditions (1), (2), and (3) in the segment P2P3, does not satisfy the condition (4), and indicates that the station B1 is on the other side of the travel direction of the link L, and deletes the station B1 from the set S2; while the site B2 satisfies the conditions (1), (2), and (4) in the segment P2P3, but does not satisfy the condition (3), indicating that the site B2 is too far away from the link L and may belong to another link, the site B2 is deleted from the set S2; the site B3, when the line segment P4P5 satisfies the conditions (1), (2), (3) and (4), indicates that the site B3 belongs to the link L, deletes the site B3 from the sets S1 and S2, leaves the set S2 empty, and returns to the step (2) to check the sites to which other links belong;
step (6), if the bus stop set S1 is an empty set, the matching is finished, and the matching of the bus stops and the road sections in the electronic map is finished; otherwise, the positions of the sites in S1 are displayed in the electronic map, the road segments to which the sites belong are determined by the user, and each time a road segment to which a site belongs is determined, the site is deleted from S1 until the matching of the bus site and the road segment is finished after S1 is empty set.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention in any way, but any modifications or equivalent variations made according to the technical spirit of the present invention are within the scope of the present invention as claimed.