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 with the automobile friend of similar traffic route, be intended to solve existing searching the method efficiency of automobile friend, the problem of weak effect.
Technical scheme of the present invention is as follows:
A method with the automobile friend of similar traffic route is found in active, wherein, comprises step:
A, every the schedule time, multiple stage vehicle position point is reported to server, described location point is longitude and the latitude of vehicle;
B, when the first vehicle in described vehicle to server send find there is the request of the automobile friend of similar traffic route time, calculate each chassis the longitude of location point reported in a predetermined amount of time and the arithmetical mean of latitude, using the center point of this arithmetical mean as corresponding vehicle;
C, from server, filter out the vehicle being less than preset distance with the center point of described first vehicle;
D, the first vehicle and the longitude of location point of vehicle filtered out and the precision of latitude are accurate to predetermined figure, judge in all location points reported of the first vehicle successively, whether there is the location point exceeding predetermined ratio in the location point preset range that the vehicle filtered out reports, when being, then target vehicle qualified in the vehicle filtered out is set to the potential automobile friend of described first vehicle.
The method with the automobile friend of similar traffic route is found in described active, and wherein, described steps A also comprises:
After server receives the location point reported, judge that whether the location point that same vehicle this time reports is identical with the last location point uploaded, when being, not preserving the location point this time reported, when no, preserving the location point this time reported.
The method with the automobile friend of similar traffic route is found in described active, and wherein, described predetermined figure is after radix point three.
The method with the automobile friend of 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 is respectively latitude and the longitude of the first vehicle center location point, latitude2 and longitude2 is latitude and the longitude of the second vehicle center location point respectively.
The method with the automobile friend of similar traffic route is found in described active, and wherein, described predetermined ratio is 70%.
The method with the automobile friend of similar traffic route is found in described active, and wherein, in described step B, predetermined amount of time is the week before request sends.
The method with the automobile friend of similar traffic route is found in described active, wherein, in before described step D, also comprises step:
Receive User window filter request;
Period filtration is carried out to all location points reported of the first vehicle;
Period filtration is carried out to the location point that the vehicle filtered out reports.
The system with the automobile friend of similar traffic route is found in a kind of active, wherein, the multiple stage vehicle comprising server and be connected with described server, described vehicle comprises location point reporting module, and described server comprises center point computing module, vehicle screening module and automobile friend and searches module;
Described location point reporting module, for vehicle position point being reported to server every the schedule time, described location point is longitude and the latitude of vehicle;
Described center point computing module, for when the first vehicle in described vehicle to server send find there is the request of the automobile friend of similar traffic route time, calculate each chassis the longitude of location point reported in a predetermined amount of time and the arithmetical mean of latitude, using the center point of this arithmetical mean as corresponding vehicle;
Described vehicle screening module, when having the automobile friend of similar traffic route for finding when the first vehicle, filters out the vehicle being less than preset distance with the center point of described first vehicle from server;
Described automobile friend searches module, for the first vehicle and the longitude of location point of vehicle filtered out and the precision of latitude are accurate to predetermined figure, judge in all location points reported of the first vehicle successively, whether there is the location point exceeding predetermined ratio in the location point preset range that the vehicle filtered out reports, when being, then target vehicle qualified in the vehicle filtered out is set to the potential automobile friend of described first vehicle.
The system with the automobile friend of similar traffic route is found in described active, and wherein, described server also comprises:
Location point comparison module, after receiving the location point that reports, judges that whether the location point that location point that same vehicle this time reports and last time upload is identical, when being, not preserving the location point this time reported, when no, preserving the location point this time reported.
The system with the automobile friend of 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;
First vehicle period filter element, for carrying out period filtration to all location points reported of the first vehicle;
Screening vehicle period filter element, carries out period filtration for the location point reported the vehicle filtered out.
Beneficial effect: the present invention is by calculating multiple stage vehicle every the location point that the schedule time reports, 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, thus accurately filter out the potential automobile friend with similar traffic route, because the present invention is a kind of process initiatively finding automobile friend, instead of passive wait is replied, so the efficiency that the present invention finds automobile friend is high, effect also significantly improves.
Embodiment
The invention provides a kind of active and find the method and system with the automobile friend of similar traffic route, for making object of the present invention, technical scheme and effect clearly, clearly, the present invention is described in more detail below.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
Refer to Fig. 1, Fig. 1 is that the present invention initiatively finds the process flow diagram with the method preferred embodiment of the automobile friend of similar traffic route, and as shown in the figure, it comprises step:
S101, every the schedule time, multiple stage vehicle position point is reported to server, described location point is longitude and the latitude of vehicle;
S102, when the first vehicle in described vehicle to server send find there is the request of the automobile friend of similar traffic route time, calculate each chassis the longitude of location point reported in a predetermined amount of time and the arithmetical mean of latitude, using the center point of this arithmetical mean as corresponding vehicle;
S103, from server, filter out the vehicle being less than preset distance with the center point of described first vehicle;
S104, the first vehicle and the longitude of location point of vehicle filtered out and the precision of latitude are accurate to predetermined figure, judge in all location points reported of the first vehicle successively, whether there is the location point exceeding predetermined ratio in the location point preset range that the vehicle filtered out reports, when being, then target vehicle qualified in the vehicle filtered out is set to the potential automobile friend of described first vehicle.
In step S101, being first that the position of its vehicle point is reported server by the car machine system that vehicle is installed, is generally report a location point every 30s.Wherein, described location point refers to the latitude and longitude information of vehicle, the form of longitude and latitude is standard format Double (namely comprising longitude and the latitude of position), degree of accuracy when it is uploaded is after radix point six, as (22.540712,114.095432), and after server receives the information of location point, not only longitude and the latitude of location point preserved in record, also records the car machine ID reported and the time reported, its storage format table one:
Table one location point storage format
SeqId |
DevId |
PX |
PY |
LogTime |
1 |
DEV12315 |
22.540712 |
114.095432 |
2012-11-2108:28:34 |
2 |
DEV12315 |
22.540713 |
114.100425 |
2012-11-2108:29:04 |
3 |
DEV12315 |
22.540926 |
114.104143 |
2012-11-2108:29:34 |
4 |
DEV12315 |
22.541637 |
114.108852 |
2012-11-2108: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 reported.
Data slot is above one section of real location point record, wherein, article 3, time phase difference and between the 4th article 90s, instead of 30s, its reason be during this period of time in vehicle do not move (may be temporary parking or the reason such as to wait traffic lights), so the location point reported during this period of time is all identical, and if there is this situation, then only uploading different location points, there is a process judged in it.
Specifically, described step S101 also comprises:
After server receives the location point reported, judge that whether the location point that same vehicle this time reports is identical with the last location point uploaded, when being, not preserving the location point this time reported, when no, preserving the location point this time reported.Be reported to the data in server to be all different location points like this, 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, the automobile friend of similar traffic route is found in the present invention, mainly for car period and the more stable and normal working clan of route, such as, the average time of using cars of user every day is 3 hours, in this case, the number of the location point that every chassis reported in the week is estimated as 2160, if there are 10,000 chassis, what report in one week is recorded in 2,160 ten thousand, consider that repeatable position does not report, weekend without situations such as cars, below 2,000 ten thousand grades, thus a "ball-park" estimate should be carried out for the data record that the present invention is possible.
In step s 102, when a certain vehicle (the present invention is for the first vehicle) in described vehicle needs searching to have the automobile friend of similar traffic route, request need be sent to server, after server receives request, start to calculate each chassis the longitude of location point reported in a predetermined amount of time and the arithmetical mean of latitude, using the center point of this arithmetical mean as corresponding vehicle.This step is whether the vehicle connected in order to differentiation roughly and server roughly has similar route, because the center point that said method calculates is the center of vehicle driving route, if so when the center point difference of two vehicles is larger, then illustrate that this two chassis unlikely has similar route.
Above-mentioned predetermined amount of time is the week before the first vehicle sends request, has so both avoided calculated many data, and can conform to again with nearest trip rule.
In step s 103, the vehicle being less than preset distance with the center point of described first vehicle is filtered out from server, this step is the center point of each vehicle utilizing previous calculations to obtain, judge the distance of the center point of each vehicle and the first vehicle, if be greater than preset distance, then illustrate, the traffic route of this two chassis is unlikely similar, thus filters out the vehicle may to the first vehicle with similar traffic route.Described preset distance preferably 1 kilometer, but this value is not fixing, specifically can adjust according to actual conditions.This screening technique also some are had shape similar while (be such as separated by a street) relatively far apart traffic route screening fall, so the similar traffic route of shape is also not necessarily similar.
Above-mentioned screening technique is a rough process, because, even if the center point close proximity of two chassis, the center point of such as two chassis is on same right-angled intersection, but the traffic route of this two chassis may be completely different, this step can not get rid of this situation, but above-mentioned screening technique can filter out most of dissimilar path, thus alleviates next step workload calculated greatly.
The computing formula of the center point of two chassis 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 A, B two difference of latitude of center point, b represents A, B two difference of longitude of center point, and 6378.137 radiuses representing the earth, unit is km.
If with the longitude and latitude form reported in the present invention, above-mentioned computing formula can be reduced to:
The distance S of A center point and B center point is:
In above-mentioned formula, latitude1 and longitude1 is respectively latitude and the longitude of the first vehicle center location point, latitude2 and longitude2 is dimension and the longitude of the second vehicle center location point respectively.
In step S104, filter out the vehicle may with similar traffic route from the vehicle reported after, need further accurately screening, this process comprises and first the precision of the location point reported being adjusted, and then calculates according to the location point after adjustment.
Specifically, because be reported to the longitude of the location point in server and the precision of latitude to be radix point the 6th, and through calculating on map, the 4th decimal often increases by 1 unit, the distance of movement is between 1 to 2 meters, and namely the precision of the 4th decimal is between 1 to 2 meters.Same through measuring and calculating, the precision of the 4th decimal is at about 100 meters, and the precision of the 2nd is at about 1000 meters.
And vehicle reports the time interval of location point to be 30s, according to the words that average speed 30km/h calculates, 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 radix point the 3rd, that is, if three is the same after the longitude of two location points and the radix point of latitude, then can think that these two location points to overlap or closely.If precision to be accurate to radix point the 4th, the standard then judged is probably at 1 meter to about 2 meters, such standard is too meticulous, substantially the automobile friend of similar route cannot be searched out, if and precision is accurate to radix point the 2nd, then the standard judged is probably at about 1000 meters, and such standard is too rough again, the automobile friend of the similar route searched out is too much, and the effect finally obtained is also poor.
After adjusting degree of accuracy, need to judge in all location points reported of the first vehicle successively, in the location point whether having the location point that exceedes predetermined ratio to report at the vehicle filtered out.
In specific operation process, the vehicle of initiating request can be designated as M0, and the vehicle searched can be designated as M1, M2 ..., MN.
The traffic route of M0 can be regarded as the location point set that it reported in week, 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 is accurate to radix point the 3rd.
Compare the location point set C0 of M0 and the location point set of other vehicles one by one now, first compare set C0 and C1, if have element (i.e. location point) more than 70% in C0 in C1, then judge that M1 is the automobile friend with M0 with similar traffic route, meanwhile, if the element not more than 70% in C1 is in C0, then judge that M0 is not the automobile friend with M1 with similar traffic route, namely this comparison is unidirectional, and M1 is the automobile friend of M0, and the automobile friend of M0 not necessarily M1.It is embodied in concrete traffic route, be most traffic routes (more than 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 compares, if having the element more than 70% in C0 in the set of comparing, then illustrates that corresponding vehicle is the automobile friend that M0 has similar traffic route.
Further, this method coupling can also find above-mentioned C0 and C1, C2, C3 further ..., the association that time of CN is corresponding consistent, finds in the similar period, the automobile friend of similar traffic route.Such as M0 and M1 had identical traffic route in one day, can think that M0 and M1 is the driving automobile friend in a day, but the travel time of M0 and M1 in one day may differ larger, so can also find being accurate in the moment further, such as, in one hour, the even automobile friend of synchronization.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 period filter request is sent, such as user requestedly can leach the automobile friend of working period 7:30 ~ 8:30 or next period 5:30 ~ 6:30, or filters according to the trip rule request of user any filtration period meeting user's request.
S202, period filtration is carried out to all location points reported of the first vehicle; The process that period filters is the filtration period will set according to user, the all location points that report not meeting this filtration period in first vehicle are filtered out, thus retain the location point meeting and filter the period, such as the filtration period of user's setting is 7:30 ~ 8:30, then only retain the location point of the first vehicle between 7:30 ~ 8:30, for the multilevel iudge step in S104 above.
S203, carry out period filtration to the location point that the vehicle filtered out reports, this step is identical with to all period filter processes of location point that reports of the first vehicle.After carrying out period filtration, count the length according to the filtration period and change in corresponding position, if the filtration period is shorter, then the location point of each vehicle reservation is by less, in order to ensure the accuracy finding automobile friend, so need the set sizes suitably increasing location point, namely the size of predetermined amount of time is increased, the size of predetermined amount of time can be set as two weeks, one month, two months etc., the corresponding relation that one is filtered period and predetermined amount of time specifically can be set, when user selects a certain filtration period, the size of predetermined amount of time is then found out according to described corresponding relation.
What deserves to be explained is, the screening process of above-mentioned similar period performed before step S104, can be the screening simultaneously performing the period together with inquiring about for the first time, also can at the enterprising row filter in the basis of subsequent query result.
After the automobile friend searching out 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 friend relation with other users in its sole discretion, if found potential automobile friend receives good friend's request, then found potential automobile friend and the car owner initiatively found are set up friend 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 with the automobile friend of similar traffic route, as shown in Figure 3, the multiple stage vehicle 100 (only illustrating one in figure) comprising server 200 and be connected with described server 200, described vehicle 100 comprises location point reporting module 110, and described server 200 comprises center point computing module 210, vehicle screening module 220 and automobile friend and searches module 230;
Described location point reporting module 110, for vehicle position point being reported to server every the schedule time, described location point is longitude and the latitude of vehicle;
Described center point computing module 210, for when the first vehicle in described vehicle to server send find there is the request of the automobile friend of similar traffic route time, calculate each chassis the longitude of location point reported in a predetermined amount of time and the arithmetical mean of latitude, using the center point of this arithmetical mean as corresponding vehicle;
Described vehicle screening module 220, when having the automobile friend of similar traffic route for finding when the first vehicle, filters out the vehicle being less than preset distance with the center point of described first vehicle from server;
Described automobile friend searches module 230, for the first vehicle and the longitude of location point of vehicle filtered out and the precision of latitude are accurate to predetermined figure, judge in all location points reported of the first vehicle successively, whether there is the location point exceeding predetermined ratio in the location point preset range that the vehicle filtered out reports, when being, then target vehicle qualified in the vehicle filtered out is set to the potential automobile friend of described first vehicle.
Further, described server 200 also comprises:
Location point comparison module, after receiving the location point that reports, judges that whether the location point that location point that same vehicle this time reports and last time upload is identical, when being, not preserving the location point this time reported, when no, preserving the location point this time reported.
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;
First vehicle period filter element 400, for carrying out period filtration to all location points reported of the first vehicle;
Screening vehicle period filter element 500, carries out period filtration for the location point reported the vehicle filtered out.
The description that the other technologies details with the system of the automobile friend of similar traffic route please refer to preceding method is found in this active, does not repeat them here.
In sum, the present invention is by calculating multiple stage vehicle every the location point that the schedule time reports, 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, thus accurately filter out the automobile friend with similar traffic route, because the present invention is a kind of process initiatively finding automobile friend, instead of passive wait is replied, so the efficiency that the present invention finds automobile friend is high, effect also significantly improves.
Should be understood that, application of the present invention is not limited to above-mentioned citing, for those of ordinary skills, can be improved according to the above description or convert, and all these improve and convert the protection domain that all should belong to claims of the present invention.