ewoken / Leaflet.MovingMarker

A Leaflet plug-in to create moving marker
MIT License
342 stars 177 forks source link

How do I replace the marker points with other images #23

Open CodeDome opened 7 years ago

CodeDome commented 7 years ago

How do I replace the marker points with other images

EmiyaGm commented 7 years ago

use Leaflet-SVGIcon

zjffun commented 5 years ago

Markers With Custom Icons - Leaflet - a JavaScript library for interactive maps

demo

var greenIcon = L.icon({
  iconUrl: "leaf-green.png",
  shadowUrl: "leaf-shadow.png",

  iconSize: [38, 95], // size of the icon
  shadowSize: [50, 64], // size of the shadow
  iconAnchor: [22, 94], // point of the icon which will correspond to marker's location
  shadowAnchor: [4, 62], // the same for the shadow
  popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
});

var myMovingMarker = L.Marker.movingMarker(
  [[48.8567, 2.3508], [50.45, 30.523333]],
  [20000],
  { icon: icon }
).addTo(map);

myMovingMarker.start();