I have used Google geo address and using lat/long have got the address. How do I determine if I am on road on not? Basically hit-test for road? I am currently using location man
See fiddle.
It can be done so much easier with OSRM (nearest) webservice. Make a GET request like:
const url = '//router.project-osrm.org/nearest/v1/driving/';
fetch(url + coord.lon + ',' + coord.lat).then(function(response) {
return response.json();
}).then(function(json) {
if (json.code === 'Ok') {
console.info(json.waypoints[0].location);
}
});
Which is a road/street coordinate.
References — Project-OSRM