I want to draw route between two points. I did this successfully. But how to know if the user deviated from drawn path or not. So that I can suggest user to notify alternative path to reach their destination. Like what google map navigation did. Am working on it and till now I could't find any answer for this. Please suggest some approach to me to find deviation from selected route.
Thanks in advance.
Use PolyUtil.isLocationOnPath(...) from Google Maps Android API utility library.
Related
I'm working on google maps and I need to draw the shortest path to navigate and visit all markers selected by the user.
I make my algorithm to solve that but the solution takes a long time and many codding, I need to know If there is any API or method to solve that quickly.
If you are already using Google API, maybe consider using Google Directions API.
You can provide it with a start and end locations and up to 20+ locations and the API will calculate the best route.
You can find more info here.
Hope this helps.
I want to create a custom map for my app.
the things i want are:
it will be a custom map designed by us for a event location(not google map).
all the locations will be displayed on the map like google markers.
just like google map i want users to select a location and get direction from his/her current location to selected destination within that area(my main concern).
Are there any possible solutions to this? Any links, suggestions to start with please let me know.
This is very imp. for me..thank you.
I suggest you look at the OpenStreetMap project. They have all the components you need but it is not going to be a simple task for an area of any size
I am a student working on an android application related to navigation trying to learn android programming. The application needs to search the geo-locations (latitude,longitude) among the ones available and find out which ones fall along the route the user is travelling.
For example, if the user is travelling from 37.422,-122.084058 to 37.422,-122.084058, then I should be able to search the points that fall along this route from the set of points that I have. How do I do that?
I am getting the route direction of the user from the google api
https://maps.googleapis.com/maps/api/directions/json?origin=Googleplex&destination=infinityloop=&key=your_api_key
I get the route in the form of legs and I have a set of geo-locations. I would like to find which geo-locations fall along the route of the user. Is there any way I can find it or any API that I can use ?
Any help is greatly appreciated. Thanks in advance :)
There's already a lib for this: use isLocationOnPath with the polyline you are getting from directions api response.
Build a LatLngBound using the two points and pass in the geolocation point you want to check into LatLngBounds.contain().
I already searched on StackOverflow and Google. But i didn't find a real answer. I think there is just no DirectionsRenderer in the Android API. But can you acknowledge this?
If there is not DirectionsRenderer, how could i use the Android API to show a GoogleMaps and draw a Route on the Map?
I want to draw a nice route. Not just lines between the coordinates of each route-section which are also delivered from the Directions-Request.
I think there is just no DirectionsRenderer in the Android API. But can you acknowledge this?
There is no DirectionsRenderer in Maps V2. You can tell this by reading the documentation.
how could i use the Android API to show a GoogleMaps and draw a Route on the Map?
There is nothing in Maps V2 to support this.
I want to draw a nice route. Not just lines between the coordinates of each route-section which are also delivered from the Directions-Request.
You will need to find some Web service that will serve up coordinate information for the route with sufficient granularity (e.g., every 10m) to give you your "nice route", then use a Polyline or something like that for actually rendering the route.
SO i found out that it is possible to just take the legs, then the steps and within the steps you will find the "points".. when you decode the points string its a very detailed list of all coordinates.
with this coordinates, you can easily draw a nice route on the map.
so it's possible without the need of a additional Web-API.
This time, i want to display the route between two locations on mapview. I've used googlemapApi for achieving direction. Fortunately I am able to display the route with blue color over the map.
The only difficulty is to set the correct zoom level So that i could display complete route in the startup of the map loading on the visible screen-portion.
I was wondering for this solution around the stack overflow But i got confused after reading through several number of answer. Finally i decided to post a question.
Can anybody tell me what is the most convenient method to resolve this issue.
Any help would be highly appreciated.
I don't know of its the same, but for the Google static maps api, if you provide it with a route and don't give it a zoom level, then it will do exactly what you want automatically.
Have you tried this?