-
Notifications
You must be signed in to change notification settings - Fork 84
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
Interactivity with Markers using ParticleContainer #36
Comments
Hi.
|
Thanks. I'll look into those options |
@tabiodun have you find a way? |
At the deepest zoom levels (where you dont have that many points to render) you could switch your code to plain leaflet (probably with a canvas renderer) and hide the pixi containers. Otherwise a spatial index like |
@acycliq I tried to implement the French cities example using my dataset but it crashes the browser due to the If I remove that function (and the whole interactivity), I am able to display up to 100.000 markers (circles) with good responsiveness, but I miss the click event on each of them. I ended up using your first solution (canvas renderer) which works up to 10.000 points. For bigger datasets, I keep using clusters. |
@mirko77 Yes, it will not work with a
and in the onMousemove callback:
the
In my case I was thinking to have something like: Then given that I know the size of the markers I should be able to identify whether I am hovering over the background or a marker and which marker it is. Once you got a target marker you can use plain leaflet to draw a highlight over that marker. I didnt end up writing it (hence I dont know if it eventually works buy I think it will) because it was not a requirement and I am also using standard leaflet on a canvas renderer for the deep zoom levels to trigger my mouse events. One of the demos here is in this direction (use of a spatial index I mean) but it employs |
Thanks for this. How would you handle overlapping markers? |
I would always raise an event on the closest marker to my mouse. If I have a group of equidistant markers I would raise an event on whichever comes at position [0] of the set. If they exactly overlap (exactly the same coords and same size) then again raise an event on the marker at position [0]. Otherwise the smallest would take priority. But perfectly overlapping markers is always going to be a problem anyway. |
Thanks again I will give it a try |
No worries, I hope It works for you. Let me know how it goes |
Ok, here is what I have so far https://pixi-overlay.bitbucket.io/ code: https://bitbucket.org/pixi-overlay/pixi-overlay.bitbucket.io/src/master/ I get false hits at closer zoom levels, I suppose the radius must be re-calculated based on the marker scale? I guess the radius in |
This is my take on this so far...I have oversimplified your example, I have only two points and they are miles and miles away. I tried to draw a highlight when the mouse hovers over the marker. There is some scaling that has to be taken into account, but I am not sure if I got it. With regards to your question about the radius, I believe it is in pixels. (which make more sense, since kdbush and the other algorithms are generic methodologies, they are not specific to GIS). (Btw I also noticed there is |
Thanks, nice one. I tried to use it with my datasets. It works well for markers far away from each other, but again the issues start when there are many overlapping markers. |
Hi.
Is there a way to add click handlers to the markers drawn with the particle container (like the 1 million markers demo?) or if not to the us cities simple example where the markers dont change size on zoom?
The text was updated successfully, but these errors were encountered: