Mapbox-gl-js: Points are not clustered past z20

Created on 4 Apr 2018  ·  7Comments  ·  Source: mapbox/mapbox-gl-js

v0.44.2:

Steps to Trigger Behavior

  1. open https://jsbin.com/pedanaluke/1/edit?html,output
  2. You can see the circle layer with correctly clustered points at zoom 17
  3. zoom in (switching to heatmap)
  4. zoom further in (switching to second circle layer)

Expected Behavior

  • when zooming in to second circle layer, I expect that the points are clustered.

Actual Behavior

  • When you zoom in to the second circle layer, you can see that the points aren't clustered, even if i set clusterMaxZoom: 27
bug needs investigation

Most helpful comment

Experiencing something similar here. On our maps we want clustering all the way to the max zoom, then at that level you can click on a cluster to see a tooltip of the features included. Despite a clusterMaxZoom of 22 clusters breaks apart at 18 if that is defined as our maxZoom an we are zoom in to that limit exactly. However, if we set the map maxZoom to 17.9 and zoom accordingly the clusters remain. So we've worked around it but it certainly doesn't feel right or make any sense.

All 7 comments

You forgot to scale heatmap-weight with point_count. https://output.jsbin.com/tixoneyako/

Thank you!

But actually i don't see how this explains why on the second circle layer, the points aren't clustered?
I modified the example to show only some points (actually copy&paste points, some of them slightly varied, some exact copies). https://jsbin.com/pedanaluke/1/edit?html,output
As you can see, they have to get colored if they were clustered correctly, but they arent (all color black).

@fighterii hmm... clusterMaxZoom can't be more than source.maxzoom - 1, so you have to add e.g. maxzoom: 24 to the geojson source. However I can't understand why it stops clustering at 21 (expected 23) — looking, perhaps there's some kind of a limitation somewhere in the code on the maximum maxzoom...

@mourner : Maybe we can reopen the issue then again?

Experiencing something similar here. On our maps we want clustering all the way to the max zoom, then at that level you can click on a cluster to see a tooltip of the features included. Despite a clusterMaxZoom of 22 clusters breaks apart at 18 if that is defined as our maxZoom an we are zoom in to that limit exactly. However, if we set the map maxZoom to 17.9 and zoom accordingly the clusters remain. So we've worked around it but it certainly doesn't feel right or make any sense.

I have the same issue, but it occurs with overlapping points. I would like them to cluster to the map's maxZoom but the cluster layer only will display at most at max zoom 17. I have this issue posted here. https://stackoverflow.com/questions/64492138/mapbox-gl-cluster-points-at-same-location-even-when-zoomed-in
I have been able to reproduce the exact issue in an example outside of my code. https://jsfiddle.net/xbw0cye7/14/
If you added the map option maxZoom: 17 then cluster will display at the max zoom but not at a higher level (18-24).

Update: Looks my issue occurs when creating a supercluster in geojson_source.js.
superclusterOptions: { maxZoom: options.clusterMaxZoom !== undefined ? Math.min(options.clusterMaxZoom, this.maxzoom - 1) : (this.maxzoom - 1),

I'm able to keep my cluster layer visible at maxZoom for overlapping points by changing the code above to remove the -1 and just use just maxzoom value. I guess this is by design?

This should be fixed by #10300. Related discussion: #2898.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aendrew picture aendrew  ·  3Comments

stevage picture stevage  ·  3Comments

Scarysize picture Scarysize  ·  3Comments

rasagy picture rasagy  ·  3Comments

mollymerp picture mollymerp  ·  3Comments