perliedman / leaflet-realtime

Put realtime data on a Leaflet map
ISC License
743 stars 167 forks source link

Rotate Markers #179

Open nolatron opened 3 years ago

nolatron commented 3 years ago

Anyone able to get the Rotated Marker plugin to work with the Realtime Plugin? Its working my static map but trying to see if the realtime map will do use it as well for a flight sim tracker.

Here's my current code:

function createRealtimeLayer(url, container) {
    return L.realtime(url, {
        interval: 30 * 1000,
        getFeatureId: function(f) {
            return f.properties.pilot_num;
        },
        cache: true,
        container: container,
        onEachFeature (f,l) {
            l.setZIndexOffset(200);
            l.setIcon(IconPlayer);            
        }
    });
}

I tried l.setIcon(IconPlayer, rotationAngle:45);

and l.setIcon({IconPlayer, rotationAngle:45});

even tried adding l.rotationAngle(45);

but none worked.

CarlosSprekelsen commented 5 months ago

It works for me, try l.setRotationAngle(rotationangle);