It is not possible for L.circleMarker to load an icon directly.
I have been in similar situation and used a bit of hack combining L.circle and L.marker. I need to specify radius in meters didn't know how to convert it to pixels.
L.circleMarker allows to specify Radius of the circle marker, in pixels.
L.circle allows to specify Radius of the circle, in meters.
var map = L.map("map");
L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png").addTo(map);
map.setView([48.85, 2.35], 8);
var myRenderer = L.canvas({ padding: 0.5 });
for (var i = 0; i < 100; i += 1) { // 100 points getRandomLatLng();
var ltln = getRandomLatLng();
L.circle(ltln, 5000,{
renderer: myRenderer
}).addTo(map).bindPopup('marker ' + i);
L.marker(ltln).addTo(map).bindPopup('ICON ' + i);
}
function getRandomLatLng() {
return [
-90 + 180 * Math.random(),
-180 + 360 * Math.random()
];
}
You can use customIcon with L.marker.
In my usecase, number of markers was low and hence no such performance degradation. L.marker has poorer performance for large number of points as compared to canvas based L.circle