Using a real-time tile layer in the markercluster group

I am using Leaflet in combination with realtime and markercluster to show markers that are updated in real time on the map. The plugins work fine independently of each other, but the problem occurs when I want to group a layer in real time using the markercluster functions.

Sample code for a live layer in which I convert json to markers, assign a custom icon and apply some onEachFeature:

realtimeLayer = L.realtime({
    url: 'someURL',
    crossOrigin: true,
    type: 'json'
}, {
    interval: 3 * 1000,
    onEachFeature: onEachFeature,
    pointToLayer: function(feature, latlng) {
        return L.marker(latlng, {
            icon: customIcon
        });
    }
});

      

What I can do with non-realtime markers levels is create a markercluster group and add a layer to it, so the markers are clustered like this:

var clusterGroup = L.markerClusterGroup();
clusterGroup.addLayer(someLayer);

      

However, when I add the realtimeLayer to the cluster group, no clustering is applied, or the marker is not loaded at all. What am I missing? Thank!

+3
javascript leaflet markerclusterer leaflet.markercluster


source to share


No one has answered this question yet

Check out similar questions:

3
Flyer with marker booklet in angular 2
3
Multilayer cluster with marker cluster
1
Bullet cluster booklet: dynamically change icon
1
Leaflet SuperCluster markers with custom icons?
0
hide clustered overlays from map on page load
0
Print edition. Search controls and custom icons
0
Tilemap: Cluster marker shows / hides markers under layers
0
create custom booklet markercluster svg icon
0
Leaflet markercluster: How can I change the borders of a markercluster?
-1
Ajax clustering flyer



All Articles
Loading...
X
Show
Funny
Dev
Pics