0

I have a clustered geojson source with more than 500 features. I added two layers for this source: one for rendering single features when there is no point_count and another when there is point_count (based on this example in the docs: https://maplibre.org/maplibre-gl-js-docs/example/cluster/).

The issue is some of the features (mainly towards the end of the features array) do not render at all, either as clusters or single circles, no matter how far I zoom in.

Here's an example that shows the issue: https://codepen.io/kaveh/pen/NWaaOaQ.

The red circles are from a separate non-clustered source and layer called stations and stations-single respectively, which are there to show that all features can actually be rendered. The layer has a click event that shows the coordinates in a popup.

The clustered source (called clustered-stations) and its layers are after line 6121 and are rendered in shades of blue/green.

If you click on "Zoom to missing station" at the bottom of the map, it zooms the map to station 353, rendered by stations-single in red, but not by clustered-stations. As you can see, some other stations in the clustered-stations layer are rendered fine.

Am I doing something wrong with the styling of my clustered layers or their filters? Or is this a bug in maplibre-gl (and possibly mapbox-gl, though I haven't tested it with mapbox)?

kaveh
  • 2,046
  • 1
  • 21
  • 33

1 Answers1

1

I found the source of the problem. It's caused by supercluster, one of the dependencies of maplibre-gl. It expects the longitudes to be within the [-180, 180] range and anything beyond that range gets dropped.

The quick workaround is to fix the coordinates. I've also submitted a PR to do this in supercluster: https://github.com/mapbox/supercluster/pull/194.

kaveh
  • 2,046
  • 1
  • 21
  • 33