-
-
Notifications
You must be signed in to change notification settings - Fork 689
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
Clustering breaks when using maxzoom
<= clusterMaxZoom
#2691
Comments
clusterMaxZoom is intended to define when to stop clustering. If you would like to have the cluster in higher zoom level you need to increase the cluterMaxZoom. |
it keeps clustering even past the set in the example the |
Ahh, I see the issue now.
maplibre-gl-js/src/source/geojson_source.ts Line 178 in 6794451
I also see some problem with the typings that can be improved. |
i adapted a jsfiddle i found that used supercluster and openlayers map to the latest version of supercluster and the same sample data, its not showing this bug: https://jsfiddle.net/0z5gsq63/25/ i have to admit i am not feeling at home working with javascript and typescript.. we are using this entire library from kotlinjs.. and i am more used to backend work anyways, but i will try my best to track down the root of the issue anyways |
Let me know if you need any guidance doing so. |
i think i found the culprit in geojson source the maplibre-gl-js/src/source/geojson_source.ts Line 140 in e50a264
this is not the same property as that is passed into this was not documented anywhere i could find i would suggest to add this line to initialization in geojson source if (options.cluster === true && options.clusterMaxZoom !== undefined) this.maxzoom = Math.max(this.maxzoom, options.clusterMaxZoom + 1); i think this should be fixed either by improved documentation or implicitely doing the 'correct' thing based on user input... or at least a warning when the source |
I'm not following, the following line takes the |
The behavior here is strange. here's my hacked addSource code: map.addSource('earthquakes', {
type: 'geojson',
// Point to GeoJSON data. This example visualizes all M1.0+ earthquakes
// from 12/22/15 to 1/21/16 as logged by USGS' Earthquake hazards program.
data: data,
cluster: true,
maxzoom: clusterMaxZoom > 17 ? clusterMaxZoom + 1 : 18, // 18 is the default so keeping it as original, this is the hack...
clusterMaxZoom: clusterMaxZoom, // Max zoom to cluster points on
clusterRadius: 50 // Radius of each cluster when clustering points (defaults to 50)
}); |
Try reproducing this on a simple scenario. Diffs are relatively new to geojson and I'm not sure how well tested they are... |
Use maxzoom - all small letters. See my code. |
i think i found and fixed the culprit of that weird crash.. there was some code in our app that added sources and layers without checking if they exist already... not sure why that would be causing issues... but i guess it heppened because those sources get added while zoomed in further than the default maxzoom ... |
Correct.
If you set If you want the clustering to stop at z18 you need to set So I don't think this is a bug, it's working as expected, but I do agree that we should omit a warning if I think a warning is less dangerous than trying to override the I've put together #4604 as a suggestion. |
I suggest changing the issue title to "clustering breaks when using maxzoom <= clusterMaxZoom" be better represent the actual issue reported here. |
clusterMaxZoom
of 18 or highermaxzoom
<= clusterMaxZoom
maplibre-gl-js version: 3.1.0
browser: firefox
Steps to Trigger Behavior
maxzoom
on your map, lets assume24
or25
clusterMaxZoom
of 18 or higher on ageojson
sourceLink to Demonstration
https://jsfiddle.net/axL71c8q/6/
Expected Behavior
clusters disappear/expand into actual data once zoomed in further than
clusterMaxZoom
Actual Behavior
clusters stay around no matter how far you zoom in,
clustering on indoor maps is impossible in its current state
The text was updated successfully, but these errors were encountered: