Skip to content

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

@ewrt101

Description

@ewrt101

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions