I am developing an app for local bus system and as per requirement, a bus can have multiple routes from one location to other. So i have to implement methodology like
fetch user's current location
get destination from user and accordingly show user all possible routes to destination
show all paths on map simulataneously with optimal shortest path highlighted with different color.
currently, I have progressed to basic application having functionality
get user's current location and pin point it with marker on google map
getting single path to destination (using google maps api)
plotting it on map by polyline. I have used one tutorial that implements navigation from source to destination.
Now I have to find all possible routes from source to destination. searched for answer but most answers referred to apply single path which I have already done. Any help will be much more appreciated.. Thanks in advance...
Use Google Directions API with parameter 'alternatives=true'.
Related
I want to Develop a project where it will work with custom map. I have a image in SVG format which is a campus image. I want to get the user current location and show the path of user selected location.
I can't understand where to start. How it worked. I know how to work with Google Map.
Very less tutorials are available in web. So I am unable to get sufficient help from Google.
Thanks in advance.
You cannot get user location using .svg image. Vector images can be use as a map marker, icon, symbol or image to a polyline.
If you want to get current location, use FusedLocationProviderApi. FusedLocationProviderApi provides improved location finding and power usage and is used by the "My Location" blue dot.
To show path selected location, use Google Maps Android API to expose intents that you can to launch Google Maps in display. It allows you to display map in a specified location and zoom level, show directions, search for a location and display them on a map. Directions can be returned in driving, walking or bicycling.
Here's a sample demo app which discuss how to get current location and show direction to selected location: https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/MyLocationDemoActivity.java
Start your poject by following steps listed in Official Google Documentation for Maps Android API. Here is the link : https://developers.google.com/maps/documentation/android-api/start#step_3_create_a_google_maps_project
I'm new to Open Street Map. I want to get the way points between source location and destination location using OSM in android. Is there any API in OSM to get the way points? I don't want to show the map on screen. Only need way points.
Someone please suggest any sort of solution or code for that.
Just choose one of the many online routers for OSM, for example GraphHopper or OSRM.
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 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.
I have a project on Google map based application. it is similar to Maps application provided by Google. i selected this project because Google do not provide enough information, route and other facilities that are available for other countries.
So my project objective is
current location
shortest path with path highlighted
showing places
information about places.
These are the main objective and I have obtained map and current location. So I need help on other objective.
And as I learned many thing by searching and from other source. shortest path is mathematical. polyline is available in Google map for highlight and I referred
How to draw road directions between two geocodes in android google map v2?
but was not helpful for me. I am using sq-lite for database.
You may think this is as not specific question and this is my first question and trying to fit in stackoverflow pattern.