Just change
var smallIcon = L.Icon({
options: {
iconSize: [27, 27],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: 'icone/chapel-2.png'
}
});
to
var smallIcon = new L.Icon({
iconSize: [27, 27],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: 'icone/chapel-2.png'
});
or
var smallIcon = L.icon({
iconSize: [27, 27],
iconAnchor: [13, 27],
popupAnchor: [1, -24],
iconUrl: 'icone/chapel-2.png'
});
See the icon official documentation and this tutorial.
You do not use new
for L.Icon (It's supposed to not be required but without it, we encountered an issue...)
See a demo reusing your sample.
Your syntax should be working when extending L.Icon
class.
Best Answer
When
Leaflet.markercluster
plugin is added to framework template http://fulcrumapp.github.io/geojson-dashboard/, it doesn't work because this example uses old version of Leaflet (0.7).If newer version (1.4.0) of Leaflet is used, original code has to be modified at two places to make it work as it is (without marker clusters):
To add marker clusters,
L.geoJson
layerfeatureLayer
is renamed tofeatureLayerUngrouped
and used only for creating markers and adding them to newly createdL.markerClusterGroup
layer namedfeatureLayer
. This is the changed part of the code:EDIT: Function
applyFilter()
also has to be modified:With this cluster markers are working.
It's interesting that it doesn't work with latest version of Leaflet (1.5.1). I didn't investigate furter to find the reason.