I'm new to Leaflet JS. I'm trying to figure out a way to change the default style for a L.Geojson marker used in Leaflet Realtime plugin. I don't know what property to change so that I can change the style of the markers.
Here is my code so far:
var map = L.map('map', {center: [46.4337, 23.4532], zoom: 8}),
realtime = L.realtime({
url: 'get_points.php',
crossOrigin: true,
type: 'json'
}, {
interval: 500
}).addTo(map);
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
map.addLayer(osm);
function update(e) {
realtime.update(JSON.parse(e.data));
}
function remove(e) {
realtime.remove(JSON.parse(e.data));
}
realtime.on('update', function(e) {
popupContent = function(fId) {
var feature = e.features[fId],
my_number = feature.properties.number;
mystatus = feature.properties.mystatus;
return ('My number is: '+ my_number + '<br />' + 'Status: ' + mystatus) ;
},
bindFeaturePopup = function(fId) {
realtime.getLayer(fId).bindPopup(popupContent(fId));
},
updateFeaturePopup = function(fId) {
realtime.getLayer(fId).getPopup().setContent(popupContent(fId));
};
Object.keys(e.enter).forEach(bindFeaturePopup);
Object.keys(e.update).forEach(updateFeaturePopup);
});
I've tried setting a pointToLayer function with a custom icon marker but that didn't work.
Thanks.