You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to leafl...@googlegroups.com
The example Bryan provided changes the style of the cluster marker and not the style of the default blue pin marker. This tutorial on the leaflet page (http://leafletjs.com/examples/custom-icons.html) explains how to create and use a custom marker. I guess what MB HH wants to know (and I do too) is how to use a custom icon on individual points within the marker cluster plugin.
Is it possible to define a new icon (using a PNG image) and then apply that new icon to the Marker Cluster Group or the GeoJSON features?
Ross McDonald
unread,
Dec 7, 2012, 7:29:42 AM12/7/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to leafl...@googlegroups.com
Just answered my own question and, hopefully, MB HH's:
// define the new icon var lightIcon = L.icon({ iconUrl: 'images/streetlight14x14.png', iconSize: [14, 14], popupAnchor: [17, 7] });
//define the marker cluster var markers = new L.MarkerClusterGroup();
//define the new layer (geojson in this case) and apply a style to the pointToLayer var geoJsonLayer = L.geoJson(stlight, { pointToLayer: function (feature, latlng) { return L.marker(latlng, {icon: lightIcon}) }, onEachFeature: function (feature, layer) { layer.bindLabel(feature.properties.LOC); } });
markers.addLayer(geoJsonLayer);
map.addLayer(markers);
map.fitBounds(markers.getBounds());
MB HH
unread,
Jan 6, 2013, 7:39:33 AM1/6/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to leafl...@googlegroups.com
Am Freitag, 7. Dezember 2012 13:29:42 UTC+1 schrieb Ross McDonald:
Just answered my own question and, hopefully, MB HH's: