Dammyololade / flutter_polyline_points

A flutter plugin that's decodes encoded google poly line string into list of geo-coordinates suitable for showing route/polyline on maps
MIT License
105 stars 130 forks source link

Directions API issue #67

Closed shabeenabarde closed 1 year ago

shabeenabarde commented 2 years ago

I have a map where by it shows the rider and drivers location and I use this package to show the poly lines between them. I call my own custom apis after every 3 seconds to update the rider and driver locations and this way it updates the polyline and increases or decreases the polyline accordingly. is there a cheaper way to use the directions API because After every 3 seconds, a direction API is requested which is costing me. Is there a way I can show the polyline between these two locations without calling the directions api all the time to update the polyline?

Daeon97 commented 2 years ago

I have a map where by it shows the rider and drivers location and I use this package to show the poly lines between them. I call my own custom apis after every 3 seconds to update the rider and driver locations and this way it updates the polyline and increases or decreases the polyline accordingly. is there a cheaper way to use the directions API because After every 3 seconds, a direction API is requested which is costing me. Is there a way I can show the polyline between these two locations without calling the directions api all the time to update the polyline?

This issue has nothing to do this package, but with your implementation. Nevertheless, your current implementation is actually quite expensive. You should simply take the initial/starting position of the rider and the driver and draw a polyline between these locations. You don't necessarily need to redraw polyline whenever location changes, instead, show the current 'step' based on the drivers location as gotten from the Google directions API. The current 'step' helps the driver make informed decisions based on the already estimated 'route' at that particular point in time. I advice you check out Google Directions API