Skip to content

Missing points when bounds are scoped to the extent of points #234

@ajhaupt7

Description

@ajhaupt7

I've noticed this (inconsistently) on several occasions: when the bounds that are used to create the bbox sent to Supercluster are created by iterating over them and extending the bounds to each point's geometry, sometimes points get left out. I have a working CodeSandbox to reproduce this: https://codesandbox.io/s/supercluster-points-8kqttt.

In this example, the points are:

const features = [
  {
    type: "Feature",
    properties: {
      isUser: true,
      userId: "5"
    },
    geometry: {
      type: "Point",
      coordinates: [-123.211605, 43.972615]
    }
  },
  {
    type: "Feature",
    properties: {
      isUser: true,
      userId: "3"
    },
    geometry: {
      type: "Point",
      coordinates: [-123.245515, 43.9150233333333]
    }
  },
  {
    type: "Feature",
    properties: {
      isUser: true,
      userId: "16"
    },
    geometry: {
      type: "Point",
      coordinates: [-123.192528333333, 44.0307166666667]
    }
  },
  {
    type: "Feature",
    properties: {
      state: "old",
      userId: "8"
    },
    geometry: {
      type: "Point",
      coordinates: [-123.194573333333, 44.0107]
    }
  }
];

The bbox that gets passed to supercluster ends up being [-123.245515, 43.9150233333333, -123.192528333333, 44.0307166666667]. The point that gets left out (ie not contained within a cluster, but not returned as an individual point either) has the coordinates [-123.245515, 43.9150233333333], which represents the southwest corner of the bbox. It would make more sense to me if both that and the point with userId: "16" were both left out, since point 16 represents the northeast corner of the bbox, but point 16 is consistently returned.

This is definitely an edge case (literally, on the edge of the bounding box, get it...), but I'm curious to understand what's going on.

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