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

Cannot read property 'layerPointToLatLng' of undefined when creating a circle #178

Open
ewrt101 opened this issue Nov 11, 2020 · 0 comments

Comments

@ewrt101
Copy link

ewrt101 commented Nov 11, 2020

when creating a circle in pointToLayer() i get the error Cannot read property 'layerPointToLatLng' of undefined when creating a circle. this does not happen with circleMarker()

this is my code

//map setup
var mymap = L.map('mapid'),
    realtime = L.realtime({
        url: 'http://localhost:3000',
        crossOrigin: true,
        type: 'json'
    }, {
        interval: 3 * 1000,
        onEachFeature(f, l){
            l.bindPopup(function() {
                return '<h3>' + f.properties.id + '</h3>';
            });
        },
        
        pointToLayer: function (feature, latlng) {
            return L.circle(latlng, {
                color: 'gray',
                fillColor: '#545454',
                fillOpacity: 0.5,
                radius: 75
            })
        }
        
        
    }).addTo(mymap);

//select tile provider
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { // other version of map https://tile.openstreetmap.bzh/br/{z}/{x}/{y}.png
    attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
    maxZoom: 20,
}).addTo(mymap);

realtime.once('update', function() {
    mymap.fitBounds(realtime.getBounds(), {maxZoom: 3});
});
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

1 participant