Hi i have turn by turn navigation app using osm map.
I can show the road path from source to destination but how can i check the current position(GPS) is within the road or away while traveling in a car.
this is the link i am using to get road path
OSRMRoadManager.getRoad:http://router.project-osrm.org/viaroute?&loc=19.112745999999998,73.00902099999999&loc=18.651449,73.344726&instructions=true&alt=false.
Edit:
I need to alert the user if he get diverted from the selected rout.
Related
I'm working on an Android App which draws path on map using Polyline options, between source to destination.
This works fine.
What I need is, if user starts from source, and instead of taking drawn route towards destination, the user takes another route, the path on map should be redrawn for user's current path.
I'm using Directions API for drawing path.
I think, I'm required to use Google Navigation API. How can use that within my app, without having to navigate to Google Maps app?
First: Check if your current/last known location is near or falls on the path/route created.
Direction api: check if a place falls in the route path between 2 places
Second: If current/ last known location if outside or off the path/route created, send a request to get direction from the current location to the same destination.
OR
Try this
Turn by Turn navigation
I obtained driving directions to a destination in my Android app. Now as the user progresses towards the destination on this route, I want to hide the portion of the route already covered and update the remaining distance. Also, if the users strays from the route that is currently being displayed, I want to recalculate the driving directions to the destination from the user's new location.
Can anyone suggest how I should approach this? Should I keep searching for user's location coordinates in the calculated route or is there a better way of doing this?
I'm curious if there is a way to draw the path from a devices current location to a user entered location.From researching the only methods I have come across are to get path from lat and long coordinates like this solution http://blog-emildesign.rhcloud.com/?p=822 ,
My question is if there is a way to combine a users geo location and a user entered destination string to draw the path.I'm guessing this would involve reverse geo coding or am I wrong?
The current interface looks like this and I'm using Google maps API v2:
Look here for how to do a polyline in android map api v2 https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polyline
Tip save your line as a kml file for interoperability so other apps will be able to import the file and show the same line on a map.
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..
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?
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
My app is totally based on maps. The requirement is user need to enter the source and destination in words then i need to draw the route on map with those values with markers. Later on the displayed map with route drawn, the user able to change/modify the source or destination by dragging the marker which are displayed. Simultaneously the route drawn should also change dynamically with user's action.
I can get the lat & long from the map using onTouchEvent. But in the same map not able to set both source and destination.
And i tried reverse geocoding to get the lat & lon from given location names. But i get IOException:Service not Available. I was searching for solution, then i found this link which started in jun 2010, still no fix for this bug till now.
Please help.Also provide sample code.
Thanks.