乐趣区

关于vue.js:vue使用leafletanimatedmarker实现轨迹回放功能

一、装置依赖
npm i -save leaflet.animatedmarker

二、在页面引入
import ‘leaflet.animatedmarker/src/AnimatedMarker’;

var latlngs=[[113.3296179,23.1056464],[113.3441455,23.1029357],[111.37807769946298,23.469783629934806],[115.31021330053697,22.7360877700652]];

   
  let car = require(`../../assets/img/car.png`);
    var carIcon = L.icon({
        iconUrl: car,
        iconSize: [24, 24],
        iconAnchor: [12, 20],
        popupAnchor: [0, 0]
    });

    animatedMarker = L.animatedMarker(latlngs, {
        icon: carIcon,
        interval: 2000, 
    }).addTo(this.map)
退出移动版