React Native; How we can Monitor The google map Tracking So Actually User drive on line or not, E.g.
if i got the direction from Location A to Location B , So how we can check that User Drive on Line or not.
Basically i can't Monitor it,
E.g
Actually i want it in react native, So anyOne Help me How we can achieve it or any 3rd party Library, Thanks in Advance.
This Method isPointNearLine is Solve my problem.
Code Snippet.
import * as geolib from 'geolib';
const returnObj=(latitude,longitude)=>{
return {latitude, longitude}
}
const IsLies = geolib.isPointNearLine(
returnObj(25.976424, -80.238400), ////point
returnObj(25.97641, -80.24045), ////start
returnObj(25.97647,-80.23818), ///end
20 ////distance in meter
);
it will return true and false.
There is another approach is we can user @turf/boolean-point-on-line
Code Snippet
var pt = turf.point([74.276089,31.478847]); //// NearPoint
///Note [[Start Point],[NearPoint],[EndPoint]]
var line = turf.lineString([[74.277908,31.479470],[74.276089,31.478847],[74.274402,31.478452]]);
var isPointOnLine = turf.booleanPointOnLine(pt, line);
it will also return True and false if Points lies on line.