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

layerGroup not working #68

Open
geyerbri opened this issue Apr 29, 2020 · 2 comments
Open

layerGroup not working #68

geyerbri opened this issue Apr 29, 2020 · 2 comments

Comments

@geyerbri
Copy link

@Falke-Design

Using example code from your updated repo or README,

var marker1 = L.marker([51.5, -0.09], {time: "2013-01-22 08:42:26+01"});
var marker2 = L.marker([51.6, -0.09], {time: "2013-01-22 10:00:26+01"});
var marker3 = L.marker([51.7, -0.09], {time: "2013-01-22 10:03:29+01"});

var pointA = new L.LatLng(51.8, -0.09);
var pointB = new L.LatLng(51.9, -0.2);
var pointList = [pointA, pointB];

var polyline = new L.Polyline(pointList, {
    time: "2013-01-22 10:24:59+01",
    color: 'red',
    weight: 3,
    opacity: 1,
    smoothFactor: 1
});


layerGroup = L.layerGroup([marker1, marker2, marker3, polyline ]);
var sliderControl = L.control.sliderControl({layer:layerGroup});
myMap.addControl(sliderControl);
sliderControl.startSlider();

the page returns this error:

SliderControl.js:55 Uncaught TypeError: Cannot read property 'properties' of undefined
at compare (SliderControl.js:55)
at Array.sort ()
at i.onAdd (SliderControl.js:85)
at i.addTo (leaflet.js:5)
at i.addControl (leaflet.js:5)
at (index):59

Error does not appear when using geoJSON().

Any idea what's going on?

(example at: https://geyerbri.github.io/LeafletSlider/test.html)
(code at: https://github.com/geyerbri/LeafletSlider/blob/master/test.html)

@Falke-Design
Copy link

Falke-Design commented Apr 29, 2020

Hi @geyerbri,
I fixed the problem. It was because normal markers have no feature (geojson) property

@geyerbri
Copy link
Author

Thank you so much!

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