Skip to content

getClusters always returns 1 cluster #188

Description

@jgiunta1

Its not entirely clear in the docs how getClusters takes the input and generates clusters with it.

What is bbox? Is it the distance of each point in order to include it in a cluster? Is it the bbox of all the points that will be included in the cluster calculation?

What is zoom? How does this variable change the way the clusters are partitioned?

Where can we set the distance required between given points for them to be "clustered"?

I have the following points:

// Outlier
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.7035824,40.8082369]}}

// Close Grouping
 {"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.6378459,40.7578053]}}
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.6368516,40.7578852]}}
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.637478,40.757829]}}
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-73.637179,40.7579205]}}

Initial bounds:

[westLng, southLat, eastLng, northLat]

 initBounds [-73.71451368188093, 40.753878070983085, -73.62592031811903, 40.812160916223675]

And I'm calling getCluster every time the map's bounds/zoom change. Ever time it returns one giant cluster when its clear that one of these points is an outlier.

    const superCluster = new Supercluster({
      radius: 40,
      extent: 256,
      maxZoom: 18,
    });

    superCluster.load(markerData);


    const clusterCalc = superCluster.getClusters(
      convertBoundsToBBox(bounds || initialBounds),
      zoom || 2
    );

   // clusterCalc.length always equals 1 regardless of changing border or zoom

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions