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

problem with array when passing array #43

Open
someall2003 opened this issue Oct 18, 2021 · 3 comments
Open

problem with array when passing array #43

someall2003 opened this issue Oct 18, 2021 · 3 comments

Comments

@someall2003
Copy link

I am using Leaflet and the MovingMarker plugin. When I pass an array of hard-coded points, it works normally and the marker moves and loops. But when I pass the variable with an array it is not working. It cannot loop after moving the marker.
var array=[]
for (var i = 0; i < 3; i++) {
array.push([49.8567 + i, 5.3508+i]);
}
var marker1 = L.Marker.movingMarker(array, [10000], { autostart: true, loop: true } ).addTo(map);
with this code the loop is not working and the event end not firing?? can you help me please .

@zhanglizhisu
Copy link

I suppose your array +i give rise to this route is far. You could "array.push([49.8567 + i/10, 5.3508+i/10]); " and "L.polyline(array).addTo(map);" to see the effect.

@wbelgada
Copy link

Hello, I am using the library and I have encountered the same problem. I tried to add the polyline on my map to check that the coordinates are correct. After verification it is correct, just when we pass in parameter a list of coordinates the markers do not move. Do you have any idea what could cause this?

This is my code
geoJsonData.features.forEach((feature) => { coords = feature.geometry.coordinates[0]; newCoords = []; coords.forEach((coord) => { newCoords.push([coord[1],coord[0]]) }) marker = L.Marker.movingMarker( newCoords,[5000], {autostart: true}).addTo(map); markerList.push(marker); })

The marker is simply drawn at the first position but don't move.

@zhanglizhisu
Copy link

zhanglizhisu commented Aug 1, 2022 via email

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

3 participants