S
S
sdgroup142018-07-30 12:58:51
JavaScript
sdgroup14, 2018-07-30 12:58:51

How to add an icon to a marker vector in a leaflet?

as when changing the layer in canvas , add svg or png to the marker or a class with backgroundImage. In general, any of the methods will do. And nothing works. Already tried everything possible. Do not offer DivIcon. I have more than 50k markers, and clustering can not be used. so just canvas.

const markerOptions = {
      radius: 14,
      fillColor: '#016699',
      color: '#fbfbfb',
      weight: 1,
      opacity: 1,
      fillOpacity: 1,
      width: 28,
      height: 28,
      className: 'wayEvent-marker',
      renderer: L.canvas(),
      preferCanvas: true
    };

 events.map(_event => {
     L.circleMarker([_event.coordinates.lat, _event.coordinates.lon], markerOptions)
})

there is still a less priority task - why is it not removed from the markup when I clean the layer or delete it from the map ... Everything that is in the canvas is cleaned and the canvas itself is duplicated when the function is called again ... As I understand it, since this is an experimental property, then it so lag and works? (Z.Y. I write in Angular 2+)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question