-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Exception in LatLngBounds.intersects() with chunkedLoading #743
Comments
Hmm, so you are calling clearLayers while the chunkedLoading is still going on? |
Why are the bounds not valid? |
I happen to face the same issue or at least a close one, reproducible when I try to zoom / move the map during the building/rendering of the clusters. I'll try to see if I can reproduce it. My bug:
I'll also post a more verbose stacktrace if necessary. |
Hi, Might be similar to https://stackoverflow.com/questions/44295940/leaflet-markercluster-and-hashable |
@ghybs I have the exact same issue and your answer looks totaly right to me: MCG does not maintain a valid state between each chunkedLoad, triggering this warning (and errors sometimes although I wasn't able to reproduce it) when the map is resized, zoomed, or dragged. I see three high-level solutions:
I have no knowledge of the inner architecture of neither leaflet nor MCG so I may certainly be misunderstanding the problem / the possible solutions. |
fixed this by disabling chunked loading, only was an issue on IOS in a webview though ... strange bug! |
As a temporary fix it might be possible to use the chunckProgress function. It doesn't work for my use case though. |
@danzel I did some debugging and it seems that a child in If fixed this locally using this code:
I think this code is pretty performance critical, so I also tried:
Both seem to work. I have seen the issue with missing bounds quite often. I only clear the markerCluster partially and once it's cleared I instantly pump in new data (so I am not sure if this could be the reason). I remove the markers using the I can create a PR if you want or feel free to go ahead :). I am not sure if I can create a test though. |
I´m using Angular Version 5.2.9. It´s the same like the marker-clustering-realworld.10000 example: `
` |
Hi, I am still getting this same error when opening the map. It happens specifically when used in conjuction with the Leaflet.pm lib used to draw shapes. It's possibly caused by adding a new shape on the map in the middle of the chunked loading process. Disabling chunkLoading fixes it. |
I am currently working on a Map Application loading 1000+ of markers via ajax, clustering them using markerclusters. When enabling chunkedLoading, and only then, I randomly experience the following exception while dragging:
It happens in the function
L.LatLngBounds.prototype.intersects()
being called fromL.MarkerCluster._recursively()
. Since there is no better way to update lots of markers against an external loaded set, updating is done by callingclearLayers()
andaddLayers()
. I have tested this issue on recent Firefox and Google Chrome.Of course the marker update function is bound to "zoomend dragend", and the mass update calls seem to conflict with the event MarkerClusters is binding itself for clustering functionality, therefore trying to check intersection of already gone markers. Since there is no exception handling, the map cannot be dragged anymore after failing as above.
I think there should either be exception handling, validity or timing checks with chunkedLoading enabled.
The text was updated successfully, but these errors were encountered: