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

SuperClusterViewportAlgorithm at zoom 0-3 not working. #873

Open
Ketec opened this issue May 7, 2024 · 1 comment
Open

SuperClusterViewportAlgorithm at zoom 0-3 not working. #873

Ketec opened this issue May 7, 2024 · 1 comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@Ketec
Copy link

Ketec commented May 7, 2024

It does not seem to render starting at zoom 4. But I need zoom 3 for the world view.
Does it somehow ignore/filter out or not get viewport at these zoom levels?

new SuperClusterViewportAlgorithm({radius: 150, maxZoom: 16, viewportPadding: 50, minZoom: 3, minPoints: 5})

It looks like the bounds are broken at zoom 3?
image

I resorted to temporary hack, but I assume something is not correct in the getPaddedViewport math:

class SharedSuperClusterViewportAlgorithm extends SuperClusterViewportAlgorithm {
  public cluster({ map, mapCanvasProjection }: AlgorithmInput): Cluster[] {
    let state: SuperClusterViewportState;

    if (map.getZoom() <= 3) {
      state = {
        zoom: Math.round(map.getZoom()),
        view: [-180, -90, 180, 90]
      };
    } else {
      state = {
        zoom: Math.round(map.getZoom()),
        view: getPaddedViewport(
          map.getBounds(),
          mapCanvasProjection,
          this.viewportPadding
        ),
      };
    }
    
    return this.superCluster
      .getClusters(state.view, state.zoom)
      .map((feature: ClusterFeature<{ marker: any }>) =>
        this.transformCluster(feature)
      );
  }
}
@Ketec Ketec added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 7, 2024
@wangela
Copy link
Member

wangela commented May 7, 2024

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.

@Ketec Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants