Android Google Maps API

Asked

Viewed 207 times

1

There is the possibility to plot route in the Google Maps with information on traffic, accidents and average time of arrival at destination? Or any lib of the type making such a request?

  • I will vote to close because you asked several questions in one, there is yes solution to everything you asked, but the answer would be very big and very complex, gives a read in the documentation and as it arises specific doubts will post there I will explain if I know ok. https://developers.google.com/maps/documentation/javascript/

1 answer

0

To achieve this you will need to use the Google maps Directions API.

As the question involves many things I recommend you to take a look at the API documentation, which is in Portuguese.

https://developers.google.com/maps/documentation/directions/? hl=en

There you will find what you need. Basically you will make a request using the origin and the destination, and you will receive a JSON with various information, including the time to reach your destination and the reference points. To display the route you will need to create a Polyline on your map with the reference points returned in JSON.

To display traffic information visually on the map (the street appears red in case of traffic jam for example) you do not need to use the Directions API, just use the function Googlemap.setTrafficEnabled(true) on its map.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.