1

I want to show the current location of the user only on road(not beside of the road) while moving. I have used the LocationManager to get the current location. But sometimes I am getting the location beside the road, with this, the location point on map is showing beside the road. Actually, I have to show his location on Road(if he is beside the road) only. I searched lot for this but didn't get any idea.

Example: How I am getting the current locations on map.

 m 

A---n-------B

here,
A is start point
B is end point
n is on road(current location for sometime)
m is beside road(current location)

But I would need the m also should be on road.

Please help me on this..

6
  • Same here, but I'm using the fused provided location. Still, there has to be a way to stick the user on road, so the lat and long values are allways of a road... Commented Sep 9, 2013 at 14:52
  • @luiscvalmeida I dint get you, Could you please elaborate your answer? Commented Sep 11, 2013 at 13:23
  • im just saying that i have the exact same problem you have, and still didn't find way to get this working the way I want. I want to have lat and longitude values that are only on-road, so, I want to stick the user location on road and never off it. Commented Sep 12, 2013 at 21:14
  • @luiscvalmeida :( I didn't get any solution for this. I just left this in my project. Commented Sep 13, 2013 at 5:34
  • did you find any solution? Commented Sep 4, 2017 at 6:10

2 Answers 2

0

The google directions service will calculate from nearest road so calculate directions from current location to current location - returned starting location will be on a road.

But what if user genuinely is off-road in a shopping mall carpark for instance?

Sign up to request clarification or add additional context in comments.

1 Comment

I didn't get your first point exactly. for the second one,I have to show the location on road only, becoz I am implementing Turn by turn navigation using Google maps and Direction API.
0

For that you need to use road API which will give you the path upon the road otherwise you will not get the accurate path.

Snap to Roads

The Google Maps Roads API takes up to 100 GPS points collected along a route, and returns a similar set of data, with the points snapped to the most likely roads the vehicle was traveling along. Optionally, you can request that the points be interpolated, resulting in a path that smoothly follows the geometry of the road.

Check Details Here

You need to call like this

https://roads.googleapis.com/v1/snapToRoads?path=-35.27801,149.12958|-35.28032,149.12907|-35.28099,149.12929|-35.28144,149.12984|-35.28194,149.13003|-35.28282,149.12956|-35.28302,149.12881|-35.28473,149.12836&interpolate=true&key=YOUR_API_KEY

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.