1

Can someone help me with this idea ?

I need to refresh array of locations (markers on map) and polyline represent a route between exact markers. I am doing it now with clear and draw new items, but it flickering markers and polyline.

Polyline refresh without flickering, i was searched in v3 google maps api with setPoints. Problem is, how refresh marker locations and count too without clearing map. Array of locations (markers) may be during refreshs in different counts.

Gopal Singh Sirvi
  • 4,539
  • 5
  • 33
  • 55
Tomino
  • 113
  • 2
  • 14

1 Answers1

2

I'm not sure I got the question, but if you want to move a marker and/or a polyline,you don't need to remove (clear) and draw again. There are convenience menthods for doing that, for markers:

marker.setPosition(LatLng)

and for Polyline you just update points: polyline.setPoints(List)

then your objects are moved and redrawn with no flickering (or the lowest possible).

N Dorigatti
  • 3,482
  • 2
  • 22
  • 33
  • polyline.setpoint will add one more point after destination. what if i want to update polyline within our route and destination will be same? how to update polyline within route in case drives takes different route to reach destination? – Jeyachandran Feb 21 '18 at 11:24
  • @Jeyachandran use setPoints and give the complete route – N Dorigatti Feb 21 '18 at 13:10
  • but I dont want to redraw polyline again as it will be a bad user experience. On every location update its not a good idea to redraw polylines. How will I know when I have to redraw polylines which will happen very less frequently not everytime? – Jeyachandran Feb 22 '18 at 10:48