Show a moving marker on the map

后端 未结 3 2016
星月不相逢
星月不相逢 2020-12-28 11:24

I am trying to make a marker move(not disappear and appear again) on the map as a vehicle moves on the road.

I have two values of latLng and I want

3条回答
  •  渐次进展
    2020-12-28 11:59

    You can use marker-animate-unobtrusive library to make markers smoothly transition from one location to another (instead of reappearing).

    You could initialize your marker like that:

    var marker = new SlidingMarker({
       //your original marker options
    });
    

    Just call marker.setPosition() each time new vehicle's coordinate arrive.

    P.S. I'm the author of the library.

提交回复
热议问题