Google Maps directions text - android

I am making an Android app that provides directions from the current location. I want to know if there is any way to obtain the directions as text from the Google Maps. I do not need to display the map or draw a polyline. Only the directions have to be displayed as text. For example:
1. Turn left at XYZ street.
2. Go straight for 500 metres.
etc. etc.
I know that it is possible to use JSON and obtain the information required to display the directions on a map. However, this does not provide word directions. Can Google Maps API v2 be used for this? If not, how can the directions be obtained as text?
Thanks in advance!

I've finally figured out a way to do this.
The url http://maps.googleapis.com/maps/api/directions/json returns the direction information in the JSON format. One of the key-value pairs has the key "html_instructions". The value for this can be retrieved and used for the directions as text.

Related

Style an entire road using Google Maps API

I am developing an app which given a postal code will return map of the area with all the roads in the 100m radius highlighted either green red or yellow based on our machine learning algorithm. My task is 2-folded
Gather all the roads in 100m radius given Postal code
Highlight those roads using different colours
Our solution to the very first problem is quite inefficient atm, we are trying to convert the postal code to LatLng and then calculate boundary boxes with LatLng +/- 100m and extract street names. This sadly uses so much bandwidth AND API calls that we must look for a new solution. Is there anything we could use instead?
As of highlighting those roads that are another problem, as I have encountered problems where the application needs to highlight specific route, which was solved using polylines based off points google maps API returned. In this case, though, no points are returned as of now.
I know that those are 2 question but they are so closely related to each other (as the output of 1st problem will be used in the drawing lines) that I've decided to ask them together.
Really appreciate your help!
In case people are wondering how to solve similar question here's how we solved it:
Our current solution is sending the initial Postal Code and radius to OpenStreetMap API called overpass (http://wiki.openstreetmap.org/wiki/Overpass_API) which returns streets within given bounding box (which is calculated using postal code longitude and latitude) as a WAY (set of points in JSON format). The returned WAY can be easily visualised using polylines included in the google maps API.
Hope that helps!

Getting data from drawed road using Google Map Android API V2

I'm about to learn more on how to draw route between two points using Google Directions in Google Map Android API V2. My question is can i get informations about the drawed road like witch streets are passed by this road .Or can i get this information without drawing the route ? can i get it with the two points only(start- end).
thanks.
something like this is that you need?
https://developers.google.com/maps/documentation/javascript/examples/directions-travel-modes?hl=es-419
after #honeyyy comment I suggest this link
https://developers.google.com/maps/documentation/javascript/examples/directions-complex?hl=es-419
that get all checkpoint in the middle of two points an get information about them

Google Places API Android find places via LatLng

I am trying to use the Google Places API on Android to find Universities on a map based on where you click.
So ideally I could feed the Places API a coordinate and it could tell me the Universities around this coordinate. The PlaceDetectionAPI only has .getCurrentPlace and I don't just want where the user is currently.
Any help will be greatly appreciated!
Thank you
You can use the Autocomplete API with "University" as a starting string to obtain nearby places that match that query.
Although that's not really the best solution, so you may want to get your own database of university coordinates and match them to your user's location.

Google Map v2 Get Direction Android

Can i get direction between 2 points with using Google Maps v2 in my Android application ?
I found Polyline but i don't want to draw a line between 2 points.
I found a solution which is using Intent. It can solve this problem but it is not useful because this solution is starting another map application and I want to show direction in my application. Can i do this ?
You cannot get directions using just the Google Maps V2 api. You should use the Google Directions API direction request call. This will return the raw direction data in json which would allow you to draw a Polyline for the directions on the map or show the data in any format you would like.
There isn't any method to do it because it envolves several computing that must be done in Google Maps servers (and they don't allow you to do so many without paying if you hold a business).
So, the only way is making a petition to google maps servers as they describe in the Google Maps Api documentation that #Bobbake4 linked. Then, you'll receive several coordinates that you'll use to draw a polyline which represents your route.
Hopefully, someone has already coded everything and shared gently with us here https://stackoverflow.com/a/15643705/1516973
That's absolutely the best answer covering Android Google Maps routing that I've found in Stack Overflow, so thanks to #Akexorcist and #emil-adz for it.

Is it possible to get the route network from Android Google Map?

I am trying to find a way to get the map of the road network currently visible on the the screen, while using the Google Maps API v2 for Android. I want to place some markers along roads, but I don't know if that is even possible? I can get the addresses, or the path between two addresses(using the route manager), but I need to know if I can paths of...all the roads visible?
That want you want, is to get the route as vectors (as poly line of latitude, longitude) coordinates.
But, No you can't. (although there is an inofficial Google API that gest the route as coded and compressed vector, but the usage is not legal.)
The vectors are "owned" by TeleAtlas/TomTom and they are not public availble, nor has Google the right to give them out.
If you need vectors, then you have to use OpenStreetMap routing Service, which potentzally provides vectors of a route (via an OpenStreetmap API)

Categories

Resources