leaflet-realtime
leaflet-realtime copied to clipboard
bindtoolup issue
Hi, I wanted to insert "value" numbers in a Geojson into leaftlet realtime geographical point rather than marker icon. I used the bindtoolup in leaflet and it compiled without any error, but when I tested it in the realtime leafet, I encountered to the following problem. this is my code:
var map = L.map('map'),
realtime = L.realtime({
url: '/frostbite/Main.geojson',
crossOrigin: true,
type: 'json'
}, {
interval: 3 * 1000,
getFeatureId: function(feature) { return feature.properties.mmsi; },
pointToLayer: function (feature, latlng) {
return L.marker(latlng, {
radius: 8.0,
fillOpacity: 0,
Opacity: 0,
fillColor: 'transparent',
color: 'transparent',
}).bindTooltip(feature.properties.value).openTooltip();
}
}).addTo(map);
but I received the following error in console:
(index):333 Uncaught TypeError: realtime.bindTooltip is not a function at bindFeaturePopupx ((index):333) at Array.forEach (
) at NewClass. ((index):351) at NewClass.fireEvent (leaflet-src.js:461) at NewClass._onNewData (leaflet-realtime.js:787) at NewClass. (leaflet-realtime.js:696) at leaflet-src.js:54 at success (leaflet-realtime.js:343) at XMLHttpRequest. (leaflet-realtime.js:87)
Is there anyone to solve this problem?
Cheers
My JS is really really poor but the following code is working from me...maybe you can figure it out from that:
return L.marker(latlng, {
icon: icon(ambulette, "green"),
title: feature.properties.Name,
rotationAngle: feature.properties.heading
}).bindTooltip(feature.properties.id, {
permanent: true,
direction: 'top'
});}