Draw route above the street on the map

6

I have a feature that captures gps positions every 10 seconds.

Every 30 seconds or if there is a 20-degree change in bearing (I compare the last position with the current one) I store to send to the service.

After, the user can view the route!

I draw the route through a Polyline , and as the capture time of the positions is medium (thinking about the battery consumption) it looks like this:

Is there any way to smooth the route design?

Or how can you draw Polyline on the street?

Thank you in advance!

    
asked by anonymous 01.09.2016 / 15:02

1 answer

2

To create a simple app that finds routes between two places based on the address in Google Map, you can use Google Map Direction API .

  

The Google Maps Directions API is a service that calculates routes between   using an HTTP request.

A Google Maps Directions API request has the following format:

https://maps.googleapis.com/maps/api/directions/output?parameters

where output can be one of the following values:

  • json (recommended) indicates output in JavaScript Object Notation (JSON)
  • xml indicates output as XML

To access the Google Maps Directions API over HTTP, use:

http://maps.googleapis.com/maps/api/directions/output?parameters

In Github you have a project where you can start your application: GoogleMapDirectionSimple Create a simple app that find a path between two places .

Screenshots

Update

Googlehasmadeachangeinthepoliciesregardingthetermsofuse.NowinordertouseyourMapsAPIservices,youneedtoenterthekeyintheURL.See get a key / authentication .

For example, if you want to leave Sao Paulo and go to Curitiba, you should do this:

https://maps.googleapis.com/maps/api/directions/json?origin=Sao+Paulo&destination=Curitiba&&key=YOUR_API_KEY

See Getting Started for the use of the service.

Details

01.09.2016 / 16:31