Summary of the invention
In view of above-mentioned the deficiencies in the prior art, the object of the present invention is to provide a kind of active to find the method and system of the automobile friend with similar traffic route, be intended to solve existing searching automobile friend's method efficiency, the problem of weak effect.
Technical scheme of the present invention is as follows:
A method of finding the automobile friend with similar traffic route, wherein, comprises step:
A, every the schedule time, many vehicle position points are reported to server, the longitude that described location point is vehicle and latitude;
When B, the first vehicle in described vehicle send to server the request of finding the automobile friend with similar traffic route, calculate the longitude of location point and the arithmetical mean of latitude that each vehicle reports in a predetermined amount of time, the center point using this arithmetical mean as corresponding vehicle;
C, from server, filter out the vehicle that is less than preset distance with the center point of described the first vehicle;
D, the first vehicle and the longitude of location point and the precision of latitude of the vehicle that filters out are accurate to predetermined figure, judge successively in all location points that report of the first vehicle, whether have in the location point preset range that the location point over predetermined ratio reports at the vehicle filtering out, when being, in the vehicle filtering out, qualified target vehicle is set to the potential automobile friend of described the first vehicle.
The method of the automobile friend with similar traffic route is found in described active, and wherein, described steps A also comprises:
Server receives after the location point reporting, and judges that whether the location point that same vehicle this time reports is identical with the last location point of uploading, and when being, does not preserve the location point this time reporting, and when no, preserves the location point this time reporting.
The method of the automobile friend with similar traffic route is found in described active, and wherein, described predetermined figure is the 3rd of radix point.
The method of the automobile friend with similar traffic route is found in described active, and wherein, in described step C, the distance of the center point of the second vehicle in the first vehicle and server is:
, wherein, latitude1 and longitude1 are respectively latitude and the longitude of the first vehicle center location point, and latitude2 and longitude2 are respectively latitude and the longitudes of the second vehicle center location point.
The method of the automobile friend with similar traffic route is found in described active, and wherein, described predetermined ratio is 70%.
The method of the automobile friend with similar traffic route is found in described active, and wherein, in described step B, predetermined amount of time sends a front week for asking.
The method of the automobile friend with similar traffic route is found in described active, wherein, before described step D in, also comprise step:
Receive User window filter request;
The all location points that report of the first vehicle are carried out to period filtration;
The location point that the vehicle filtering out is reported carries out period filtration.
The system of the automobile friend with similar traffic route is found in a kind of active, wherein, comprise server and many vehicles that are connected with described server, described vehicle comprises location point reporting module, and described server comprises that center point computing module, vehicle screening module and automobile friend search module;
Described location point reporting module, for reporting to server every the schedule time by vehicle position point, the longitude that described location point is vehicle and latitude;
Described center point computing module, while sending to server the request of finding the automobile friend with similar traffic route for the first vehicle when described vehicle, calculate the longitude of location point and the arithmetical mean of latitude that each vehicle reports in a predetermined amount of time, the center point using this arithmetical mean as corresponding vehicle;
Described vehicle screening module while having the automobile friend of similar traffic route for finding when the first vehicle, filters out the vehicle that is less than preset distance with the center point of described the first vehicle from server;
Described automobile friend searches module, for the first vehicle and the longitude of location point and the precision of latitude of the vehicle filtering out are accurate to predetermined figure, judge successively in all location points that report of the first vehicle, whether have in the location point preset range that the location point over predetermined ratio reports at the vehicle filtering out, when being, in the vehicle filtering out, qualified target vehicle is set to the potential automobile friend of described the first vehicle.
The system of the automobile friend with similar traffic route is found in described active, and wherein, described server also comprises:
Location point comparison module, for receiving after the location point reporting, judges that whether the location point that same vehicle this time reports is identical with the last location point of uploading, and when being, does not preserve the location point this time reporting, and when no, preserves the location point this time reporting.
The system of the automobile friend with similar traffic route is found in described active, and wherein, described server also comprises period filtering module, and described period filtering module comprises:
Request reception unit, for receiving User window filter request;
The first vehicle period filter element, for carrying out period filtration to all location points that report of the first vehicle;
Screening vehicle period filter element, carries out period filtration for the location point that the vehicle filtering out is reported.
Beneficial effect: the present invention calculates by the location point that many vehicles were reported every the schedule time, first preliminary screening goes out the vehicle may with similar traffic route, then the precision of location point is adjusted, and the location point of each vehicle is compared one by one, thereby accurately filter out the potential automobile friend with similar traffic route, because the present invention is a kind of process of initiatively finding automobile friend, rather than passive wait is replied, so it is high that the present invention finds automobile friend's efficiency, effect also significantly improves.
Embodiment
The invention provides a kind of active and find the method and system of the automobile friend with similar traffic route, for making object of the present invention, technical scheme and effect clearer, clear and definite, below the present invention is described in more detail.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Refer to Fig. 1, Fig. 1 is the process flow diagram that the present invention initiatively finds the method preferred embodiment of the automobile friend with similar traffic route, and as shown in the figure, it comprises step:
S101, every the schedule time, many vehicle position points are reported to server, the longitude that described location point is vehicle and latitude;
When S102, the first vehicle in described vehicle send to server the request of finding the automobile friend with similar traffic route, calculate the longitude of location point and the arithmetical mean of latitude that each vehicle reports in a predetermined amount of time, the center point using this arithmetical mean as corresponding vehicle;
S103, from server, filter out the vehicle that is less than preset distance with the center point of described the first vehicle;
S104, the first vehicle and the longitude of location point and the precision of latitude of the vehicle that filters out are accurate to predetermined figure, judge successively in all location points that report of the first vehicle, whether have in the location point preset range that the location point over predetermined ratio reports at the vehicle filtering out, when being, in the vehicle filtering out, qualified target vehicle is set to the potential automobile friend of described the first vehicle.
In step S101, be first that the car machine system that vehicle is installed reports server by the position point of its vehicle, be generally to report location point one time every 30s.Wherein, described location point refers to the latitude and longitude information of vehicle, the form of longitude and latitude is longitude and the latitude that standard format Double(comprises position), degree of accuracy when it is uploaded is after radix point six, as (22.540712,114.095432), and server receives after the information of location point, not only longitude and the latitude of location point preserved in record, the car machine ID that also record reports and the time reporting, and its storage format table one:
Table one location point storage format
SeqId |
DevId |
PX |
PY |
LogTime |
1 |
DEV12315 |
22.540712 |
114.095432 |
2012-11-21 08:28:34 |
2 |
DEV12315 |
22.540713 |
114.100425 |
2012-11-21 08:29:04 |
3 |
DEV12315 |
22.540926 |
114.104143 |
2012-11-21 08:29:34 |
4 |
DEV12315 |
22.541637 |
114.108852 |
2012-11-21 08:31:04 |
Wherein, SeqId represents LSN, and DevId represents car machine ID, and PX represents longitude, and PY represents latitude, and LogTime represents the time reporting.
Data slot is above one section of real location point record, wherein, article 3, the time phase difference and between the 4th 90s, rather than 30s, its reason be during this period of time in vehicle do not move (may be temporary parking or the reason such as wait traffic lights), so the location point reporting is during this period of time all identical, and if there is this situation, only uploading different location points, there is the process of a judgement in it.
Specifically, described step S101 also comprises:
Server receives after the location point reporting, and judges that whether the location point that same vehicle this time reports is identical with the last location point of uploading, and when being, does not preserve the location point this time reporting, and when no, preserves the location point this time reporting.Being reported to like this data in server is all different location points, and identical location point only retains once, and the data of these location points are all kept in the database of server, for follow-up.
In addition, in the present invention, find the automobile friend of similar traffic route, mainly for using car period and the more stable and normal working clan of route, for example, the average time of using cars of user every day is 3 hours, in this case, the number of the location point that every vehicle reported in one week is estimated as 2160, if there are 10,000 vehicles, what in one week, report is recorded in 2,160 ten thousand, consider that repeatable position does not report, weekend is without situations such as cars, should be below 2,000 ten thousand grades, thus for the possible data recording of the present invention, carry out a "ball-park" estimate.
In step S102, a certain vehicle in described vehicle (the present invention be take the first vehicle as example) needs to find while having the automobile friend of similar traffic route, need send request to server, server receives after request, start to calculate the longitude of location point and the arithmetical mean of latitude that each vehicle reports in a predetermined amount of time, the center point using this arithmetical mean as corresponding vehicle.This step is whether roughly to have similar route for vehicle that differentiation roughly connects to server, because the center that said method calculates point is the center of vehicle driving route, if so when the center of two vehicles point differs larger, illustrate that these two vehicles unlikely have similar route.
Above-mentioned predetermined amount of time is that the first vehicle sends the week before request, has so both avoided calculating too much data, can conform to nearest trip rule again.
In step S103, from server, filter out the vehicle that is less than preset distance with the center point of described the first vehicle, this step is to utilize the center point of each vehicle that previous calculations obtains, judge the distance of the center point of each vehicle and the first vehicle, if be greater than preset distance, explanation, the traffic route of these two vehicles is unlikely similar, thereby filters out the vehicle may to the first vehicle with similar traffic route.Preferably 1 kilometer of described preset distance, but this value is not what fix, specifically can be according to actual conditions adjustment.This screening technique also some are there is to the similar while of shape relatively far apart the traffic route of (Yi Ge street is for example separated by) screen, so the similar traffic route of shape is also not necessarily similar.
Above-mentioned screening technique is a rough process, because, even the center point close proximity of two vehicles, for example the center point of two vehicles is on same right-angled intersection, but the traffic route of these two vehicles may be completely different, this step can not be got rid of this situation, but above-mentioned screening technique can filter out most of dissimilar path, thereby has alleviated greatly the workload of next step calculating.
The computing formula of the center point of two vehicles is as follows:
In above-mentioned formula, S represents the distance of A center point and B center point, Lat1 represents the latitude of A center point, Lat2 represents the latitude of B center point, a represents latitude poor of A, B 2 center points, b represents longitude poor of A, B 2 center points, and 6378.137 represent the radius of the earth, and unit is km.
If with the longitude and latitude form reporting in the present invention, above-mentioned computing formula can be reduced to:
A center point with the distance S of B center point is:
In above-mentioned formula, latitude1 and longitude1 are respectively latitude and the longitude of the first vehicle center location point, and latitude2 and longitude2 are respectively dimension and the longitudes of the second vehicle center location point.
In step S104, from the vehicle reporting, filter out after the vehicle may with similar traffic route, need further accurately screening, this process comprises first adjusts the precision of the location point reporting, and then according to the location point after adjusting, calculates.
Specifically, because being reported to the longitude of the location point in server and the precision of latitude is the 6th of radix point, and through calculating on map, the 4th the every increase of decimal 1 unit, mobile distance is between 1 to 2 meter, and the precision of the 4th decimal is between 1 to 2 meter.Same through measuring and calculating, the precision of the 4th decimal is 100 meters of left and right, and the precision of the 2nd is 1000 meters of left and right.
And vehicle reports the time interval of location point, be 30s, the words of calculating according to average speed 30km/h, the mean distance of adjacent two location points is 250 meters, so, when judging that whether traffic route is similar, the precision of the longitude of location point and latitude can be accurate to the 3rd of radix point, that is to say, if three is the same after the longitude of two location points and the radix point of latitude, can think that these two location points are that overlap or very approaching.If precision is accurate to the 4th of radix point, the standard of judgement is probably 1 meter to 2 meters left and right, such standard is too meticulous, substantially cannot search out the automobile friend of similar route, if and precision is accurate to the 2nd of radix point, judgement standard probably 1000 meters of left and right, such standard is too rough again, the automobile friend of the similar route searching out is too much, and the effect finally obtaining is also poor.
After degree of accuracy is adjusted, need to judge successively in all location points that report of the first vehicle whether have in the location point that the location point over predetermined ratio reports at the vehicle filtering out.
In specific operation process, the vehicle of initiating request can be designated as to M0, and the vehicle of searching can be designated as M1, M2 ..., MN.
The traffic route of M0 can be regarded as the location point set reporting in the week on it, location point set as corresponding in M0 is C0, the location point set that M1 is corresponding is C1, the location point set that M2 is corresponding is C2, the location point set that MN is corresponding is CN, and the element in each set is a series of location point.Concept corresponding List and Point object in Java of set and location point, Point object has two attributes, longitude and latitude, and be accurate to the 3rd of radix point.
The relatively location point set C0 of M0 and the location point set of other vehicles one by one now, first relatively gather C0 and C1, if had in C0, surpass 70% element (being location point) in C1, judge that M1 has the automobile friend of similar traffic route with M0, meanwhile, if there is no to surpass 70% element in C1 in C0, judge that M0 has the automobile friend of similar traffic route with M1, be this be relatively unidirectional, M1 is the automobile friend of M0, and the M0 automobile friend of M1 not necessarily.It is embodied in concrete traffic route, be most traffic routes (surpass 70%) of M0 in the traffic route of M1, but M1 only has part traffic route (lower than 70%) in the traffic route of M0.
Repeat comparison procedure above, successively by C0 and C2, C3 ..., CN comparison, surpasses 70% element in set relatively if having in C0, illustrate that corresponding vehicle is the automobile friend that M0 has similar traffic route.
Further, this method further coupling is found above-mentioned C0 and C1, C2, and C3 ..., association corresponding to time of CN, finds in the similar period automobile friend of similar traffic route.Such as M0 had identical traffic route in one day with M1, can think that M0 and M1 are the driving automobile friends in a day, but M0 and the M1 travel time in one day may differ larger, so can also further find, be accurate in the moment, for example, in one hour, the automobile friend of synchronization even.And then as shown in Figure 2, this method also comprises step:
S201, reception User window filter request, before this process, user need set one and filter the period, then send period filter request, for example user can ask to filter out the automobile friend of working period 7:30 ~ 8:30 or next period 5:30 ~ 6:30, or filters any filtration period that meets user's request according to user's trip rule request.
S202, all location points that report of the first vehicle are carried out to period filtration; The process that period filters is by the filtration period of setting according to user, the all location points that report that do not meet this filtration period in the first vehicle are filtered out, thereby retain, meet the location point that filters the period, the filtration period that for example user sets is 7:30 ~ 8:30, the location point that only retains the first vehicle between 7:30 ~ 8:30, for the comparison determining step of S104 above.
S203, the location point that the vehicle filtering out is reported carry out period filtration, and this step is with identical to all period filter processes of location point that report of the first vehicle.After carrying out period filtration, count and will change according to the length of filtering the period in corresponding position, if the filtration period is shorter, the location point that each vehicle retains is by less, in order to guarantee to find automobile friend's accuracy, so need suitably to increase the set sizes of location point, increase the size of predetermined amount of time, the size of predetermined amount of time can be set as to two weeks, one month, two months etc., a corresponding relation that filters period and predetermined amount of time specifically can be set, when user selects a certain filtration during the period, according to described corresponding relation, find out the size of predetermined amount of time.
What deserves to be explained is, the screening process of above-mentioned similar period is to carry out before step S104, can be to carry out the screening of period together with inquiry for the first time simultaneously, also can be on the basis of subsequent query result enterprising row filter.
After searching out the automobile friend of similar traffic route, this automobile friend is only the potential good friend of the first vehicle, server can push good friend's request message to the mobile terminal of found potential automobile friend's binding, found potential automobile friend can decide whether set up good friend's relation with other users in its sole discretion, if found potential automobile friend has accepted good friend's request, found potential automobile friend and the car owner who initiatively finds are set up to good friend's relation, both sides also can carry out ensuing information communication.
Based on said method, the present invention also provides a kind of active to find the system of the automobile friend with similar traffic route, as shown in Figure 3, in many vehicle 100(figure that comprise server 200 and be connected with described server 200, only illustrate one), described vehicle 100 comprises location point reporting module 110, and described server 200 comprises that center point computing module 210, vehicle screening module 220 and automobile friend search module 230;
Described location point reporting module 110, for reporting to server every the schedule time by vehicle position point, the longitude that described location point is vehicle and latitude;
Described center point computing module 210, while sending to server the request of finding the automobile friend with similar traffic route for the first vehicle when described vehicle, calculate the longitude of location point and the arithmetical mean of latitude that each vehicle reports in a predetermined amount of time, the center point using this arithmetical mean as corresponding vehicle;
Described vehicle screening module 220 while having the automobile friend of similar traffic route for finding when the first vehicle, filters out the vehicle that is less than preset distance with the center point of described the first vehicle from server;
Described automobile friend searches module 230, for the first vehicle and the longitude of location point and the precision of latitude of the vehicle filtering out are accurate to predetermined figure, judge successively in all location points that report of the first vehicle, whether have in the location point preset range that the location point over predetermined ratio reports at the vehicle filtering out, when being, in the vehicle filtering out, qualified target vehicle is set to the potential automobile friend of described the first vehicle.
Further, described server 200 also comprises:
Location point comparison module, for receiving after the location point reporting, judges that whether the location point that same vehicle this time reports is identical with the last location point of uploading, and when being, does not preserve the location point this time reporting, and when no, preserves the location point this time reporting.
Further, as shown in Figure 4, described server 200 also comprises period filtering module, and described period filtering module comprises:
Request reception unit 300, for receiving User window filter request;
The first vehicle period filter element 400, for carrying out period filtration to all location points that report of the first vehicle;
Screening vehicle period filter element 500, carries out period filtration for the location point that the vehicle filtering out is reported.
This other technologies details of initiatively finding the system of the automobile friend with similar traffic route please refer to the description of preceding method, does not repeat them here.
In sum, the present invention calculates by the location point that many vehicles were reported every the schedule time, first preliminary screening goes out the vehicle may with similar traffic route, then the precision of location point is adjusted, and the location point of each vehicle is compared one by one, thereby accurately filter out the automobile friend with similar traffic route, because the present invention is a kind of process of initiatively finding automobile friend, rather than passive wait replys, so that the present invention finds automobile friend's efficiency is high, effect also significantly improves.
Should be understood that, application of the present invention is not limited to above-mentioned giving an example, and for those of ordinary skills, can be improved according to the above description or convert, and all these improvement and conversion all should belong to the protection domain of claims of the present invention.