manubb / Leaflet.PixiOverlay

Bring Pixi.js power to Leaflet maps
MIT License
463 stars 85 forks source link

Collision Issue #39

Closed nerdherdwa closed 4 years ago

nerdherdwa commented 4 years ago

Awesome work on this looks great when rendering out data points and has solved an issue with rendering 5k+ markers with leaflet. The issue im having is that im using the demo for the french cities as i like the way the markers are rendered, but when it comes to process collision on my datasets it is either crashing the browser or takes a very long time to calculate. And im assuming its the density of the points that is crashing my browser. As i have some datasets that its rendering 126k markers in about 33s but then i have a dataset of only 2k and the browser crashes during the quadtrees calculation. The largest dataset that i have passed through is 477K markers which actually renders the points but takes 12578s to complete the process. Any suggestions on how to improve the processing of these points faster or more efficiently. I want to continue to use the code in my application but struggling to find a solution to improve the processing of the points.

some examples of the results that im getting, though the first one did take some time to render (477K markers)

GLD_WOD_Data_Zoom CTD_WOD_Data MBT_WOD_Data
manubb commented 4 years ago

Hi. Nice pictures! Can you try to decrease the size of the markers? (i agree though that this is not a good solution...)

manubb commented 4 years ago

Can you upload the 2k dataset that crashes the fix collision function? (so that i can test it and see what can be done).

nerdherdwa commented 4 years ago

mrb.zip

Here is zip file of the json file with the data that crashes browser when attempting to create zoom level between 5 and 16. I can get it to render the page if i only put one zoom level but not really a solution considering the density of the points.

WOD_Data_MRB_Zoom5_10598pts WOD_Data_MRB_Zoom8_809pts_(-23 72501,10089844) WOD_Data_MRB_Zoom8_4582pts_(-10 90895,93 60339) WOD_Data_MRB_Zoom9_2000pts_(-8 8339,163 37151)

nerdherdwa commented 4 years ago

Any feedback on the density of points when trying to calculate the collision positions

manubb commented 4 years ago

Hi. Sorry for the delay but i think that i found the root of the problem. Can you tell if the problem happens randomly on the 2k dataset? (Sometimes the computation succeeds in a few seconds and sometimes it fails after a much longer times.)

manubb commented 4 years ago

I've pushed a new circles.js file that fixes the crashes with the 2k dataset. Can you check on your side?

manubb commented 4 years ago

I've added a demo with the 2k dataset here.

nerdherdwa commented 4 years ago

@manubb no worries the areas where i had issues with small amounts of points rendering due to density of the points, now seems fixed when using the new circle.js file, they render all the points with out the browser crashing. It was always crash would only render once i reduced the number of points to around 500

7k points rendered at a position was previously crashing

7000pts

Thanks for your help my next option was cluster at the postgis database api and then only render one cluster point out for those areas that had issues

manubb commented 4 years ago

The collision fix function was not designed to handle efficiently many points sharing same position. If you still have performance issue with the 477k dataset, you can consider doing some preprocessing to fix collisions on the same position clusters.