Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bindtoolup issue #181

Open
mostafahadizadeh1991 opened this issue Mar 16, 2021 · 1 comment
Open

bindtoolup issue #181

mostafahadizadeh1991 opened this issue Mar 16, 2021 · 1 comment

Comments

@mostafahadizadeh1991
Copy link

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

@omriasta
Copy link

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'            
                    });}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants