I have been trying to figure out driving directions using user input and it looks like that functionality has been removed from the google maps API. Is this corrects? I have been searching and have not been able to find any documentation on how to get directions using user input. Does anyone know of any tutorials or documentation on this?
The official documentation contains everything you need:
make a request to retrieve the coordinates related to the user-input: Geocoder.geocode()
Fetch the latlng out of the GeocoderResult
Request the route by using DirectionsService.route() and the given start/endpoint
set the route by using DirectionsRenderer.setDirections()
Related
I am trying to use google maps directions API with continuous hitting to the API and updating the directions by getting a current location on location changed listener and it works perfectly.
But Instead of hitting multiple times I need to get directions API for the single instance and write an algorithm by getting the directions using segments start point and update on google map, Find a way to know the user is traveling in the wrong distance and re-route map by calling API.I tried these ways and working but there are a lot of cases to be handled for these scenarios.
I don't understand what to follow and why this is required is, we have a display cycle and the user starts the navigation and directions should be shown on cycle hardware display via BLE.
Please help me solving this issue.
You can try using the Google Maps Util Library. The PolyUtils class has methods to check if a LatLng lies on a polygon/polyline.
Maybe try using the method isLocationOnPath. And if it's outside the polyline, make the request to directions API and re-plot the route.
Docs: http://googlemaps.github.io/android-maps-utils/javadoc/
I am working an Android App that displays bus route information when users inputs a route number.Is there any way i can fetch this information using google map's API??
As #VolAnd said, this question is very wide.
I found something that might help you if i understood you question correctly.
When user inputs a bus route number, you want to fetch route details( bus stops and timings).
Well for this you can use http://www.mybmtc.com/ search api.
You can check this link to know how to use it, but its in Python language.
... i can fetch this information using google map's API?? ....
If you want to search bus routes and show it on google map, then you can use google maps api's Direction service documentation. You need to specify travelMode as TRANSIT and TransitMode as BUS. You can specify all in between stops as waypoint[] in TransitOptions
So a quick answer,
Get and validate route number provided by user using mybmtc.com search.
That will give you details of all the stops on that route.
Use google maps Direction service to locate routes between origin and destination of that route.
You have to work hard for this.
Let me know if anything is missing.
i'm getting latitude and longitude of a location, I want to know the roads connecting to that location and whether it is land or water
I tried one google map api which is not helping to get the information i want.
http://maps.google.com/maps/api/geocode/json?latlng=40.7127,74.0059&sensor=true
Another SO answer pointed out two possible workarounds:
You can use Google Maps Reverse Geocoding . In result set you can determine whether it is water by checking types. In waters case the type is natural_feature. See more at this link http://code.google.com/apis/maps/documentation/geocoding/#Types.
You can detect waters/lands by pixels, by using Google Static Maps. But for this purpose you need to create http service.
You can use the Google Maps Geocoding API which does exactly that: http://code.google.com/intl/da-DK/apis/maps/documentation/geocoding Take a look at the "Reverse Geocoding" section
In javascript, using Google maps apis we specify options such as google.maps.TravelMode.DRIVING. Do we have any equivalent for TravelMode in android? I couldn't see anything in android.location.LocationManager or android.location.Criteria
I've thought of following options:
Using some TravelMode alternative, get coordinates approximated to nearest street/road.
Alternatively, (Not preferred as it will be slow) get the coordinates normally and then probably send it to some google api(This will be pretty slow as there are many points) and get the coordinates corrected to the nearest street coordinates. Or in case if there exists some (google-maps) javascript framework, it may be used to get corresponding street coordinates.
Edit1:
I've also looked into this. and hence into android.location.Geocoder. The getFromLocation in this class seems to do most of the work. However, I'm afraid, of an additional delay while acquiring the nearest address.
If you are referring to Directions Service, then it uses Google Directions API internally as stated in the overview:
This object communicates with the Google Maps API Directions Service which receives direction requests and returns computed results.
As there is no native API for Android yet, I suggest using Directions API directly.
See my answer here.
I am developing a application based on location based services.I need to find the nearest locations like Restaurants,Hospitals,Companies. I find we can use google map api services.
I tried to find the way using this service provide by google
https://developers.google.com/maps/documentation/webservices/
But i did not get any result please suggest me how can we get the nearest location details.
Provide me is there any samples.
Thanks in advance.
use this as as URL:
http://maps.google.co.in/maps?q=hospitals+near+<<coordiantes>>
coordinates = 12.545454,78.434304 (just an example).
you will get the coordinates through your location service.