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

Improve Marker clustering #307

Open
arminfuerst opened this issue Nov 22, 2023 · 2 comments
Open

Improve Marker clustering #307

arminfuerst opened this issue Nov 22, 2023 · 2 comments

Comments

@arminfuerst
Copy link

An option to force distinct markers for each charging location would be nice or an option to define the minimal amount of markers to be merged.
What I would like to achieve is to be able to screen the next possible charging locations on a long route. For example I am driving around 600-800km on a day (mainly highway), so I will have to charge 2 to 3 times. I'd like to filter for the stations I have a good tariff for (for example assume EnBW in Germany) and I am looking for reasonable stops on A3 from Passau to Frankfurt. Currently, this looks like this screenshot:
image
For example, I see 4 charging locations near Regensburg. When I zoom in, it seems as only one of those 4 charging locations is really located close to the A3:
image
If I zoom in even more, I can recognize, that there are 2 charging locations (instead of only 1) on the A3:
image
But this zoom-level is far to much detail to gain an overview for my route.
My typical use case is to search for the next reasonable charging location during my current charging, that's why it would be helpful to do this with this great app.

@johan12345
Copy link
Collaborator

In general, marker clustering is required when many markers are shown on the map to keep the map from being laggy (see also, e.g., #285) or even crashing. So we definitely cannot add an option to completely disable clustering.

To further improve the performance (especially in terms of loading times), we sometimes perform the clustering on the server side if the data source (GoingElectric) supports it - in this case we don't have much control over the clustering algorithm except for one parameter (clusterDistance) that we can set. I already did some tweaking of this earlier, but it's hard to get it right for all cases (if it's too low, the map is too cluttered when there are many chargers, and if it's too high we run into situations like the one you described when there are few chargers).

Above a certain zoom level, or if the data source doesn't support server-side clustering (OpenChargeMap), we do switch to client-side clustering and would have a bit more control about the clustering algorithm and its parameters. So this case could definitely be optimized a bit more. But still, as I said, it's always a tradeoff and hard to get right for all cases...

@johan12345 johan12345 changed the title Add an option "distinct markers" (or similar) Improve Marker clustering Nov 24, 2023
@arminfuerst
Copy link
Author

When creating the suggestion, I was aware of the fact that a "misuse" results in a laggy responsiveness. That's why my suggestion included the idea to solve this by defining a minimal amount of markers needed to be merged. Since this might be unclear, I try to explain:
Assume, I define "5" as a minimal amount. The generation remains unchanged and if a merging would be done but the amount to markers is less then 5, they are not merged. In my first screenshot this would result in just two merged markers (both near Munich) while all others are displayed distinctively.
I had the idea based on the map in Goingelectric where there is an option not to merge the markers.
I would be happy to discuss pros and cons of alternate ideas. For my use case, probably adding a filter to only show locations being less than x km away from highways would also simplify my use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants